lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <05690b56-e7e2-14d5-7a56-00bcddc61c78@kernel.org>
Date:   Tue, 11 Apr 2023 16:37:06 +0800
From:   Chao Yu <chao@...nel.org>
To:     Jaegeuk Kim <jaegeuk@...nel.org>
Cc:     linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] f2fs: clean up with {attach,detach}_page_private()

On 2023/4/11 2:47, Jaegeuk Kim wrote:
> On 04/10, Chao Yu wrote:
>> No logic changes.
>>
>> Signed-off-by: Chao Yu <chao@...nel.org>
>> ---
>>   fs/f2fs/f2fs.h | 32 ++++++++------------------------
>>   1 file changed, 8 insertions(+), 24 deletions(-)
>>
>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>> index ec8387da7f74..c378aedcadea 100644
>> --- a/fs/f2fs/f2fs.h
>> +++ b/fs/f2fs/f2fs.h
>> @@ -1416,11 +1416,8 @@ static inline bool page_private_##name(struct page *page) \
>>   #define PAGE_PRIVATE_SET_FUNC(name, flagname) \
>>   static inline void set_page_private_##name(struct page *page) \
>>   { \
>> -	if (!PagePrivate(page)) { \
>> -		get_page(page); \
>> -		SetPagePrivate(page); \
>> -		set_page_private(page, 0); \
>> -	} \
>> +	if (!PagePrivate(page)) \
>> +		attach_page_private(page, (void *)page->private); \
> 
> 		attach_page_private(page, (void *)0);

Correct, thanks for fixing this.

Thanks,

> 
>>   	set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)); \
>>   	set_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \
>>   }
>> @@ -1429,13 +1426,8 @@ static inline void set_page_private_##name(struct page *page) \
>>   static inline void clear_page_private_##name(struct page *page) \
>>   { \
>>   	clear_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \
>> -	if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER)) { \
>> -		set_page_private(page, 0); \
>> -		if (PagePrivate(page)) { \
>> -			ClearPagePrivate(page); \
>> -			put_page(page); \
>> -		}\
>> -	} \
>> +	if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER)) \
>> +		detach_page_private(page); \
>>   }
>>   
>>   PAGE_PRIVATE_GET_FUNC(nonpointer, NOT_POINTER);
>> @@ -1464,11 +1456,8 @@ static inline unsigned long get_page_private_data(struct page *page)
>>   
>>   static inline void set_page_private_data(struct page *page, unsigned long data)
>>   {
>> -	if (!PagePrivate(page)) {
>> -		get_page(page);
>> -		SetPagePrivate(page);
>> -		set_page_private(page, 0);
>> -	}
>> +	if (!PagePrivate(page))
>> +		attach_page_private(page, 0);
>>   	set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page));
>>   	page_private(page) |= data << PAGE_PRIVATE_MAX;
>>   }
>> @@ -1476,13 +1465,8 @@ static inline void set_page_private_data(struct page *page, unsigned long data)
>>   static inline void clear_page_private_data(struct page *page)
>>   {
>>   	page_private(page) &= GENMASK(PAGE_PRIVATE_MAX - 1, 0);
>> -	if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER)) {
>> -		set_page_private(page, 0);
>> -		if (PagePrivate(page)) {
>> -			ClearPagePrivate(page);
>> -			put_page(page);
>> -		}
>> -	}
>> +	if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER))
>> +		detach_page_private(page);
>>   }
>>   
>>   /* For compression */
>> -- 
>> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ