lkml.org 
[lkml]   [2020]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC PATCH 3/9] btrfs: use set/clear_fs_page_private
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...

> @@ -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));

Cheers,

Dave.

--
Dave Chinner
david@fromorbit.com

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