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: <20200426222054.GA2005@dread.disaster.area>
Date:   Mon, 27 Apr 2020 08:20:54 +1000
From:   Dave Chinner <david@...morbit.com>
To:     Guoqing Jiang <guoqing.jiang@...ud.ionos.com>
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        hch@...radead.org, willy@...radead.org, Chris Mason <clm@...com>,
        Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org
Subject: Re: [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@...com>
> Cc: Josef Bacik <josef@...icpanda.com>
> Cc: David Sterba <dsterba@...e.com>
> Cc: linux-btrfs@...r.kernel.org
> Signed-off-by: Guoqing Jiang <guoqing.jiang@...ud.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@...morbit.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ