lkml.org 
[lkml]   [2021]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH v3 3/9] mm: Make swap_readpage() void
    From
    Date
    None of the callers of swap_readpage() actually check its return value and,
    indeed, the operation may still be in progress, so remove the return value.

    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Matthew Wilcox <willy@infradead.org>
    cc: Christoph Hellwig <hch@lst.de>
    cc: Jens Axboe <axboe@kernel.dk>
    cc: Darrick J. Wong <djwong@kernel.org>
    cc: linux-xfs@vger.kernel.org
    cc: linux-fsdevel@vger.kernel.org
    cc: linux-mm@kvack.org
    ---

    include/linux/swap.h | 2 +-
    mm/page_io.c | 11 +++--------
    2 files changed, 4 insertions(+), 9 deletions(-)

    diff --git a/include/linux/swap.h b/include/linux/swap.h
    index 576d40e33b1f..293eba012d4f 100644
    --- a/include/linux/swap.h
    +++ b/include/linux/swap.h
    @@ -416,7 +416,7 @@ extern void kswapd_stop(int nid);
    #include <linux/blk_types.h> /* for bio_end_io_t */

    /* linux/mm/page_io.c */
    -extern int swap_readpage(struct page *page, bool do_poll);
    +void swap_readpage(struct page *page, bool synchronous);
    extern int swap_writepage(struct page *page, struct writeback_control *wbc);
    int __swap_writepage(struct page *page, struct writeback_control *wbc);
    extern int swap_set_page_dirty(struct page *page);
    diff --git a/mm/page_io.c b/mm/page_io.c
    index afd18f6ec09e..b9fe25101a39 100644
    --- a/mm/page_io.c
    +++ b/mm/page_io.c
    @@ -352,10 +352,9 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc)
    return 0;
    }

    -int swap_readpage(struct page *page, bool synchronous)
    +void swap_readpage(struct page *page, bool synchronous)
    {
    struct bio *bio;
    - int ret = 0;
    struct swap_info_struct *sis = page_swap_info(page);
    blk_qc_t qc;
    struct gendisk *disk;
    @@ -382,15 +381,13 @@ int swap_readpage(struct page *page, bool synchronous)
    struct file *swap_file = sis->swap_file;
    struct address_space *mapping = swap_file->f_mapping;

    - ret = mapping->a_ops->readpage(swap_file, page);
    - if (!ret)
    + if (!mapping->a_ops->readpage(swap_file, page))
    count_vm_event(PSWPIN);
    goto out;
    }

    if (sis->flags & SWP_SYNCHRONOUS_IO) {
    - ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
    - if (!ret) {
    + if (!bdev_read_page(sis->bdev, swap_page_sector(page), page)) {
    if (trylock_page(page)) {
    swap_slot_free_notify(page);
    unlock_page(page);
    @@ -401,7 +398,6 @@ int swap_readpage(struct page *page, bool synchronous)
    }
    }

    - ret = 0;
    bio = bio_alloc(GFP_KERNEL, 1);
    bio_set_dev(bio, sis->bdev);
    bio->bi_opf = REQ_OP_READ;
    @@ -435,7 +431,6 @@ int swap_readpage(struct page *page, bool synchronous)

    out:
    psi_memstall_leave(&pflags);
    - return ret;
    }

    int swap_set_page_dirty(struct page *page)

    \
     
     \ /
      Last update: 2021-09-24 19:21    [W:4.042 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site