Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] Minor parameter cleanups
@ 2019-10-29 17:28 David Sterba
  2019-10-29 17:28 ` [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io David Sterba
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Sterba @ 2019-10-29 17:28 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We can remove write_flags parameter in case the function also has wbc
(and the value is equal).

David Sterba (2):
  btrfs: sink write_flags to __extent_writepage_io
  btrfs: sink write flags to cow_file_range_async

 fs/btrfs/extent_io.c | 8 +++-----
 fs/btrfs/inode.c     | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io
  2019-10-29 17:28 [PATCH 0/2] Minor parameter cleanups David Sterba
@ 2019-10-29 17:28 ` David Sterba
  2019-10-30 11:25   ` Johannes Thumshirn
  2019-10-29 17:28 ` [PATCH 2/2] btrfs: sink write flags to cow_file_range_async David Sterba
  2019-10-30 11:39 ` [PATCH 0/2] Minor parameter cleanups Nikolay Borisov
  2 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2019-10-29 17:28 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

__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 <dsterba@suse.com>
---
 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;
 
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] btrfs: sink write flags to cow_file_range_async
  2019-10-29 17:28 [PATCH 0/2] Minor parameter cleanups David Sterba
  2019-10-29 17:28 ` [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io David Sterba
@ 2019-10-29 17:28 ` David Sterba
  2019-10-30 11:27   ` Johannes Thumshirn
  2019-10-30 11:39 ` [PATCH 0/2] Minor parameter cleanups Nikolay Borisov
  2 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2019-10-29 17:28 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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 <dsterba@suse.com>
---
 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,
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io
  2019-10-29 17:28 ` [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io David Sterba
@ 2019-10-30 11:25   ` Johannes Thumshirn
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2019-10-30 11:25 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@suse.de                                +49 911 74053 689
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] btrfs: sink write flags to cow_file_range_async
  2019-10-29 17:28 ` [PATCH 2/2] btrfs: sink write flags to cow_file_range_async David Sterba
@ 2019-10-30 11:27   ` Johannes Thumshirn
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2019-10-30 11:27 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@suse.de                                +49 911 74053 689
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Minor parameter cleanups
  2019-10-29 17:28 [PATCH 0/2] Minor parameter cleanups David Sterba
  2019-10-29 17:28 ` [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io David Sterba
  2019-10-29 17:28 ` [PATCH 2/2] btrfs: sink write flags to cow_file_range_async David Sterba
@ 2019-10-30 11:39 ` Nikolay Borisov
  2 siblings, 0 replies; 6+ messages in thread
From: Nikolay Borisov @ 2019-10-30 11:39 UTC (permalink / raw)
  To: David Sterba, linux-btrfs



On 29.10.19 г. 19:28 ч., David Sterba wrote:
> We can remove write_flags parameter in case the function also has wbc
> (and the value is equal).
> 
> David Sterba (2):
>   btrfs: sink write_flags to __extent_writepage_io
>   btrfs: sink write flags to cow_file_range_async
> 
>  fs/btrfs/extent_io.c | 8 +++-----
>  fs/btrfs/inode.c     | 8 +++-----
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 

For the whole series:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 17:28 [PATCH 0/2] Minor parameter cleanups David Sterba
2019-10-29 17:28 ` [PATCH 1/2] btrfs: sink write_flags to __extent_writepage_io David Sterba
2019-10-30 11:25   ` Johannes Thumshirn
2019-10-29 17:28 ` [PATCH 2/2] btrfs: sink write flags to cow_file_range_async David Sterba
2019-10-30 11:27   ` Johannes Thumshirn
2019-10-30 11:39 ` [PATCH 0/2] Minor parameter cleanups Nikolay Borisov

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org
	public-inbox-index linux-btrfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git