All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Bart Van Assche <bvanassche@acm.org>,
	David Sterba <dsterba@suse.com>,
	Josef Bacik <josef@toxicpanda.com>
Subject: [PATCH v3 50/63] fs/btrfs: Use the enum req_op and blk_opf_t types
Date: Thu, 14 Jul 2022 11:07:16 -0700	[thread overview]
Message-ID: <20220714180729.1065367-51-bvanassche@acm.org> (raw)
In-Reply-To: <20220714180729.1065367-1-bvanassche@acm.org>

Improve static type checking by using the enum req_op type for variables
that represent a request operation and the new blk_opf_t type for
variables that represent request flags.

Acked-by: David Sterba <dsterba@suse.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 fs/btrfs/check-integrity.c |  4 ++--
 fs/btrfs/compression.c     |  6 +++---
 fs/btrfs/compression.h     |  2 +-
 fs/btrfs/extent_io.c       | 18 +++++++++---------
 fs/btrfs/inode.c           |  4 ++--
 fs/btrfs/raid56.c          |  4 ++--
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 5d20137b7b67..98c6e5feab19 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -152,7 +152,7 @@ struct btrfsic_block {
 	struct btrfsic_block *next_in_same_bio;
 	void *orig_bio_private;
 	bio_end_io_t *orig_bio_end_io;
-	int submit_bio_bh_rw;
+	blk_opf_t submit_bio_bh_rw;
 	u64 flush_gen; /* only valid if !never_written */
 };
 
@@ -1681,7 +1681,7 @@ static void btrfsic_process_written_block(struct btrfsic_dev_state *dev_state,
 					  u64 dev_bytenr, char **mapped_datav,
 					  unsigned int num_pages,
 					  struct bio *bio, int *bio_is_patched,
-					  int submit_bio_bh_rw)
+					  blk_opf_t submit_bio_bh_rw)
 {
 	int is_metadata;
 	struct btrfsic_block *block;
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index f4564f32f6d9..a82b9f17f476 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -455,7 +455,7 @@ static blk_status_t submit_compressed_bio(struct btrfs_fs_info *fs_info,
 
 
 static struct bio *alloc_compressed_bio(struct compressed_bio *cb, u64 disk_bytenr,
-					unsigned int opf, bio_end_io_t endio_func,
+					blk_opf_t opf, bio_end_io_t endio_func,
 					u64 *next_stripe_start)
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(cb->inode->i_sb);
@@ -505,7 +505,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
 				 unsigned int compressed_len,
 				 struct page **compressed_pages,
 				 unsigned int nr_pages,
-				 unsigned int write_flags,
+				 blk_opf_t write_flags,
 				 struct cgroup_subsys_state *blkcg_css,
 				 bool writeback)
 {
@@ -517,7 +517,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
 	blk_status_t ret;
 	int skip_sum = inode->flags & BTRFS_INODE_NODATASUM;
 	const bool use_append = btrfs_use_zone_append(inode, disk_start);
-	const unsigned int bio_op = use_append ? REQ_OP_ZONE_APPEND : REQ_OP_WRITE;
+	const enum req_op bio_op = use_append ? REQ_OP_ZONE_APPEND : REQ_OP_WRITE;
 
 	ASSERT(IS_ALIGNED(start, fs_info->sectorsize) &&
 	       IS_ALIGNED(len, fs_info->sectorsize));
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index 2707404389a5..2b56d63e01ce 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -99,7 +99,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
 				  unsigned int compressed_len,
 				  struct page **compressed_pages,
 				  unsigned int nr_pages,
-				  unsigned int write_flags,
+				  blk_opf_t write_flags,
 				  struct cgroup_subsys_state *blkcg_css,
 				  bool writeback);
 void btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 04e36343da3a..60a20df353e7 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3357,7 +3357,7 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
 static int alloc_new_bio(struct btrfs_inode *inode,
 			 struct btrfs_bio_ctrl *bio_ctrl,
 			 struct writeback_control *wbc,
-			 unsigned int opf,
+			 blk_opf_t opf,
 			 bio_end_io_t end_io_func,
 			 u64 disk_bytenr, u32 offset, u64 file_offset,
 			 enum btrfs_compression_type compress_type)
@@ -3437,7 +3437,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
  * @prev_bio_flags:  flags of previous bio to see if we can merge the current one
  * @compress_type:   compress type for current bio
  */
-static int submit_extent_page(unsigned int opf,
+static int submit_extent_page(blk_opf_t opf,
 			      struct writeback_control *wbc,
 			      struct btrfs_bio_ctrl *bio_ctrl,
 			      struct page *page, u64 disk_bytenr,
@@ -3615,7 +3615,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset,
  */
 static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 		      struct btrfs_bio_ctrl *bio_ctrl,
-		      unsigned int read_flags, u64 *prev_em_start)
+		      blk_opf_t read_flags, u64 *prev_em_start)
 {
 	struct inode *inode = page->mapping->host;
 	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -3983,8 +3983,8 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
 	int saved_ret = 0;
 	int ret = 0;
 	int nr = 0;
-	u32 opf = REQ_OP_WRITE;
-	const unsigned int write_flags = wbc_to_write_flags(wbc);
+	enum req_op op = REQ_OP_WRITE;
+	const blk_opf_t write_flags = wbc_to_write_flags(wbc);
 	bool has_error = false;
 	bool compressed;
 
@@ -4058,7 +4058,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
 		iosize = min(min(em_end, end + 1), dirty_range_end) - cur;
 
 		if (btrfs_use_zone_append(inode, em->block_start))
-			opf = REQ_OP_ZONE_APPEND;
+			op = REQ_OP_ZONE_APPEND;
 
 		free_extent_map(em);
 		em = NULL;
@@ -4094,7 +4094,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
 		 */
 		btrfs_page_clear_dirty(fs_info, page, cur, iosize);
 
-		ret = submit_extent_page(opf | write_flags, wbc,
+		ret = submit_extent_page(op | write_flags, wbc,
 					 &epd->bio_ctrl, page,
 					 disk_bytenr, iosize,
 					 cur - page_offset(page),
@@ -4575,7 +4575,7 @@ static int write_one_subpage_eb(struct extent_buffer *eb,
 {
 	struct btrfs_fs_info *fs_info = eb->fs_info;
 	struct page *page = eb->pages[0];
-	unsigned int write_flags = wbc_to_write_flags(wbc) | REQ_META;
+	blk_opf_t write_flags = wbc_to_write_flags(wbc) | REQ_META;
 	bool no_dirty_ebs = false;
 	int ret;
 
@@ -4620,7 +4620,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
 {
 	u64 disk_bytenr = eb->start;
 	int i, num_pages;
-	unsigned int write_flags = wbc_to_write_flags(wbc) | REQ_META;
+	blk_opf_t write_flags = wbc_to_write_flags(wbc) | REQ_META;
 	int ret = 0;
 
 	prepare_eb_write(eb);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 05e0c4a5affd..f8378c949be4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -485,7 +485,7 @@ struct async_chunk {
 	struct page *locked_page;
 	u64 start;
 	u64 end;
-	unsigned int write_flags;
+	blk_opf_t write_flags;
 	struct list_head extents;
 	struct cgroup_subsys_state *blkcg_css;
 	struct btrfs_work work;
@@ -1435,7 +1435,7 @@ static int cow_file_range_async(struct btrfs_inode *inode,
 	int i;
 	bool should_compress;
 	unsigned nofs_flag;
-	const unsigned int write_flags = wbc_to_write_flags(wbc);
+	const blk_opf_t write_flags = wbc_to_write_flags(wbc);
 
 	unlock_extent(&inode->io_tree, start, end);
 
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index a5b623ee6fac..c520412d1f86 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1136,7 +1136,7 @@ static int rbio_add_io_sector(struct btrfs_raid_bio *rbio,
 			      unsigned int stripe_nr,
 			      unsigned int sector_nr,
 			      unsigned long bio_max_len,
-			      unsigned int opf)
+			      enum req_op op)
 {
 	const u32 sectorsize = rbio->bioc->fs_info->sectorsize;
 	struct bio *last = bio_list->tail;
@@ -1181,7 +1181,7 @@ static int rbio_add_io_sector(struct btrfs_raid_bio *rbio,
 
 	/* put a new bio on the list */
 	bio = bio_alloc(stripe->dev->bdev, max(bio_max_len >> PAGE_SHIFT, 1UL),
-			opf, GFP_NOFS);
+			op, GFP_NOFS);
 	bio->bi_iter.bi_sector = disk_start >> 9;
 	bio->bi_private = rbio;
 

  parent reply	other threads:[~2022-07-14 18:09 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 18:06 [PATCH v3 00/63] Improve static type checking for request flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 01/63] treewide: Rename enum req_opf into enum req_op Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 02/63] block: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 03/63] block: Change the type of the last .rw_page() argument Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 04/63] block: Change the type of req_op() and bio_op() into enum req_op Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 05/63] block: Introduce the type blk_opf_t Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 06/63] block: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 07/63] block/bfq: " Bart Van Assche
2022-07-15  9:41   ` Jan Kara
2022-07-14 18:06 ` [PATCH v3 08/63] block/mq-deadline: " Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 09/63] block/kyber: " Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 10/63] blktrace: Trace remapped requests correctly Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 11/63] blktrace: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 12/63] block/brd: Use the enum req_op type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 13/63] block/drbd: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 14/63] block/drbd: Combine two drbd_submit_peer_request() arguments Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 15/63] block/floppy: Fix a sparse warning Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 16/63] block/rnbd: Use blk_opf_t where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 17/63] xen-blkback: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 18/63] block/zram: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 19/63] nvdimm-btt: Use the enum req_op type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 20/63] um: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 21/63] dm/core: Reduce the size of struct dm_io_request Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 22/63] dm/core: Rename kcopyd_job.rw into kcopyd.op Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 23/63] dm/core: Combine request operation type and flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 24/63] dm/ebs: Change 'int rw' into 'enum req_op op' Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 25/63] dm/dm-flakey: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 26/63] dm/dm-integrity: Combine request operation and flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 27/63] dm mirror log: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 28/63] dm-snap: Combine request operation type and flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 29/63] dm/zone: Use the enum req_op type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 30/63] dm/dm-zoned: " Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 31/63] md/core: Combine two sync_page_io() arguments Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 32/63] md/bcache: Combine two uuid_io() arguments Bart Van Assche
2022-07-19  4:46   ` Coly Li
2022-07-14 18:06 ` [PATCH v3 33/63] md/bcache: Combine two prio_io() arguments Bart Van Assche
2022-07-19  4:43   ` Coly Li
2022-07-14 18:07 ` [PATCH v3 34/63] md/raid1: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 35/63] md/raid10: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 36/63] md/raid5: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 37/63] nvme/host: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 38/63] nvme/target: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 39/63] scsi/core: Improve static type checking Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 40/63] scsi/core: Change the return type of scsi_noretry_cmd() into bool Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 41/63] scsi/core: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 42/63] scsi/device_handlers: " Bart Van Assche
2022-07-14 18:27   ` Martin Wilck
2022-07-14 18:07 ` [PATCH v3 43/63] scsi/ufs: Rename a 'dir' argument into 'op' Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 44/63] scsi/target: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 45/63] mm: " Bart Van Assche
2022-07-15  9:39   ` Jan Kara
2022-07-14 18:07 ` [PATCH v3 46/63] fs/buffer: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 47/63] fs/buffer: Combine two submit_bh() and ll_rw_block() arguments Bart Van Assche
2022-07-15  9:38   ` Jan Kara
2022-07-14 18:07 ` [PATCH v3 48/63] fs/direct-io: Reduce the size of struct dio Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 49/63] fs/mpage: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` Bart Van Assche [this message]
2022-07-14 18:07 ` [PATCH v3 51/63] fs/ext4: " Bart Van Assche
2022-07-15  1:09   ` Theodore Ts'o
2022-07-14 18:07 ` [PATCH v3 52/63] fs/f2fs: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 53/63] fs/gfs2: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 54/63] fs/hfsplus: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 55/63] fs/iomap: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 56/63] fs/jbd2: Fix the documentation of the jbd2_write_superblock() callers Bart Van Assche
2022-07-15  1:10   ` Theodore Ts'o
2022-07-14 18:07 ` [PATCH v3 57/63] fs/nfs: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 58/63] fs/nilfs2: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 59/63] fs/ntfs3: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 60/63] fs/ocfs2: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 61/63] PM: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 62/63] fs/xfs: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 63/63] fs/zonefs: Use the enum req_op type for tracing request operations Bart Van Assche
2022-07-18 10:49   ` Damien Le Moal
2022-07-14 18:15 ` [PATCH v3 00/63] Improve static type checking for request flags Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220714180729.1065367-51-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.