All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] Structre and parameter cleanups
@ 2022-04-29 18:27 David Sterba
  2022-04-29 18:27 ` [PATCH 1/9] btrfs: sink parameter is_data to btrfs_set_disk_extent_flags David Sterba
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Simplify some argument passing, remove too-trivial helpers or unused
structure members.

David Sterba (9):
  btrfs: sink parameter is_data to btrfs_set_disk_extent_flags
  btrfs: remove btrfs_delayed_extent_op::is_data
  btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio
  btrfs: remove trivial helper update_nr_written
  btrfs: simplify handling of bio_ctrl::bio_flags
  btrfs: open code extent_set_compress_type helpers
  btrfs: rename io_failure_record::bio_flags to compress_type
  btrfs: rename bio_flags in parameters and switch type
  btrfs: rename bio_ctrl::bio_flags to compress_type

 fs/btrfs/ctree.c       |  2 +-
 fs/btrfs/ctree.h       |  5 ++-
 fs/btrfs/delayed-ref.c |  4 +--
 fs/btrfs/delayed-ref.h |  1 -
 fs/btrfs/disk-io.c     |  5 ++-
 fs/btrfs/disk-io.h     |  3 +-
 fs/btrfs/extent-tree.c | 10 +++---
 fs/btrfs/extent_io.c   | 73 ++++++++++++++++++------------------------
 fs/btrfs/extent_io.h   | 22 ++-----------
 fs/btrfs/inode.c       | 10 +++---
 10 files changed, 50 insertions(+), 85 deletions(-)

-- 
2.34.1


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

* [PATCH 1/9] btrfs: sink parameter is_data to btrfs_set_disk_extent_flags
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-01 20:24   ` Johannes Thumshirn
  2022-04-29 18:27 ` [PATCH 2/9] btrfs: remove btrfs_delayed_extent_op::is_data David Sterba
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter has been added in 2009 in the infamous monster commit
5d4f98a28c7d ("Btrfs: Mixed back reference  (FORWARD ROLLING FORMAT
CHANGE)") but not used ever since. We can sink it and allow further
simplifications.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.c       | 2 +-
 fs/btrfs/ctree.h       | 3 +--
 fs/btrfs/extent-tree.c | 6 +++---
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 1e24695ede0a..6e556031a8f3 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -343,7 +343,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
 			int level = btrfs_header_level(buf);
 
 			ret = btrfs_set_disk_extent_flags(trans, buf,
-							  new_flags, level, 0);
+							  new_flags, level);
 			if (ret)
 				return ret;
 		}
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 371f3f6c4ea4..6834d6913b3d 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2810,8 +2810,7 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 		  struct extent_buffer *buf, int full_backref);
 int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
-				struct extent_buffer *eb, u64 flags,
-				int level, int is_data);
+				struct extent_buffer *eb, u64 flags, int level);
 int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref);
 
 int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 963160a0c393..446a95053a7a 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2180,7 +2180,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
 
 int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
 				struct extent_buffer *eb, u64 flags,
-				int level, int is_data)
+				int level)
 {
 	struct btrfs_delayed_extent_op *extent_op;
 	int ret;
@@ -2192,7 +2192,7 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
 	extent_op->flags_to_set = flags;
 	extent_op->update_flags = true;
 	extent_op->update_key = false;
-	extent_op->is_data = is_data ? true : false;
+	extent_op->is_data = false;
 	extent_op->level = level;
 
 	ret = btrfs_add_delayed_extent_op(trans, eb->start, eb->len, extent_op);
@@ -5136,7 +5136,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
 		ret = btrfs_dec_ref(trans, root, eb, 0);
 		BUG_ON(ret); /* -ENOMEM */
 		ret = btrfs_set_disk_extent_flags(trans, eb, flag,
-						  btrfs_header_level(eb), 0);
+						  btrfs_header_level(eb));
 		BUG_ON(ret); /* -ENOMEM */
 		wc->flags[level] |= flag;
 	}
-- 
2.34.1


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

* [PATCH 2/9] btrfs: remove btrfs_delayed_extent_op::is_data
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
  2022-04-29 18:27 ` [PATCH 1/9] btrfs: sink parameter is_data to btrfs_set_disk_extent_flags David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-01 20:24   ` Johannes Thumshirn
  2022-04-29 18:27 ` [PATCH 3/9] btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio David Sterba
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The value of btrfs_delayed_extent_op::is_data is always false, we can
cascade the change and simplify code that depends on it, removing the
structure member eventually.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/delayed-ref.c | 4 +---
 fs/btrfs/delayed-ref.h | 1 -
 fs/btrfs/extent-tree.c | 6 ++----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 4176df149d04..99f37fca2e96 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -930,7 +930,6 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
 	is_system = (generic_ref->tree_ref.owning_root == BTRFS_CHUNK_TREE_OBJECTID);
 
 	ASSERT(generic_ref->type == BTRFS_REF_METADATA && generic_ref->action);
-	BUG_ON(extent_op && extent_op->is_data);
 	ref = kmem_cache_alloc(btrfs_delayed_tree_ref_cachep, GFP_NOFS);
 	if (!ref)
 		return -ENOMEM;
@@ -1103,8 +1102,7 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
 		return -ENOMEM;
 
 	init_delayed_ref_head(head_ref, NULL, bytenr, num_bytes, 0, 0,
-			      BTRFS_UPDATE_DELAYED_HEAD, extent_op->is_data,
-			      false);
+			      BTRFS_UPDATE_DELAYED_HEAD, false, false);
 	head_ref->extent_op = extent_op;
 
 	delayed_refs = &trans->transaction->delayed_refs;
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h
index 91a3aabad150..d6304b690ec4 100644
--- a/fs/btrfs/delayed-ref.h
+++ b/fs/btrfs/delayed-ref.h
@@ -58,7 +58,6 @@ struct btrfs_delayed_extent_op {
 	u8 level;
 	bool update_key;
 	bool update_flags;
-	bool is_data;
 	u64 flags_to_set;
 };
 
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 446a95053a7a..7cea22039608 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1577,12 +1577,12 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans,
 	u32 item_size;
 	int ret;
 	int err = 0;
-	int metadata = !extent_op->is_data;
+	int metadata = 1;
 
 	if (TRANS_ABORTED(trans))
 		return 0;
 
-	if (metadata && !btrfs_fs_incompat(fs_info, SKINNY_METADATA))
+	if (!btrfs_fs_incompat(fs_info, SKINNY_METADATA))
 		metadata = 0;
 
 	path = btrfs_alloc_path();
@@ -2192,7 +2192,6 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
 	extent_op->flags_to_set = flags;
 	extent_op->update_flags = true;
 	extent_op->update_key = false;
-	extent_op->is_data = false;
 	extent_op->level = level;
 
 	ret = btrfs_add_delayed_extent_op(trans, eb->start, eb->len, extent_op);
@@ -4951,7 +4950,6 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
 		extent_op->flags_to_set = flags;
 		extent_op->update_key = skinny_metadata ? false : true;
 		extent_op->update_flags = true;
-		extent_op->is_data = false;
 		extent_op->level = level;
 
 		btrfs_init_generic_ref(&generic_ref, BTRFS_ADD_DELAYED_EXTENT,
-- 
2.34.1


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

* [PATCH 3/9] btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
  2022-04-29 18:27 ` [PATCH 1/9] btrfs: sink parameter is_data to btrfs_set_disk_extent_flags David Sterba
  2022-04-29 18:27 ` [PATCH 2/9] btrfs: remove btrfs_delayed_extent_op::is_data David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-01 20:25   ` Johannes Thumshirn
  2022-04-29 18:27 ` [PATCH 4/9] btrfs: remove trivial helper update_nr_written David Sterba
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c | 5 ++---
 fs/btrfs/disk-io.h | 3 +--
 fs/btrfs/inode.c   | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 73e12ecc81be..b9e03da5f2cb 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -849,8 +849,7 @@ static void run_one_async_free(struct btrfs_work *work)
 }
 
 blk_status_t btrfs_wq_submit_bio(struct inode *inode, struct bio *bio,
-				 int mirror_num, unsigned long bio_flags,
-				 u64 dio_file_offset,
+				 int mirror_num, u64 dio_file_offset,
 				 extent_submit_bio_start_t *submit_bio_start)
 {
 	struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
@@ -943,7 +942,7 @@ void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_
 		 * checksumming can happen in parallel across all CPUs
 		 */
 		ret = btrfs_wq_submit_bio(inode, bio, mirror_num, 0,
-					  0, btree_submit_bio_start);
+					  btree_submit_bio_start);
 	}
 
 	if (ret) {
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 9340e3266e0a..4ee8c42c9f78 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -124,8 +124,7 @@ int btrfs_read_extent_buffer(struct extent_buffer *buf, u64 parent_transid,
 blk_status_t btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
 			enum btrfs_wq_endio_type metadata);
 blk_status_t btrfs_wq_submit_bio(struct inode *inode, struct bio *bio,
-				 int mirror_num, unsigned long bio_flags,
-				 u64 dio_file_offset,
+				 int mirror_num, u64 dio_file_offset,
 				 extent_submit_bio_start_t *submit_bio_start);
 blk_status_t btrfs_submit_bio_done(void *private_data, struct bio *bio,
 			  int mirror_num);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5b7df1c0ee5e..ac37e5088fc8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2624,7 +2624,7 @@ void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
 		if (btrfs_is_data_reloc_root(root))
 			goto mapit;
 		/* we're doing a write, do the async checksumming */
-		ret = btrfs_wq_submit_bio(inode, bio, mirror_num, bio_flags,
+		ret = btrfs_wq_submit_bio(inode, bio, mirror_num,
 					  0, btrfs_submit_bio_start);
 		goto out;
 	} else if (!skip_sum) {
@@ -7913,7 +7913,7 @@ static inline blk_status_t btrfs_submit_dio_bio(struct bio *bio,
 		goto map;
 
 	if (write && async_submit) {
-		ret = btrfs_wq_submit_bio(inode, bio, 0, 0, file_offset,
+		ret = btrfs_wq_submit_bio(inode, bio, 0, file_offset,
 					  btrfs_submit_bio_start_direct_io);
 		goto err;
 	} else if (write) {
-- 
2.34.1


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

* [PATCH 4/9] btrfs: remove trivial helper update_nr_written
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
                   ` (2 preceding siblings ...)
  2022-04-29 18:27 ` [PATCH 3/9] btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-01 20:25   ` Johannes Thumshirn
  2022-04-29 18:27 ` [PATCH 5/9] btrfs: simplify handling of bio_ctrl::bio_flags David Sterba
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The helper used to do more with the wbc state but now it's just one
subtraction, no need to have a special helper.

It became trivial in a91326679f2a ("Btrfs: make mapping->writeback_index
point to the last written page").

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index f9d6dd310c42..15d27cc21750 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3839,12 +3839,6 @@ static inline void contiguous_readpages(struct page *pages[], int nr_pages,
 	}
 }
 
-static void update_nr_written(struct writeback_control *wbc,
-			      unsigned long nr_written)
-{
-	wbc->nr_to_write -= nr_written;
-}
-
 /*
  * helper for __extent_writepage, doing all of the delayed allocation setup.
  *
@@ -4007,7 +4001,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
 	 * we don't want to touch the inode after unlocking the page,
 	 * so we update the mapping writeback index now
 	 */
-	update_nr_written(wbc, 1);
+	wbc->nr_to_write--;
 
 	while (cur <= end) {
 		u64 disk_bytenr;
@@ -4620,7 +4614,7 @@ static int write_one_subpage_eb(struct extent_buffer *eb,
 	 * dirty anymore, we have submitted a page.  Update nr_written in wbc.
 	 */
 	if (no_dirty_ebs)
-		update_nr_written(wbc, 1);
+		wbc->nr_to_write--;
 	return ret;
 }
 
@@ -4656,7 +4650,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
 			break;
 		}
 		disk_bytenr += PAGE_SIZE;
-		update_nr_written(wbc, 1);
+		wbc->nr_to_write--;
 		unlock_page(p);
 	}
 
-- 
2.34.1


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

* [PATCH 5/9] btrfs: simplify handling of bio_ctrl::bio_flags
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
                   ` (3 preceding siblings ...)
  2022-04-29 18:27 ` [PATCH 4/9] btrfs: remove trivial helper update_nr_written David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-01 20:26   ` Johannes Thumshirn
  2022-04-29 18:27 ` [PATCH 6/9] btrfs: open code extent_set_compress_type helpers David Sterba
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The bio_flags are used only to encode the compression and there are no
other EXTENT_BIO_* flags, so the compress type can be stored directly.
The struct member name is left unchanged and will be cleaned in later
patches.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 13 ++++++-------
 fs/btrfs/extent_io.h | 11 ++---------
 fs/btrfs/inode.c     |  2 +-
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 15d27cc21750..efea465d0e9b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -29,6 +29,7 @@
 #include "subpage.h"
 #include "zoned.h"
 #include "block-group.h"
+#include "compression.h"
 
 static struct kmem_cache *extent_state_cache;
 static struct kmem_cache *extent_buffer_cache;
@@ -2561,7 +2562,6 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inode
 	logical = em->block_start + logical;
 	if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
 		logical = em->block_start;
-		failrec->bio_flags = EXTENT_BIO_COMPRESSED;
 		extent_set_compress_type(&failrec->bio_flags, em->compress_type);
 	}
 
@@ -3273,7 +3273,7 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
 	if (bio_ctrl->bio_flags != bio_flags)
 		return 0;
 
-	if (bio_ctrl->bio_flags & EXTENT_BIO_COMPRESSED)
+	if (bio_ctrl->bio_flags != BTRFS_COMPRESS_NONE)
 		contig = bio->bi_iter.bi_sector == sector;
 	else
 		contig = bio_end_sector(bio) == sector;
@@ -3316,7 +3316,7 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
 	 * The split happens for real compressed bio, which happens in
 	 * btrfs_submit_compressed_read/write().
 	 */
-	if (bio_ctrl->bio_flags & EXTENT_BIO_COMPRESSED) {
+	if (bio_ctrl->bio_flags != BTRFS_COMPRESS_NONE) {
 		bio_ctrl->len_to_oe_boundary = U32_MAX;
 		bio_ctrl->len_to_stripe_boundary = U32_MAX;
 		return 0;
@@ -3370,7 +3370,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
 	 * For compressed page range, its disk_bytenr is always @disk_bytenr
 	 * passed in, no matter if we have added any range into previous bio.
 	 */
-	if (bio_flags & EXTENT_BIO_COMPRESSED)
+	if (bio_flags != BTRFS_COMPRESS_NONE)
 		bio->bi_iter.bi_sector = disk_bytenr >> SECTOR_SHIFT;
 	else
 		bio->bi_iter.bi_sector = (disk_bytenr + offset) >> SECTOR_SHIFT;
@@ -3476,7 +3476,7 @@ static int submit_extent_page(unsigned int opf,
 		 * We must go through btrfs_bio_add_page() to ensure each
 		 * page range won't cross various boundaries.
 		 */
-		if (bio_flags & EXTENT_BIO_COMPRESSED)
+		if (bio_flags != BTRFS_COMPRESS_NONE)
 			added = btrfs_bio_add_page(bio_ctrl, page, disk_bytenr,
 					size - offset, pg_offset + offset,
 					bio_flags);
@@ -3682,7 +3682,6 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 		BUG_ON(end < cur);
 
 		if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
-			this_bio_flag |= EXTENT_BIO_COMPRESSED;
 			extent_set_compress_type(&this_bio_flag,
 						 em->compress_type);
 		}
@@ -3690,7 +3689,7 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 		iosize = min(extent_map_end(em) - cur, end - cur + 1);
 		cur_end = min(extent_map_end(em) - 1, end);
 		iosize = ALIGN(iosize, blocksize);
-		if (this_bio_flag & EXTENT_BIO_COMPRESSED)
+		if (this_bio_flag != BTRFS_COMPRESS_NONE)
 			disk_bytenr = em->block_start;
 		else
 			disk_bytenr = em->block_start + extent_offset;
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index b390ec79f9a8..ba793cb7a3a2 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -9,13 +9,6 @@
 #include <linux/btrfs_tree.h>
 #include "ulist.h"
 
-/*
- * flags for bio submission. The high bits indicate the compression
- * type for this bio
- */
-#define EXTENT_BIO_COMPRESSED 1
-#define EXTENT_BIO_FLAG_SHIFT 16
-
 enum {
 	EXTENT_BUFFER_UPTODATE,
 	EXTENT_BUFFER_DIRTY,
@@ -150,12 +143,12 @@ static inline void extent_changeset_free(struct extent_changeset *changeset)
 static inline void extent_set_compress_type(unsigned long *bio_flags,
 					    int compress_type)
 {
-	*bio_flags |= compress_type << EXTENT_BIO_FLAG_SHIFT;
+	*bio_flags = compress_type;
 }
 
 static inline int extent_compress_type(unsigned long bio_flags)
 {
-	return bio_flags >> EXTENT_BIO_FLAG_SHIFT;
+	return bio_flags;
 }
 
 struct extent_map_tree;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ac37e5088fc8..e8db1e7d0ec6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2600,7 +2600,7 @@ void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
 		if (ret)
 			goto out;
 
-		if (bio_flags & EXTENT_BIO_COMPRESSED) {
+		if (bio_flags != BTRFS_COMPRESS_NONE) {
 			/*
 			 * btrfs_submit_compressed_read will handle completing
 			 * the bio if there were any errors, so just return
-- 
2.34.1


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

* [PATCH 6/9] btrfs: open code extent_set_compress_type helpers
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
                   ` (4 preceding siblings ...)
  2022-04-29 18:27 ` [PATCH 5/9] btrfs: simplify handling of bio_ctrl::bio_flags David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-01 20:27   ` Johannes Thumshirn
  2022-04-29 18:27 ` [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type David Sterba
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The helpers extent_set_compress_type and extent_compress_type have
become trivial after previous cleanups and can be removed.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c |  8 +++-----
 fs/btrfs/extent_io.h | 11 -----------
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index efea465d0e9b..3d5cc5769350 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2562,7 +2562,7 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inode
 	logical = em->block_start + logical;
 	if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
 		logical = em->block_start;
-		extent_set_compress_type(&failrec->bio_flags, em->compress_type);
+		failrec->bio_flags = em->compress_type;
 	}
 
 	btrfs_debug(fs_info,
@@ -3681,10 +3681,8 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 		BUG_ON(extent_map_end(em) <= cur);
 		BUG_ON(end < cur);
 
-		if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
-			extent_set_compress_type(&this_bio_flag,
-						 em->compress_type);
-		}
+		if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
+			this_bio_flag = em->compress_type;
 
 		iosize = min(extent_map_end(em) - cur, end - cur + 1);
 		cur_end = min(extent_map_end(em) - 1, end);
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index ba793cb7a3a2..fdbfe801dbe2 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -140,17 +140,6 @@ static inline void extent_changeset_free(struct extent_changeset *changeset)
 	kfree(changeset);
 }
 
-static inline void extent_set_compress_type(unsigned long *bio_flags,
-					    int compress_type)
-{
-	*bio_flags = compress_type;
-}
-
-static inline int extent_compress_type(unsigned long bio_flags)
-{
-	return bio_flags;
-}
-
 struct extent_map_tree;
 
 typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode,
-- 
2.34.1


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

* [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
                   ` (5 preceding siblings ...)
  2022-04-29 18:27 ` [PATCH 6/9] btrfs: open code extent_set_compress_type helpers David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-01 20:22   ` Johannes Thumshirn
  2022-04-29 18:27 ` [PATCH 8/9] btrfs: rename bio_flags in parameters and switch type David Sterba
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The bio_flags is now used to store unchanged compress type, so unify
that.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 6 +++---
 fs/btrfs/extent_io.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 3d5cc5769350..ca3d4a6a3b10 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2538,7 +2538,7 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inode
 	failrec->start = start;
 	failrec->len = sectorsize;
 	failrec->this_mirror = 0;
-	failrec->bio_flags = 0;
+	failrec->compress_type = BTRFS_COMPRESS_NONE;
 
 	read_lock(&em_tree->lock);
 	em = lookup_extent_mapping(em_tree, start, failrec->len);
@@ -2562,7 +2562,7 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inode
 	logical = em->block_start + logical;
 	if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
 		logical = em->block_start;
-		failrec->bio_flags = em->compress_type;
+		failrec->compress_type = em->compress_type;
 	}
 
 	btrfs_debug(fs_info,
@@ -2694,7 +2694,7 @@ int btrfs_repair_one_sector(struct inode *inode,
 	 * will be handled by the endio on the repair_bio, so we can't return an
 	 * error here.
 	 */
-	submit_bio_hook(inode, repair_bio, failrec->this_mirror, failrec->bio_flags);
+	submit_bio_hook(inode, repair_bio, failrec->this_mirror, failrec->compress_type);
 	return BLK_STS_OK;
 }
 
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index fdbfe801dbe2..1fa40ab561df 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -266,7 +266,7 @@ struct io_failure_record {
 	u64 start;
 	u64 len;
 	u64 logical;
-	unsigned long bio_flags;
+	unsigned int compress_type;
 	int this_mirror;
 	int failed_mirror;
 };
-- 
2.34.1


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

* [PATCH 8/9] btrfs: rename bio_flags in parameters and switch type
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
                   ` (6 preceding siblings ...)
  2022-04-29 18:27 ` [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-04-29 18:27 ` [PATCH 9/9] btrfs: rename bio_ctrl::bio_flags to compress_type David Sterba
  2022-05-03  7:57 ` [PATCH 0/9] Structre and parameter cleanups Nikolay Borisov
  9 siblings, 0 replies; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Several functions take parameter bio_flags that was simplified to just
compress type, unify it and change the type accordingly.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.h     |  2 +-
 fs/btrfs/extent_io.c | 28 ++++++++++++++--------------
 fs/btrfs/extent_io.h |  2 +-
 fs/btrfs/inode.c     |  6 +++---
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6834d6913b3d..2811c8df93f4 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3252,7 +3252,7 @@ u64 btrfs_file_extent_end(const struct btrfs_path *path);
 
 /* inode.c */
 void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
-			   int mirror_num, unsigned long bio_flags);
+			   int mirror_num, unsigned int compress_type);
 unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,
 				    u32 bio_offset, struct page *page,
 				    u64 start, u64 end);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index ca3d4a6a3b10..d757ccd8f6cc 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -178,7 +178,7 @@ static int add_extent_changeset(struct extent_state *state, u32 bits,
 	return ret;
 }
 
-static void submit_one_bio(struct bio *bio, int mirror_num, unsigned long bio_flags)
+static void submit_one_bio(struct bio *bio, int mirror_num, unsigned int compress_type)
 {
 	struct extent_io_tree *tree = bio->bi_private;
 
@@ -189,7 +189,7 @@ static void submit_one_bio(struct bio *bio, int mirror_num, unsigned long bio_fl
 
 	if (is_data_inode(tree->private_data))
 		btrfs_submit_data_bio(tree->private_data, bio, mirror_num,
-					    bio_flags);
+					    compress_type);
 	else
 		btrfs_submit_metadata_bio(tree->private_data, bio, mirror_num);
 	/*
@@ -3246,7 +3246,7 @@ struct bio *btrfs_bio_clone_partial(struct bio *orig, u64 offset, u64 size)
  *                a contiguous page to the previous one
  * @size:	portion of page that we want to write
  * @pg_offset:	starting offset in the page
- * @bio_flags:	flags of the current bio to see if we can merge them
+ * @compress_type:   compression type of the current bio to see if we can merge them
  *
  * Attempt to add a page to bio considering stripe alignment etc.
  *
@@ -3258,7 +3258,7 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
 			      struct page *page,
 			      u64 disk_bytenr, unsigned int size,
 			      unsigned int pg_offset,
-			      unsigned long bio_flags)
+			      unsigned int compress_type)
 {
 	struct bio *bio = bio_ctrl->bio;
 	u32 bio_size = bio->bi_iter.bi_size;
@@ -3270,7 +3270,7 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
 	ASSERT(bio);
 	/* The limit should be calculated when bio_ctrl->bio is allocated */
 	ASSERT(bio_ctrl->len_to_oe_boundary && bio_ctrl->len_to_stripe_boundary);
-	if (bio_ctrl->bio_flags != bio_flags)
+	if (bio_ctrl->bio_flags != compress_type)
 		return 0;
 
 	if (bio_ctrl->bio_flags != BTRFS_COMPRESS_NONE)
@@ -3359,7 +3359,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
 			 unsigned int opf,
 			 bio_end_io_t end_io_func,
 			 u64 disk_bytenr, u32 offset, u64 file_offset,
-			 unsigned long bio_flags)
+			 unsigned long compress_type)
 {
 	struct btrfs_fs_info *fs_info = inode->root->fs_info;
 	struct bio *bio;
@@ -3370,12 +3370,12 @@ static int alloc_new_bio(struct btrfs_inode *inode,
 	 * For compressed page range, its disk_bytenr is always @disk_bytenr
 	 * passed in, no matter if we have added any range into previous bio.
 	 */
-	if (bio_flags != BTRFS_COMPRESS_NONE)
+	if (compress_type != BTRFS_COMPRESS_NONE)
 		bio->bi_iter.bi_sector = disk_bytenr >> SECTOR_SHIFT;
 	else
 		bio->bi_iter.bi_sector = (disk_bytenr + offset) >> SECTOR_SHIFT;
 	bio_ctrl->bio = bio;
-	bio_ctrl->bio_flags = bio_flags;
+	bio_ctrl->bio_flags = compress_type;
 	bio->bi_end_io = end_io_func;
 	bio->bi_private = &inode->io_tree;
 	bio->bi_opf = opf;
@@ -3434,7 +3434,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
  * @end_io_func:     end_io callback for new bio
  * @mirror_num:	     desired mirror to read/write
  * @prev_bio_flags:  flags of previous bio to see if we can merge the current one
- * @bio_flags:	flags of the current bio to see if we can merge them
+ * @compress_type:   compress type for current bio
  */
 static int submit_extent_page(unsigned int opf,
 			      struct writeback_control *wbc,
@@ -3443,7 +3443,7 @@ static int submit_extent_page(unsigned int opf,
 			      size_t size, unsigned long pg_offset,
 			      bio_end_io_t end_io_func,
 			      int mirror_num,
-			      unsigned long bio_flags,
+			      unsigned int compress_type,
 			      bool force_bio_submit)
 {
 	int ret = 0;
@@ -3468,7 +3468,7 @@ static int submit_extent_page(unsigned int opf,
 			ret = alloc_new_bio(inode, bio_ctrl, wbc, opf,
 					    end_io_func, disk_bytenr, offset,
 					    page_offset(page) + cur,
-					    bio_flags);
+					    compress_type);
 			if (ret < 0)
 				return ret;
 		}
@@ -3476,14 +3476,14 @@ static int submit_extent_page(unsigned int opf,
 		 * We must go through btrfs_bio_add_page() to ensure each
 		 * page range won't cross various boundaries.
 		 */
-		if (bio_flags != BTRFS_COMPRESS_NONE)
+		if (compress_type != BTRFS_COMPRESS_NONE)
 			added = btrfs_bio_add_page(bio_ctrl, page, disk_bytenr,
 					size - offset, pg_offset + offset,
-					bio_flags);
+					compress_type);
 		else
 			added = btrfs_bio_add_page(bio_ctrl, page,
 					disk_bytenr + offset, size - offset,
-					pg_offset + offset, bio_flags);
+					pg_offset + offset, compress_type);
 
 		/* Metadata page range should never be split */
 		if (!is_data_inode(&inode->vfs_inode))
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 1fa40ab561df..a33bd6140820 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -66,7 +66,7 @@ struct extent_io_tree;
 
 typedef void (submit_bio_hook_t)(struct inode *inode, struct bio *bio,
 					 int mirror_num,
-					 unsigned long bio_flags);
+					 unsigned int compress_type);
 
 typedef blk_status_t (extent_submit_bio_start_t)(struct inode *inode,
 		struct bio *bio, u64 dio_file_offset);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e8db1e7d0ec6..7ebb172ff7ab 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2571,7 +2571,7 @@ static blk_status_t extract_ordered_extent(struct btrfs_inode *inode,
  *    c-3) otherwise:			async submit
  */
 void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
-			   int mirror_num, unsigned long bio_flags)
+			   int mirror_num, unsigned int compress_type)
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
 	struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -2600,7 +2600,7 @@ void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
 		if (ret)
 			goto out;
 
-		if (bio_flags != BTRFS_COMPRESS_NONE) {
+		if (compress_type != BTRFS_COMPRESS_NONE) {
 			/*
 			 * btrfs_submit_compressed_read will handle completing
 			 * the bio if there were any errors, so just return
@@ -7786,7 +7786,7 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)
 }
 
 static void submit_dio_repair_bio(struct inode *inode, struct bio *bio,
-				  int mirror_num, unsigned long bio_flags)
+				  int mirror_num, unsigned int compress_type)
 {
 	struct btrfs_dio_private *dip = bio->bi_private;
 	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-- 
2.34.1


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

* [PATCH 9/9] btrfs: rename bio_ctrl::bio_flags to compress_type
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
                   ` (7 preceding siblings ...)
  2022-04-29 18:27 ` [PATCH 8/9] btrfs: rename bio_flags in parameters and switch type David Sterba
@ 2022-04-29 18:27 ` David Sterba
  2022-05-03  7:57 ` [PATCH 0/9] Structre and parameter cleanups Nikolay Borisov
  9 siblings, 0 replies; 22+ messages in thread
From: David Sterba @ 2022-04-29 18:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The bio_ctrl is the last use of bio_flags that has been converted to
compress type everywhere else.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index d757ccd8f6cc..95093b0f09b0 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -144,7 +144,7 @@ struct tree_entry {
  */
 struct btrfs_bio_ctrl {
 	struct bio *bio;
-	unsigned long bio_flags;
+	unsigned int compress_type;
 	u32 len_to_stripe_boundary;
 	u32 len_to_oe_boundary;
 };
@@ -3270,10 +3270,10 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
 	ASSERT(bio);
 	/* The limit should be calculated when bio_ctrl->bio is allocated */
 	ASSERT(bio_ctrl->len_to_oe_boundary && bio_ctrl->len_to_stripe_boundary);
-	if (bio_ctrl->bio_flags != compress_type)
+	if (bio_ctrl->compress_type != compress_type)
 		return 0;
 
-	if (bio_ctrl->bio_flags != BTRFS_COMPRESS_NONE)
+	if (bio_ctrl->compress_type != BTRFS_COMPRESS_NONE)
 		contig = bio->bi_iter.bi_sector == sector;
 	else
 		contig = bio_end_sector(bio) == sector;
@@ -3316,7 +3316,7 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
 	 * The split happens for real compressed bio, which happens in
 	 * btrfs_submit_compressed_read/write().
 	 */
-	if (bio_ctrl->bio_flags != BTRFS_COMPRESS_NONE) {
+	if (bio_ctrl->compress_type != BTRFS_COMPRESS_NONE) {
 		bio_ctrl->len_to_oe_boundary = U32_MAX;
 		bio_ctrl->len_to_stripe_boundary = U32_MAX;
 		return 0;
@@ -3375,7 +3375,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
 	else
 		bio->bi_iter.bi_sector = (disk_bytenr + offset) >> SECTOR_SHIFT;
 	bio_ctrl->bio = bio;
-	bio_ctrl->bio_flags = compress_type;
+	bio_ctrl->compress_type = compress_type;
 	bio->bi_end_io = end_io_func;
 	bio->bi_private = &inode->io_tree;
 	bio->bi_opf = opf;
@@ -3455,7 +3455,7 @@ static int submit_extent_page(unsigned int opf,
 	ASSERT(pg_offset < PAGE_SIZE && size <= PAGE_SIZE &&
 	       pg_offset + size <= PAGE_SIZE);
 	if (force_bio_submit && bio_ctrl->bio) {
-		submit_one_bio(bio_ctrl->bio, mirror_num, bio_ctrl->bio_flags);
+		submit_one_bio(bio_ctrl->bio, mirror_num, bio_ctrl->compress_type);
 		bio_ctrl->bio = NULL;
 	}
 
@@ -3497,7 +3497,7 @@ static int submit_extent_page(unsigned int opf,
 		if (added < size - offset) {
 			/* The bio should contain some page(s) */
 			ASSERT(bio_ctrl->bio->bi_iter.bi_size);
-			submit_one_bio(bio_ctrl->bio, mirror_num, bio_ctrl->bio_flags);
+			submit_one_bio(bio_ctrl->bio, mirror_num, bio_ctrl->compress_type);
 			bio_ctrl->bio = NULL;
 		}
 		cur += added;
@@ -3814,7 +3814,7 @@ int btrfs_readpage(struct file *file, struct page *page)
 	 * bio to do the cleanup.
 	 */
 	if (bio_ctrl.bio)
-		submit_one_bio(bio_ctrl.bio, 0, bio_ctrl.bio_flags);
+		submit_one_bio(bio_ctrl.bio, 0, bio_ctrl.compress_type);
 	return ret;
 }
 
@@ -5273,7 +5273,7 @@ void extent_readahead(struct readahead_control *rac)
 		free_extent_map(em_cached);
 
 	if (bio_ctrl.bio)
-		submit_one_bio(bio_ctrl.bio, 0, bio_ctrl.bio_flags);
+		submit_one_bio(bio_ctrl.bio, 0, bio_ctrl.compress_type);
 }
 
 /*
@@ -6760,7 +6760,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num)
 	}
 
 	if (bio_ctrl.bio) {
-		submit_one_bio(bio_ctrl.bio, mirror_num, bio_ctrl.bio_flags);
+		submit_one_bio(bio_ctrl.bio, mirror_num, bio_ctrl.compress_type);
 		bio_ctrl.bio = NULL;
 	}
 
-- 
2.34.1


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

* Re: [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type
  2022-04-29 18:27 ` [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type David Sterba
@ 2022-05-01 20:22   ` Johannes Thumshirn
  2022-05-02 15:16     ` David Sterba
  0 siblings, 1 reply; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-01 20:22 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

On 29/04/2022 11:32, David Sterba wrote:
> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> index fdbfe801dbe2..1fa40ab561df 100644
> --- a/fs/btrfs/extent_io.h
> +++ b/fs/btrfs/extent_io.h
> @@ -266,7 +266,7 @@ struct io_failure_record {
>  	u64 start;
>  	u64 len;
>  	u64 logical;
> -	unsigned long bio_flags;
> +	unsigned int compress_type;
>  	int this_mirror;
>  	int failed_mirror;
>  };


Why 'unsigned int' and not 'enum btrfs_compression_type'?

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

* Re: [PATCH 1/9] btrfs: sink parameter is_data to btrfs_set_disk_extent_flags
  2022-04-29 18:27 ` [PATCH 1/9] btrfs: sink parameter is_data to btrfs_set_disk_extent_flags David Sterba
@ 2022-05-01 20:24   ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-01 20:24 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 2/9] btrfs: remove btrfs_delayed_extent_op::is_data
  2022-04-29 18:27 ` [PATCH 2/9] btrfs: remove btrfs_delayed_extent_op::is_data David Sterba
@ 2022-05-01 20:24   ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-01 20:24 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 3/9] btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio
  2022-04-29 18:27 ` [PATCH 3/9] btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio David Sterba
@ 2022-05-01 20:25   ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-01 20:25 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 4/9] btrfs: remove trivial helper update_nr_written
  2022-04-29 18:27 ` [PATCH 4/9] btrfs: remove trivial helper update_nr_written David Sterba
@ 2022-05-01 20:25   ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-01 20:25 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 5/9] btrfs: simplify handling of bio_ctrl::bio_flags
  2022-04-29 18:27 ` [PATCH 5/9] btrfs: simplify handling of bio_ctrl::bio_flags David Sterba
@ 2022-05-01 20:26   ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-01 20:26 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 6/9] btrfs: open code extent_set_compress_type helpers
  2022-04-29 18:27 ` [PATCH 6/9] btrfs: open code extent_set_compress_type helpers David Sterba
@ 2022-05-01 20:27   ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-01 20:27 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type
  2022-05-01 20:22   ` Johannes Thumshirn
@ 2022-05-02 15:16     ` David Sterba
  2022-05-02 16:26       ` David Sterba
  0 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-05-02 15:16 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs

On Sun, May 01, 2022 at 08:22:41PM +0000, Johannes Thumshirn wrote:
> On 29/04/2022 11:32, David Sterba wrote:
> > diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> > index fdbfe801dbe2..1fa40ab561df 100644
> > --- a/fs/btrfs/extent_io.h
> > +++ b/fs/btrfs/extent_io.h
> > @@ -266,7 +266,7 @@ struct io_failure_record {
> >  	u64 start;
> >  	u64 len;
> >  	u64 logical;
> > -	unsigned long bio_flags;
> > +	unsigned int compress_type;
> >  	int this_mirror;
> >  	int failed_mirror;
> >  };
> 
> 
> Why 'unsigned int' and not 'enum btrfs_compression_type'?

Good point I'll change it, though it's not used almost anywhere else.

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

* Re: [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type
  2022-05-02 15:16     ` David Sterba
@ 2022-05-02 16:26       ` David Sterba
  2022-05-02 16:31         ` Johannes Thumshirn
  0 siblings, 1 reply; 22+ messages in thread
From: David Sterba @ 2022-05-02 16:26 UTC (permalink / raw)
  To: dsterba, Johannes Thumshirn, David Sterba, linux-btrfs

On Mon, May 02, 2022 at 05:16:59PM +0200, David Sterba wrote:
> On Sun, May 01, 2022 at 08:22:41PM +0000, Johannes Thumshirn wrote:
> > On 29/04/2022 11:32, David Sterba wrote:
> > > diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> > > index fdbfe801dbe2..1fa40ab561df 100644
> > > --- a/fs/btrfs/extent_io.h
> > > +++ b/fs/btrfs/extent_io.h
> > > @@ -266,7 +266,7 @@ struct io_failure_record {
> > >  	u64 start;
> > >  	u64 len;
> > >  	u64 logical;
> > > -	unsigned long bio_flags;
> > > +	unsigned int compress_type;
> > >  	int this_mirror;
> > >  	int failed_mirror;
> > >  };
> > 
> > 
> > Why 'unsigned int' and not 'enum btrfs_compression_type'?
> 
> Good point I'll change it, though it's not used almost anywhere else.

I'll fix up the 2 following patches as well, the type switch in parameters.

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

* Re: [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type
  2022-05-02 16:26       ` David Sterba
@ 2022-05-02 16:31         ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2022-05-02 16:31 UTC (permalink / raw)
  To: dsterba, David Sterba, linux-btrfs

On 02/05/2022 09:30, David Sterba wrote:
> On Mon, May 02, 2022 at 05:16:59PM +0200, David Sterba wrote:
>> On Sun, May 01, 2022 at 08:22:41PM +0000, Johannes Thumshirn wrote:
>>> On 29/04/2022 11:32, David Sterba wrote:
>>>> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
>>>> index fdbfe801dbe2..1fa40ab561df 100644
>>>> --- a/fs/btrfs/extent_io.h
>>>> +++ b/fs/btrfs/extent_io.h
>>>> @@ -266,7 +266,7 @@ struct io_failure_record {
>>>>  	u64 start;
>>>>  	u64 len;
>>>>  	u64 logical;
>>>> -	unsigned long bio_flags;
>>>> +	unsigned int compress_type;
>>>>  	int this_mirror;
>>>>  	int failed_mirror;
>>>>  };
>>>
>>>
>>> Why 'unsigned int' and not 'enum btrfs_compression_type'?
>>
>> Good point I'll change it, though it's not used almost anywhere else.
> 
> I'll fix up the 2 following patches as well, the type switch in parameters.
> 

Cool thanks, I was about to ask.

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

* Re: [PATCH 0/9] Structre and parameter cleanups
  2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
                   ` (8 preceding siblings ...)
  2022-04-29 18:27 ` [PATCH 9/9] btrfs: rename bio_ctrl::bio_flags to compress_type David Sterba
@ 2022-05-03  7:57 ` Nikolay Borisov
  2022-05-09 19:56   ` David Sterba
  9 siblings, 1 reply; 22+ messages in thread
From: Nikolay Borisov @ 2022-05-03  7:57 UTC (permalink / raw)
  To: David Sterba, linux-btrfs



On 29.04.22 г. 21:27 ч., David Sterba wrote:
> Simplify some argument passing, remove too-trivial helpers or unused
> structure members.
> 
> David Sterba (9):
>    btrfs: sink parameter is_data to btrfs_set_disk_extent_flags
>    btrfs: remove btrfs_delayed_extent_op::is_data
>    btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio
>    btrfs: remove trivial helper update_nr_written
>    btrfs: simplify handling of bio_ctrl::bio_flags
>    btrfs: open code extent_set_compress_type helpers
>    btrfs: rename io_failure_record::bio_flags to compress_type
>    btrfs: rename bio_flags in parameters and switch type
>    btrfs: rename bio_ctrl::bio_flags to compress_type
> 
>   fs/btrfs/ctree.c       |  2 +-
>   fs/btrfs/ctree.h       |  5 ++-
>   fs/btrfs/delayed-ref.c |  4 +--
>   fs/btrfs/delayed-ref.h |  1 -
>   fs/btrfs/disk-io.c     |  5 ++-
>   fs/btrfs/disk-io.h     |  3 +-
>   fs/btrfs/extent-tree.c | 10 +++---
>   fs/btrfs/extent_io.c   | 73 ++++++++++++++++++------------------------
>   fs/btrfs/extent_io.h   | 22 ++-----------
>   fs/btrfs/inode.c       | 10 +++---
>   10 files changed, 50 insertions(+), 85 deletions(-)
> 


FWIW:

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

(I did look at the patches that have been merged into misc-next with the 
compression type fixed up) .

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

* Re: [PATCH 0/9] Structre and parameter cleanups
  2022-05-03  7:57 ` [PATCH 0/9] Structre and parameter cleanups Nikolay Borisov
@ 2022-05-09 19:56   ` David Sterba
  0 siblings, 0 replies; 22+ messages in thread
From: David Sterba @ 2022-05-09 19:56 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: David Sterba, linux-btrfs

On Tue, May 03, 2022 at 10:57:19AM +0300, Nikolay Borisov wrote:
> 
> 
> On 29.04.22 г. 21:27 ч., David Sterba wrote:
> > Simplify some argument passing, remove too-trivial helpers or unused
> > structure members.
> > 
> > David Sterba (9):
> >    btrfs: sink parameter is_data to btrfs_set_disk_extent_flags
> >    btrfs: remove btrfs_delayed_extent_op::is_data
> >    btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio
> >    btrfs: remove trivial helper update_nr_written
> >    btrfs: simplify handling of bio_ctrl::bio_flags
> >    btrfs: open code extent_set_compress_type helpers
> >    btrfs: rename io_failure_record::bio_flags to compress_type
> >    btrfs: rename bio_flags in parameters and switch type
> >    btrfs: rename bio_ctrl::bio_flags to compress_type
> > 
> >   fs/btrfs/ctree.c       |  2 +-
> >   fs/btrfs/ctree.h       |  5 ++-
> >   fs/btrfs/delayed-ref.c |  4 +--
> >   fs/btrfs/delayed-ref.h |  1 -
> >   fs/btrfs/disk-io.c     |  5 ++-
> >   fs/btrfs/disk-io.h     |  3 +-
> >   fs/btrfs/extent-tree.c | 10 +++---
> >   fs/btrfs/extent_io.c   | 73 ++++++++++++++++++------------------------
> >   fs/btrfs/extent_io.h   | 22 ++-----------
> >   fs/btrfs/inode.c       | 10 +++---
> >   10 files changed, 50 insertions(+), 85 deletions(-)
> > 
> 
> 
> FWIW:
> 
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> 
> (I did look at the patches that have been merged into misc-next with the 
> compression type fixed up) .

Thanks, commits updated.

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

end of thread, other threads:[~2022-05-09 20:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 18:27 [PATCH 0/9] Structre and parameter cleanups David Sterba
2022-04-29 18:27 ` [PATCH 1/9] btrfs: sink parameter is_data to btrfs_set_disk_extent_flags David Sterba
2022-05-01 20:24   ` Johannes Thumshirn
2022-04-29 18:27 ` [PATCH 2/9] btrfs: remove btrfs_delayed_extent_op::is_data David Sterba
2022-05-01 20:24   ` Johannes Thumshirn
2022-04-29 18:27 ` [PATCH 3/9] btrfs: remove unused parameter bio_flags from btrfs_wq_submit_bio David Sterba
2022-05-01 20:25   ` Johannes Thumshirn
2022-04-29 18:27 ` [PATCH 4/9] btrfs: remove trivial helper update_nr_written David Sterba
2022-05-01 20:25   ` Johannes Thumshirn
2022-04-29 18:27 ` [PATCH 5/9] btrfs: simplify handling of bio_ctrl::bio_flags David Sterba
2022-05-01 20:26   ` Johannes Thumshirn
2022-04-29 18:27 ` [PATCH 6/9] btrfs: open code extent_set_compress_type helpers David Sterba
2022-05-01 20:27   ` Johannes Thumshirn
2022-04-29 18:27 ` [PATCH 7/9] btrfs: rename io_failure_record::bio_flags to compress_type David Sterba
2022-05-01 20:22   ` Johannes Thumshirn
2022-05-02 15:16     ` David Sterba
2022-05-02 16:26       ` David Sterba
2022-05-02 16:31         ` Johannes Thumshirn
2022-04-29 18:27 ` [PATCH 8/9] btrfs: rename bio_flags in parameters and switch type David Sterba
2022-04-29 18:27 ` [PATCH 9/9] btrfs: rename bio_ctrl::bio_flags to compress_type David Sterba
2022-05-03  7:57 ` [PATCH 0/9] Structre and parameter cleanups Nikolay Borisov
2022-05-09 19:56   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.