From patchwork Wed Apr 4 19:17:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 10323249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 883A460467 for ; Wed, 4 Apr 2018 19:29:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79EE827CEE for ; Wed, 4 Apr 2018 19:29:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EE1C28F5A; Wed, 4 Apr 2018 19:29:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 700BB28F0D for ; Wed, 4 Apr 2018 19:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751723AbeDDTTK (ORCPT ); Wed, 4 Apr 2018 15:19:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35196 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751645AbeDDTTF (ORCPT ); Wed, 4 Apr 2018 15:19:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFD9FEBFEC; Wed, 4 Apr 2018 19:19:04 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-89.rdu2.redhat.com [10.10.125.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1010494580; Wed, 4 Apr 2018 19:19:04 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Alexander Viro , Tejun Heo , Jan Kara , Josef Bacik , Mel Gorman , Jeff Layton Subject: [RFC PATCH 20/79] fs: add struct address_space to write_cache_pages() callback argument Date: Wed, 4 Apr 2018 15:17:57 -0400 Message-Id: <20180404191831.5378-8-jglisse@redhat.com> In-Reply-To: <20180404191831.5378-1-jglisse@redhat.com> References: <20180404191831.5378-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 04 Apr 2018 19:19:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 04 Apr 2018 19:19:04 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse Add struct address_space to callback arguments of write_cache_pages() Note this patch only add arguments and modify all callback functions signature, it does not make use of the new argument and thus it should be regression free. One step toward dropping reliance on page->mapping. Signed-off-by: Jérôme Glisse Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: Tejun Heo Cc: Jan Kara Cc: Josef Bacik Cc: Mel Gorman Cc: Jeff Layton --- fs/exofs/inode.c | 2 +- fs/ext4/inode.c | 7 +++---- fs/fuse/file.c | 1 + fs/mpage.c | 6 +++--- fs/nfs/write.c | 4 +++- fs/xfs/xfs_aops.c | 3 ++- include/linux/writeback.h | 4 ++-- mm/page-writeback.c | 9 ++++----- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index 41f6b04cbfca..54d6b7dbd4e7 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c @@ -691,7 +691,7 @@ static int write_exec(struct page_collect *pcol) * previous segment and will start a new collection. * Eventually caller must submit the last segment if present. */ -static int writepage_strip(struct page *page, +static int writepage_strip(struct page *page, struct address_space *mapping, struct writeback_control *wbc_unused, void *data) { struct page_collect *pcol = data; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 96dcae1937c8..63bf0160c579 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2697,10 +2697,9 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) return err; } -static int __writepage(struct page *page, struct writeback_control *wbc, - void *data) +static int __writepage(struct page *page, struct address_space *mapping, + struct writeback_control *wbc, void *data) { - struct address_space *mapping = data; int ret = ext4_writepage(mapping, page, wbc); mapping_set_error(mapping, ret); return ret; @@ -2746,7 +2745,7 @@ static int ext4_writepages(struct address_space *mapping, struct blk_plug plug; blk_start_plug(&plug); - ret = write_cache_pages(mapping, wbc, __writepage, mapping); + ret = write_cache_pages(mapping, wbc, __writepage, NULL); blk_finish_plug(&plug); goto out_writepages; } diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 3c602632b33a..e0562d04d84f 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1794,6 +1794,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req, } static int fuse_writepages_fill(struct page *page, + struct address_space *mapping, struct writeback_control *wbc, void *_data) { struct fuse_fill_wb_data *data = _data; diff --git a/fs/mpage.c b/fs/mpage.c index b03a82d5b908..d25f08f46090 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -479,8 +479,8 @@ void clean_page_buffers(struct page *page) clean_buffers(page, ~0U); } -static int __mpage_writepage(struct page *page, struct writeback_control *wbc, - void *data) +static int __mpage_writepage(struct page *page, struct address_space *_mapping, + struct writeback_control *wbc, void *data) { struct mpage_data *mpd = data; struct bio *bio = mpd->bio; @@ -734,7 +734,7 @@ int mpage_writepage(struct page *page, get_block_t get_block, .get_block = get_block, .use_writepage = 0, }; - int ret = __mpage_writepage(page, wbc, &mpd); + int ret = __mpage_writepage(page, page->mapping, wbc, &mpd); if (mpd.bio) { int op_flags = (wbc->sync_mode == WB_SYNC_ALL ? REQ_SYNC : 0); diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 1f7723eff542..ffab026b9632 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -693,7 +693,9 @@ int nfs_writepage(struct address_space *mapping, struct page *page, return ret; } -static int nfs_writepages_callback(struct page *page, struct writeback_control *wbc, void *data) +static int nfs_writepages_callback(struct page *page, + struct address_space *mapping, + struct writeback_control *wbc, void *data) { int ret; diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 981a2a4e00e5..00922a82ede6 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -1060,6 +1060,7 @@ xfs_writepage_map( STATIC int xfs_do_writepage( struct page *page, + struct address_space *mapping, struct writeback_control *wbc, void *data) { @@ -1179,7 +1180,7 @@ xfs_vm_writepage( }; int ret; - ret = xfs_do_writepage(page, wbc, &wpc); + ret = xfs_do_writepage(page, mapping, wbc, &wpc); if (wpc.ioend) ret = xfs_submit_ioend(wbc, wpc.ioend, ret); return ret; diff --git a/include/linux/writeback.h b/include/linux/writeback.h index fdfd04e348f6..70361cc0ff54 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -358,8 +358,8 @@ void wb_update_bandwidth(struct bdi_writeback *wb, unsigned long start_time); void balance_dirty_pages_ratelimited(struct address_space *mapping); bool wb_over_bg_thresh(struct bdi_writeback *wb); -typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, - void *data); +typedef int (*writepage_t)(struct page *page, struct address_space *mapping, + struct writeback_control *wbc, void *data); int generic_writepages(struct address_space *mapping, struct writeback_control *wbc); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 5bb8804967ca..67b857ee1a1c 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2236,7 +2236,7 @@ int write_cache_pages(struct address_space *mapping, goto continue_unlock; trace_wbc_writepage(wbc, inode_to_bdi(mapping->host)); - ret = (*writepage)(page, wbc, data); + ret = (*writepage)(page, mapping, wbc, data); if (unlikely(ret)) { if (ret == AOP_WRITEPAGE_ACTIVATE) { unlock_page(page); @@ -2294,10 +2294,9 @@ EXPORT_SYMBOL(write_cache_pages); * Function used by generic_writepages to call the real writepage * function and set the mapping flags on error */ -static int __writepage(struct page *page, struct writeback_control *wbc, - void *data) +static int __writepage(struct page *page, struct address_space *mapping, + struct writeback_control *wbc, void *data) { - struct address_space *mapping = data; int ret = mapping->a_ops->writepage(mapping, page, wbc); mapping_set_error(mapping, ret); return ret; @@ -2322,7 +2321,7 @@ int generic_writepages(struct address_space *mapping, return 0; blk_start_plug(&plug); - ret = write_cache_pages(mapping, wbc, __writepage, mapping); + ret = write_cache_pages(mapping, wbc, __writepage, NULL); blk_finish_plug(&plug); return ret; }