Re: [PATCH v2 06/10] mm/swap: use npage_to_sectors() and PAGE_SECTORS to clean up code

2020-05-15 Thread Leizhen (ThunderTown)
On 2020/5/15 12:14, Matthew Wilcox wrote: > On Thu, May 07, 2020 at 03:50:56PM +0800, Zhen Lei wrote: >> +++ b/mm/page_io.c >> @@ -38,7 +38,7 @@ static struct bio *get_swap_bio(gfp_t gfp_flags, >> >> bio->bi_iter.bi_sector = map_swap_page(page, ); >> bio_set_dev(bio,

Re: [PATCH v2 06/10] mm/swap: use npage_to_sectors() and PAGE_SECTORS to clean up code

2020-05-15 Thread Leizhen (ThunderTown)
On 2020/5/15 12:06, Matthew Wilcox wrote: > On Thu, May 07, 2020 at 03:50:56PM +0800, Zhen Lei wrote: >> @@ -266,7 +266,7 @@ int swap_writepage(struct page *page, struct >> writeback_control *wbc) >> >> static sector_t swap_page_sector(struct page *page) >> { >> -return

Re: [PATCH v2 06/10] mm/swap: use npage_to_sectors() and PAGE_SECTORS to clean up code

2020-05-14 Thread Matthew Wilcox
On Thu, May 07, 2020 at 03:50:56PM +0800, Zhen Lei wrote: > +++ b/mm/page_io.c > @@ -38,7 +38,7 @@ static struct bio *get_swap_bio(gfp_t gfp_flags, > > bio->bi_iter.bi_sector = map_swap_page(page, ); > bio_set_dev(bio, bdev); > - bio->bi_iter.bi_sector <<=

Re: [PATCH v2 06/10] mm/swap: use npage_to_sectors() and PAGE_SECTORS to clean up code

2020-05-14 Thread Matthew Wilcox
On Thu, May 07, 2020 at 03:50:56PM +0800, Zhen Lei wrote: > @@ -266,7 +266,7 @@ int swap_writepage(struct page *page, struct > writeback_control *wbc) > > static sector_t swap_page_sector(struct page *page) > { > - return (sector_t)__page_file_index(page) << (PAGE_SHIFT - 9); > +

[PATCH v2 06/10] mm/swap: use npage_to_sectors() and PAGE_SECTORS to clean up code

2020-05-07 Thread Zhen Lei
1. Replace "<<= (PAGE_SHIFT - 9)" with "*= PAGE_SECTORS" 2. Replace "<< (PAGE_SHIFT - 9)" with npage_to_sectors() Suggested-by: Matthew Wilcox Signed-off-by: Zhen Lei --- mm/page_io.c | 4 ++-- mm/swapfile.c | 12 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git