[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v10 09/17] rangeset: add rangeset_empty() function


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Fri, 13 Oct 2023 18:08:31 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M5lYfFSmNz0h5khXHvirrnIHh4xemtmov6rWyh5Uqtk=; b=kwDQYK7uxkK8/YP+mu5Q2j9u3WQ4v3Pa5IHYsM5j8xpiC9HUas7cfhTKqjlxJ1nDLabeZ6oNtrP6scEQIzGdhQezAObLl9QdL677j9CmKj+piw1Gx9sBd7l1FR0KIKobE43+P+uajzGPrIIZZbd2dJnvBc6L2LChaF5nWHHNPNXicNrI/t96K4Xv02gSN7UDrFLl+Eieiv4oZYE1XM/wklVjfL2dU562VkOYYXediQMRl30s6paOvasSqx91SayuhW87z7NTOt+fGwEzw8Z9QnBHg0uA/jGN4wfMnwM9Mh1FVM8U9OHCigWg2ZRf1UR0YJDcihqe0uOoRoN9eKHBhg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iwdlv5QMMfPzHZQk1okVCSZRwkr5hQfyC6vFKonXwKRe1Ku1yqI9Yv89oLBPg1n6QIEoEhzgjDnTyr91yC0iN/CaWFf3cHtG8pY2QNLNBa1vKK8b1eUBfUugMF3dEHsqIFG8UDges6gTDOA6PP9UrPTOPurkk4iDJl5PshBfZf3tcBmqNsPsaNL1mAfZUs3/dUewg/qjCYjTpDJeiR3K3F9epSG++OHf070WYVDSUghdIv2F0cmjVuDFvjjlf4uYAFhp6JNtVOAUavLA7/vkBlQyJuJt+46lygzwJENV36pJ6ob67Wmm8gKo5E4Y8hR+QJjjGvkVTADnpuKI3eEZmA==
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 13 Oct 2023 18:08:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZ/Vi+5V9BMbiD1kqnOLtHs/D1y7BIAg4AgAAC2gA=
  • Thread-topic: [PATCH v10 09/17] rangeset: add rangeset_empty() function

Hi Stewart,

Stewart Hildebrand <stewart.hildebrand@xxxxxxx> writes:

> On 10/12/23 18:09, Volodymyr Babchuk wrote:
>> This function can be used when user wants to remove all rangeset
>> entries but do not want to destroy rangeset itself.
>> 
>> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
>> 
>> ---
>> 
>> Changes in v10:
>> 
>>  - New in v10. The function is used in "vpci/header: handle p2m range sets 
>> per BAR"
>> ---
>>  xen/common/rangeset.c      | 9 +++++++--
>>  xen/include/xen/rangeset.h | 3 ++-
>>  2 files changed, 9 insertions(+), 3 deletions(-)
>> 
>> diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
>> index 35c3420885..420275669e 100644
>> --- a/xen/common/rangeset.c
>> +++ b/xen/common/rangeset.c
>> @@ -448,8 +448,7 @@ struct rangeset *rangeset_new(
>>      return r;
>>  }
>> 
>> -void rangeset_destroy(
>> -    struct rangeset *r)
>> +void rangeset_empty(struct rangeset *r)
>>  {
>>      struct range *x;
>> 
>> @@ -465,6 +464,12 @@ void rangeset_destroy(
>> 
>>      while ( (x = first_range(r)) != NULL )
>>          destroy_range(r, x);
>> +}
>> +
>> +void rangeset_destroy(
>> +    struct rangeset *r)
>> +{
>> +    rangeset_empty(r);
>> 
>>      xfree(r);
>>  }
>
> I think the list_del(&r->rangeset_list) operation (and associated
> locking and NULL check) shouldn't be moved to the new rangeset_empty()
> function, it should stay in rangeset_destroy().

Ahh, yes. It was a really stupid idea to move list_del(&r->rangeset_list); to
rangeset_empty().

-- 
WBR, Volodymyr


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.