lkml.org 
[lkml]   [2020]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 3/9] btrfs: use set/clear_fs_page_private
From
Date
On 4/27/20 12:20 AM, Dave Chinner wrote:
> On Sun, Apr 26, 2020 at 11:49:19PM +0200, Guoqing Jiang wrote:
>> Since the new pair function is introduced, we can call them to clean the
>> code in btrfs.
>>
>> Cc: Chris Mason <clm@fb.com>
>> Cc: Josef Bacik <josef@toxicpanda.com>
>> Cc: David Sterba <dsterba@suse.com>
>> Cc: linux-btrfs@vger.kernel.org
>> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> ....
>
>> void set_page_extent_mapped(struct page *page)
>> {
>> - if (!PagePrivate(page)) {
>> - SetPagePrivate(page);
>> - get_page(page);
>> - set_page_private(page, EXTENT_PAGE_PRIVATE);
>> - }
>> + if (!PagePrivate(page))
>> + set_fs_page_private(page, (void *)EXTENT_PAGE_PRIVATE);
> Change the definition of EXTENT_PAGE_PRIVATE so the cast is not
> needed? Nothing ever reads EXTENT_PAGE_PRIVATE; it's only there to
> set the private flag for other code to check and release the extent
> mapping reference to the page...

Not know the code well, so I just make the cast ...

>> @@ -8331,11 +8328,9 @@ static int btrfs_migratepage(struct address_space *mapping,
>>
>> if (page_has_private(page)) {
>> ClearPagePrivate(page);
>> - get_page(newpage);
>> - set_page_private(newpage, page_private(page));
>> + set_fs_page_private(newpage, (void *)page_private(page));
>> set_page_private(page, 0);
>> put_page(page);
>> - SetPagePrivate(newpage);
>> }
> This is just:
> set_fs_page_private(newpage, clear_fs_page_private(page));
>

Thanks a lot! It is more better.

Thanks,
Guoqing

\
 
 \ /
  Last update: 2020-04-27 10:15    [W:0.081 / U:6.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site