From patchwork Fri Sep 24 17:18:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 12516201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34D9FC433EF for ; Fri, 24 Sep 2021 17:18:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C67BD61250 for ; Fri, 24 Sep 2021 17:18:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C67BD61250 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 70F9A6B0074; Fri, 24 Sep 2021 13:18:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BFBD6B0075; Fri, 24 Sep 2021 13:18:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AF69900002; Fri, 24 Sep 2021 13:18:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 4EF056B0074 for ; Fri, 24 Sep 2021 13:18:32 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0C4391808F83D for ; Fri, 24 Sep 2021 17:18:32 +0000 (UTC) X-FDA: 78623126064.22.8A08A40 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 8322420019D7 for ; Fri, 24 Sep 2021 17:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632503911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Vd5ZE4YLtOCXyKgQM0MGouYb2uMkTroJbSS8in5XqM=; b=U5Kp/JJqnRv7f4Gxogd7oKMJDc93tYqBPKtiYKUd+SdKJOmUQN1XLvzlXldSv5FxrsH/ad 95YcGp1ltlz4wZCNwrD6MKNxIM3tu5NCkJQtPVdIWnJ90heeaqP/v0wXEf6pib5BLru7m7 e05R2UhEqTGeP2eCWJ8kCds82YKroyw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-LV6ULrfEMW222u8Hp8wIZA-1; Fri, 24 Sep 2021 13:18:29 -0400 X-MC-Unique: LV6ULrfEMW222u8Hp8wIZA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8234F1922035; Fri, 24 Sep 2021 17:18:27 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDCBC19D9F; Fri, 24 Sep 2021 17:18:24 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH v3 3/9] mm: Make swap_readpage() void From: David Howells To: willy@infradead.org, hch@lst.de, trond.myklebust@primarydata.com Cc: Jens Axboe , "Darrick J. Wong" , 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 Date: Fri, 24 Sep 2021 18:18:24 +0100 Message-ID: <163250390413.2330363.3248359518033939175.stgit@warthog.procyon.org.uk> In-Reply-To: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk> References: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8322420019D7 X-Stat-Signature: kfxq1ntyyof6dgwm1gferco515rc83zk Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="U5Kp/JJq"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf26.hostedemail.com: domain of dhowells@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=dhowells@redhat.com X-HE-Tag: 1632503911-735741 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 cc: Matthew Wilcox cc: Christoph Hellwig cc: Jens Axboe cc: Darrick J. Wong cc: linux-xfs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org Reviewed-by: Matthew Wilcox (Oracle) --- 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 /* 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)