From: David Howells <dhowells@redhat.com>
To: willy@infradead.org, hch@lst.de, trond.myklebust@primarydata.com
Cc: Jens Axboe <axboe@kernel.dk>,
"Darrick J. Wong" <djwong@kernel.org>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, dhowells@redhat.com, dhowells@redhat.com,
darrick.wong@oracle.com, viro@zeniv.linux.org.uk,
jlayton@kernel.org, torvalds@linux-foundation.org,
linux-nfs@vger.kernel.org, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/9] mm: Make swap_readpage() void
Date: Fri, 24 Sep 2021 18:18:24 +0100 [thread overview]
Message-ID: <163250390413.2330363.3248359518033939175.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk>
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)
next prev parent reply other threads:[~2021-09-24 17:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 17:17 [RFC][PATCH v3 0/9] mm: Use DIO for swap and fix NFS swapfiles David Howells
2021-09-24 17:18 ` [PATCH v3 1/9] mm: Remove the callback func argument from __swap_writepage() David Howells
2021-09-24 17:18 ` [PATCH v3 2/9] mm: Add 'supports' field to the address_space_operations to list features David Howells
2021-09-24 20:10 ` Matthew Wilcox
2021-09-24 17:18 ` David Howells [this message]
2021-09-24 22:07 ` [PATCH v3 3/9] mm: Make swap_readpage() void Matthew Wilcox
2021-09-24 17:18 ` [PATCH v3 4/9] Introduce IOCB_SWAP kiocb flag to trigger REQ_SWAP David Howells
2021-09-26 21:56 ` Dave Chinner
2021-09-24 17:18 ` [PATCH v3 5/9] mm: Make swap_readpage() for SWP_FS_OPS use ->swap_rw() not ->readpage() David Howells
2021-09-24 17:18 ` [PATCH v3 6/9] mm: Make __swap_writepage() do async DIO if asked for it David Howells
2021-09-24 17:19 ` [PATCH v3 7/9] nfs: Fix write to swapfile failure due to generic_write_checks() David Howells
2021-09-24 17:19 ` [PATCH v3 8/9] block, btrfs, ext4, xfs: Implement swap_rw David Howells
2021-09-24 17:19 ` [PATCH v3 9/9] mm: Remove swap BIO paths and only use DIO paths David Howells
2021-09-25 14:56 ` Matthew Wilcox
2021-09-25 15:36 ` David Howells
2021-09-25 17:09 ` Matthew Wilcox
2021-09-26 23:08 ` Damien Le Moal
2021-09-27 1:25 ` Dave Chinner
2021-09-27 1:41 ` Damien Le Moal
2021-09-27 20:03 ` David Sterba
2021-09-25 23:42 ` [RFC][PATCH v3 0/9] mm: Use DIO for swap and fix NFS swapfiles Dave Chinner
2021-09-26 3:10 ` Matthew Wilcox
2021-09-26 22:36 ` Dave Chinner
2021-09-27 20:07 ` David Sterba
2021-09-28 3:11 ` NeilBrown
2021-09-30 15:54 ` Steve French
2021-09-29 15:45 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=163250390413.2330363.3248359518033939175.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=axboe@kernel.dk \
--cc=darrick.wong@oracle.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=trond.myklebust@primarydata.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox