Re: [PATCH 03/23] MM: drop swap_set_page_dirty

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

 



On Mon, Jan 24, 2022 at 02:48:32PM +1100, NeilBrown wrote:
> Pages that are written to swap are owned by the MM subsystem - not any
> filesystem.
> 
> When such a page is passed to a filesystem to be written out to a
> swap-file, the filesystem handles the data, but the page itself does not
> belong to the filesystem.  So calling the filesystem's set_page_dirty
> address_space operation makes no sense.  This is for pages in the given
> address space, and a page to be written to swap does not exist in the
> given address space.
> 
> So drop swap_set_page_dirty() which calls the address-space's
> set_page_dirty, and alway use __set_page_dirty_no_writeback, which is
> appropriate for pages being swapped out.

Yes, this looks sane to me:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>

> 
> Fixes-no-auto-backport: 62c230bc1790 ("mm: add support for a filesystem to activate swap files and use direct_IO for writing swap pages")
> Signed-off-by: NeilBrown <neilb@xxxxxxx>
> ---
>  include/linux/swap.h |    1 -
>  mm/page_io.c         |   14 --------------
>  mm/swap_state.c      |    2 +-
>  3 files changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index 3f54a8941c9d..a43929f7033e 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -419,7 +419,6 @@ extern void kswapd_stop(int nid);
>  
>  #ifdef CONFIG_SWAP
>  
> -extern int swap_set_page_dirty(struct page *page);
>  int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page,
>  		unsigned long nr_pages, sector_t start_block);
>  int generic_swapfile_activate(struct swap_info_struct *, struct file *,
> diff --git a/mm/page_io.c b/mm/page_io.c
> index f8c26092e869..34b12d6f94d7 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -438,17 +438,3 @@ int swap_readpage(struct page *page, bool synchronous)
>  	delayacct_swapin_end();
>  	return ret;
>  }
> -
> -int swap_set_page_dirty(struct page *page)
> -{
> -	struct swap_info_struct *sis = page_swap_info(page);
> -
> -	if (data_race(sis->flags & SWP_FS_OPS)) {
> -		struct address_space *mapping = sis->swap_file->f_mapping;
> -
> -		VM_BUG_ON_PAGE(!PageSwapCache(page), page);
> -		return mapping->a_ops->set_page_dirty(page);
> -	} else {
> -		return __set_page_dirty_no_writeback(page);
> -	}
> -}
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index 093ecf864200..d541594be1c3 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -31,7 +31,7 @@
>   */
>  static const struct address_space_operations swap_aops = {
>  	.writepage	= swap_writepage,
> -	.set_page_dirty	= swap_set_page_dirty,
> +	.set_page_dirty	= __set_page_dirty_no_writeback,
>  #ifdef CONFIG_MIGRATION
>  	.migratepage	= migrate_page,
>  #endif
> 
> 
---end quoted text---



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux