From patchwork Tue Oct 29 17:28:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 11218343 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E324713BD for ; Tue, 29 Oct 2019 17:28:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C02BF20830 for ; Tue, 29 Oct 2019 17:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727718AbfJ2R2r (ORCPT ); Tue, 29 Oct 2019 13:28:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:38262 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726261AbfJ2R2q (ORCPT ); Tue, 29 Oct 2019 13:28:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 54AD7B247; Tue, 29 Oct 2019 17:28:45 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 47867DA734; Tue, 29 Oct 2019 18:28:55 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io Date: Tue, 29 Oct 2019 18:28:55 +0100 Message-Id: <51963044924d80a39e183a726dfcf67ca7896576.1572369984.git.dsterba@suse.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org __extent_writepage reads write flags from wbc and passes both to __extent_writepage_io. This makes write_flags redundant and we can remove it. Signed-off-by: David Sterba Reviewed-by: Johannes Thumshirn --- fs/btrfs/extent_io.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index ed8ad14338de..ba1ddb2a5520 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3413,7 +3413,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, struct extent_page_data *epd, loff_t i_size, unsigned long nr_written, - unsigned int write_flags, int *nr_ret) + int *nr_ret) { struct extent_io_tree *tree = epd->tree; u64 start = page_offset(page); @@ -3428,6 +3428,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, size_t blocksize; int ret = 0; int nr = 0; + const unsigned int write_flags = wbc_to_write_flags(wbc); bool compressed; ret = btrfs_writepage_cow_fixup(page, start, page_end); @@ -3560,11 +3561,8 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, size_t pg_offset = 0; loff_t i_size = i_size_read(inode); unsigned long end_index = i_size >> PAGE_SHIFT; - unsigned int write_flags = 0; unsigned long nr_written = 0; - write_flags = wbc_to_write_flags(wbc); - trace___extent_writepage(page, inode, wbc); WARN_ON(!PageLocked(page)); @@ -3602,7 +3600,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, } ret = __extent_writepage_io(inode, page, wbc, epd, - i_size, nr_written, write_flags, &nr); + i_size, nr_written, &nr); if (ret == 1) goto done_unlocked; From patchwork Tue Oct 29 17:28:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 11218345 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B31914DB for ; Tue, 29 Oct 2019 17:28:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 19EB820830 for ; Tue, 29 Oct 2019 17:28:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727741AbfJ2R2t (ORCPT ); Tue, 29 Oct 2019 13:28:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:38272 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727456AbfJ2R2t (ORCPT ); Tue, 29 Oct 2019 13:28:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A1381B229; Tue, 29 Oct 2019 17:28:47 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 94749DA734; Tue, 29 Oct 2019 18:28:57 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 2/2] btrfs: sink write flags to cow_file_range_async Date: Tue, 29 Oct 2019 18:28:57 +0100 Message-Id: <8bfe15d0c80d0011c5fc48893345e7870e0f4e49.1572369984.git.dsterba@suse.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In commit "Btrfs: use REQ_CGROUP_PUNT for worker thread submitted bios", cow_file_range_async gained wbc as a parameter and this makes passing write flags redundant. Set it inside the function and remove the parameter. Signed-off-by: David Sterba Reviewed-by: Johannes Thumshirn --- fs/btrfs/inode.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 09118a0f82d1..e7ea139a8e63 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1201,8 +1201,7 @@ static int cow_file_range_async(struct inode *inode, struct writeback_control *wbc, struct page *locked_page, u64 start, u64 end, int *page_started, - unsigned long *nr_written, - unsigned int write_flags) + unsigned long *nr_written) { struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct cgroup_subsys_state *blkcg_css = wbc_blkcg_css(wbc); @@ -1214,6 +1213,7 @@ static int cow_file_range_async(struct inode *inode, int i; bool should_compress; unsigned nofs_flag; + const unsigned int write_flags = wbc_to_write_flags(wbc); unlock_extent(&BTRFS_I(inode)->io_tree, start, end); @@ -1724,7 +1724,6 @@ int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page, { int ret; int force_cow = need_force_cow(inode, start, end); - unsigned int write_flags = wbc_to_write_flags(wbc); if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW && !force_cow) { ret = run_delalloc_nocow(inode, locked_page, start, end, @@ -1740,8 +1739,7 @@ int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page, set_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, &BTRFS_I(inode)->runtime_flags); ret = cow_file_range_async(inode, wbc, locked_page, start, end, - page_started, nr_written, - write_flags); + page_started, nr_written); } if (ret) btrfs_cleanup_ordered_extents(inode, locked_page, start,