Re: [RFC PATCH 3/9] btrfs: use set/clear_fs_page_private

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

 



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@xxxxxx>
> Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>
> Cc: David Sterba <dsterba@xxxxxxxx>
> Cc: linux-btrfs@xxxxxxxxxxxxxxx
> Signed-off-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxxxxxxxx>

....

>  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@xxxxxxxxxxxxx



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux