Skip to content

Improve static type checking for request flags

Bart Van Assche linux-block 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest63 patches 10 repliesApplied
  2. v263 patches 32 repliesSuperseded
  3. v151 patches 30 repliesSuperseded

Changes in v3 from the cover letter

- Renamed 'op' arguments and variables into 'opf' in case these hold both a request operation and flags (BFQ, mq-deadline, Kyber and NVMe target code).
- Added more Reviewed-by tags.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/63treewide: Rename enum req_opf into enum req_opblock/blk-zoned.c drivers/block/null_blk/main.c drivers/block/null_blk/null_blk.h +10 more+33 -390 replies
2/63block: Use enum req_op where appropriateblock/blk-core.c block/blk-mq-debugfs.c block/blk-throttle.c +4 more+14 -130 replies
3/63block: Change the type of the last .rw_page() argumentdrivers/block/brd.c drivers/block/zram/zram_drv.c drivers/nvdimm/btt.c +2 more+5 -50 replies
4/63block: Change the type of req_op() and bio_op() into enum req_opblock/blk-merge.c drivers/block/paride/pd.c drivers/md/dm.c +2 more+14 -40 replies
5/63block: Introduce the type blk_opf_tinclude/linux/blk_types.h+51 -460 replies
6/63block: Use the new blk_opf_t typeblock/bio.c block/blk-cgroup-rwstat.h block/blk-core.c +11 more+53 -520 replies
7/63block/bfq: Use the new blk_opf_t typeblock/bfq-cgroup.c block/bfq-iosched.c block/bfq-iosched.h+25 -251 reply
8/63block/mq-deadline: Use the new blk_opf_t typeblock/mq-deadline.c+2 -20 replies
9/63block/kyber: Use the new blk_opf_t typeblock/kyber-iosched.c+4 -40 replies
10/63blktrace: Trace remapped requests correctlykernel/trace/blktrace.c+1 -10 replies
11/63blktrace: Use the new blk_opf_t typeinclude/linux/blktrace_api.h kernel/trace/blktrace.c+27 -270 replies
12/63block/brd: Use the enum req_op typedrivers/block/brd.c+1 -10 replies
13/63block/drbd: Use the enum req_op and blk_opf_t typesdrivers/block/drbd/drbd_actlog.c drivers/block/drbd/drbd_bitmap.c drivers/block/drbd/drbd_int.h +1 more+15 -130 replies
14/63block/drbd: Combine two drbd_submit_peer_request() argumentsdrivers/block/drbd/drbd_int.h drivers/block/drbd/drbd_receiver.c drivers/block/drbd/drbd_worker.c+9 -110 replies
15/63block/floppy: Fix a sparse warningdrivers/block/floppy.c+1 -10 replies
16/63block/rnbd: Use blk_opf_t where appropriatedrivers/block/rnbd/rnbd-proto.h+4 -30 replies
17/63xen-blkback: Use the enum req_op and blk_opf_t typesdrivers/block/xen-blkback/blkback.c+3 -30 replies
18/63block/zram: Use enum req_op where appropriatedrivers/block/zram/zram_drv.c+1 -10 replies
19/63nvdimm-btt: Use the enum req_op typedrivers/nvdimm/btt.c+1 -10 replies
20/63um: Use enum req_op where appropriatearch/um/drivers/ubd_kern.c+2 -20 replies
21/63dm/core: Reduce the size of struct dm_io_requestdrivers/md/dm-bufio.c drivers/md/dm-integrity.c drivers/md/dm-io.c +6 more+29 -450 replies
22/63dm/core: Rename kcopyd_job.rw into kcopyd.opdrivers/md/dm-kcopyd.c+13 -120 replies
23/63dm/core: Combine request operation type and flagsdrivers/md/dm-bufio.c drivers/md/dm-io.c drivers/md/dm.c+32 -330 replies
24/63dm/ebs: Change 'int rw' into 'enum req_op op'drivers/md/dm-ebs-target.c+8 -70 replies
25/63dm/dm-flakey: Use the new blk_opf_t typedrivers/md/dm-flakey.c+6 -20 replies
26/63dm/dm-integrity: Combine request operation and flagsdrivers/md/dm-integrity.c+34 -290 replies
27/63dm mirror log: Use the new blk_opf_t typedrivers/md/dm-log.c+1 -10 replies
28/63dm-snap: Combine request operation type and flagsdrivers/md/dm-snap-persistent.c+12 -120 replies
29/63dm/zone: Use the enum req_op typedrivers/md/dm-zone.c+1 -10 replies
30/63dm/dm-zoned: Use the enum req_op typedrivers/md/dm-zoned-metadata.c drivers/md/dm-zoned.h+4 -30 replies
31/63md/core: Combine two sync_page_io() argumentsdrivers/md/dm-raid.c drivers/md/md-bitmap.c drivers/md/md.c +5 more+29 -300 replies
32/63md/bcache: Combine two uuid_io() argumentsdrivers/md/bcache/super.c+8 -81 reply
33/63md/bcache: Combine two prio_io() argumentsdrivers/md/bcache/super.c+4 -51 reply
34/63md/raid1: Use the new blk_opf_t typedrivers/md/raid1.c+2 -20 replies
35/63md/raid10: Use the new blk_opf_t typedrivers/md/raid10.c+5 -50 replies
36/63md/raid5: Use the enum req_op and blk_opf_t typesdrivers/md/raid5.c+2 -10 replies
37/63nvme/host: Use the enum req_op and blk_opf_t typesdrivers/nvme/host/ioctl.c drivers/nvme/host/nvme.h+3 -30 replies
38/63nvme/target: Use the new blk_opf_t typedrivers/nvme/target/io-cmd-bdev.c drivers/nvme/target/zns.c+12 -110 replies
39/63scsi/core: Improve static type checkingdrivers/scsi/scsi_lib.c include/scsi/scsi_cmnd.h+5 -50 replies
40/63scsi/core: Change the return type of scsi_noretry_cmd() into booldrivers/scsi/scsi_error.c drivers/scsi/scsi_priv.h+9 -90 replies
41/63scsi/core: Use the new blk_opf_t typedrivers/scsi/scsi_lib.c include/scsi/scsi_device.h+4 -40 replies
42/63scsi/device_handlers: Use the new blk_opf_t typedrivers/scsi/device_handler/scsi_dh_alua.c drivers/scsi/device_handler/scsi_dh_emc.c drivers/scsi/device_handler/scsi_dh_hp_sw.c +1 more+6 -61 reply
43/63scsi/ufs: Rename a 'dir' argument into 'op'drivers/ufs/core/ufshpb.c+2 -20 replies
44/63scsi/target: Use the new blk_opf_t typedrivers/target/target_core_iblock.c+2 -20 replies
45/63mm: Use the new blk_opf_t typeinclude/linux/writeback.h+2 -21 reply
46/63fs/buffer: Use the new blk_opf_t typefs/buffer.c include/linux/buffer_head.h+16 -140 replies
47/63fs/buffer: Combine two submit_bh() and ll_rw_block() argumentsdrivers/md/md-bitmap.c fs/buffer.c fs/ext4/fast_commit.c +32 more+88 -901 reply
48/63fs/direct-io: Reduce the size of struct diofs/direct-io.c+23 -170 replies
49/63fs/mpage: Use the new blk_opf_t typefs/mpage.c+3 -30 replies
50/63fs/btrfs: Use the enum req_op and blk_opf_t typesfs/btrfs/check-integrity.c fs/btrfs/compression.c fs/btrfs/compression.h +3 more+19 -190 replies
51/63fs/ext4: Use the new blk_opf_t typefs/ext4/ext4.h fs/ext4/fast_commit.c fs/ext4/super.c+12 -121 reply
52/63fs/f2fs: Use the enum req_op and blk_opf_t typesfs/f2fs/data.c fs/f2fs/f2fs.h fs/f2fs/node.c +2 more+22 -210 replies
53/63fs/gfs2: Use the enum req_op and blk_opf_t typesfs/gfs2/log.c fs/gfs2/log.h fs/gfs2/lops.c +2 more+10 -110 replies
54/63fs/hfsplus: Use the enum req_op and blk_opf_t typesfs/hfsplus/hfsplus_fs.h fs/hfsplus/part_tbl.c fs/hfsplus/super.c +1 more+11 -120 replies
55/63fs/iomap: Use the new blk_opf_t typefs/iomap/direct-io.c+4 -40 replies
56/63fs/jbd2: Fix the documentation of the jbd2_write_superblock() callersfs/jbd2/journal.c include/linux/jbd2.h include/trace/events/jbd2.h+15 -141 reply
57/63fs/nfs: Use enum req_op where appropriatefs/nfs/blocklayout/blocklayout.c+6 -70 replies
58/63fs/nilfs2: Use the enum req_op and blk_opf_t typesfs/nilfs2/btnode.c fs/nilfs2/btnode.h fs/nilfs2/btree.c +3 more+23 -230 replies
59/63fs/ntfs3: Use enum req_op where appropriatefs/ntfs3/fsntfs.c fs/ntfs3/ntfs_fs.h+2 -20 replies
60/63fs/ocfs2: Use the enum req_op and blk_opf_t typesfs/ocfs2/cluster/heartbeat.c+5 -60 replies
61/63PM: Use the enum req_op and blk_opf_t typeskernel/power/swap.c+13 -160 replies
62/63fs/xfs: Use the enum req_op and blk_opf_t typesfs/xfs/xfs_bio_io.c fs/xfs/xfs_buf.c fs/xfs/xfs_linux.h +1 more+5 -50 replies
63/63fs/zonefs: Use the enum req_op type for tracing request operationsfs/zonefs/trace.h+1 -11 reply

Reviews trailers per patch

28 of 63 patches have a Reviewed-by or Acked-by.

PatchJun'ichi NomuraChristoph BöhmwalderJack WangRoger Pau MonnéDamien Le MoalSong LiuSagi GrimbergAvri AltmanJan KaraDavid SterbaAndreas GruenbacherRyusuke KonishiJoseph QiRafael J. WysockiDarrick J. WongJohannes ThumshirnMartin WilckTheodore Ts'oColy Li
1/63
2/63
3/63
4/63
5/63
6/63
7/63R-b
8/63
9/63
10/63R-b
11/63
12/63
13/63R-b
14/63R-b
15/63
16/63A-b
17/63A-b
18/63
19/63
20/63
21/63
22/63
23/63
24/63
25/63
26/63
27/63
28/63
29/63R-b
30/63R-b
31/63
32/63A-b
33/63Asked-by
34/63A-b
35/63A-b
36/63A-b
37/63R-b
38/63
39/63
40/63
41/63
42/63R-b
43/63R-b
44/63
45/63R-b
46/63R-b
47/63A-b R-b
48/63R-b
49/63
50/63A-b
51/63A-b
52/63
53/63R-b
54/63
55/63
56/63A-b
57/63
58/63R-b
59/63
60/63R-b
61/63A-b
62/63R-b
63/63R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 19 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/63] Improve static type checking for request flags

Hi Jens,

A source of confusion in the block layer is that can be nontrivial to determine which type of flags a u32 function argument accepts. This patch series clears up that confusion for request flags by introducing a new __bitwise type, namely blk_opf_t. Additionally, the type 'int' is change into 'enum req_op' where used to hold a request operation.

Analysis of the sparse warnings introduced by this conversion resulted in one bug fix ("blktrace: Trace remap operations correctly").

Although the number of patches in this series is significant, the risk of this patch series is low since most patches involve changing one integer type (int or u32) into another integer type of the same size (enum req_op or blk_opf_t).

Please consider this patch series for kernel v5.20.

Thanks,

Bart.

Changes compared to v2:
- Renamed 'op' arguments and variables into 'opf' in case these hold both a request operation and flags (BFQ, mq-deadline, Kyber and NVMe target code).
- Added more Reviewed-by tags.

Changes compared to v1:
- Combined request operation and flags into a single variable or argument.
- Changed the type of several enum req_op arguments into blk_opf_t for future extensibility.
- Removed the __force casts from tracing code.
- Added a few additional patches that convert additional block drivers.

Bart Van Assche (63):
treewide: Rename enum req_opf into enum req_op
block: Use enum req_op where appropriate
block: Change the type of the last .rw_page() argument
block: Change the type of req_op() and bio_op() into enum req_op
block: Introduce the type blk_opf_t
block: Use the new blk_opf_t type
block/bfq: Use the new blk_opf_t type
block/mq-deadline: Use the new blk_opf_t type
block/kyber: Use the new blk_opf_t type
blktrace: Trace remapped requests correctly
blktrace: Use the new blk_opf_t type
block/brd: Use the enum req_op type
block/drbd: Use the enum req_op and blk_opf_t types block/drbd: Combine two drbd_submit_peer_request() arguments block/floppy: Fix a sparse warning
block/rnbd: Use blk_opf_t where appropriate
xen-blkback: Use the enum req_op and blk_opf_t types block/zram: Use enum req_op where appropriate
nvdimm-btt: Use the enum req_op type
um: Use enum req_op where appropriate
dm/core: Reduce the size of struct dm_io_request
dm/core: Rename kcopyd_job.rw into kcopyd.op
dm/core: Combine request operation type and flags
dm/ebs: Change 'int rw' into 'enum req_op op' dm/dm-flakey: Use the new blk_opf_t type
dm/dm-integrity: Combine request operation and flags
dm mirror log: Use the new blk_opf_t type
dm-snap: Combine request operation type and flags
dm/zone: Use the enum req_op type
dm/dm-zoned: Use the enum req_op type
md/core: Combine two sync_page_io() arguments
md/bcache: Combine two uuid_io() arguments
md/bcache: Combine two prio_io() arguments
md/raid1: Use the new blk_opf_t type
md/raid10: Use the new blk_opf_t type
md/raid5: Use the enum req_op and blk_opf_t types nvme/host: Use the enum req_op and blk_opf_t types nvme/target: Use the new blk_opf_t type
scsi/core: Improve static type checking
scsi/core: Change the return type of scsi_noretry_cmd() into bool scsi/core: Use the new blk_opf_t type scsi/device_handlers: Use the new blk_opf_t type
scsi/ufs: Rename a 'dir' argument into 'op'
scsi/target: Use the new blk_opf_t type
mm: Use the new blk_opf_t type
fs/buffer: Use the new blk_opf_t type
fs/buffer: Combine two submit_bh() and ll_rw_block() arguments fs/direct-io: Reduce the size of struct dio
fs/mpage: Use the new blk_opf_t type
fs/btrfs: Use the enum req_op and blk_opf_t types
fs/ext4: Use the new blk_opf_t type
fs/f2fs: Use the enum req_op and blk_opf_t types
fs/gfs2: Use the enum req_op and blk_opf_t types fs/hfsplus: Use the enum req_op and blk_opf_t types fs/iomap: Use the new blk_opf_t type
fs/jbd2: Fix the documentation of the jbd2_write_superblock() callers fs/nfs: Use enum req_op where appropriate
fs/nilfs2: Use the enum req_op and blk_opf_t types fs/ntfs3: Use enum req_op where appropriate
fs/ocfs2: Use the enum req_op and blk_opf_t types
PM: Use the enum req_op and blk_opf_t types
fs/xfs: Use the enum req_op and blk_opf_t types
fs/zonefs: Use the enum req_op type for tracing request operations

 arch/um/drivers/ubd_kern.c                  |   4 +-
 block/bfq-cgroup.c                          |  26 ++---
 block/bfq-iosched.c                         |  16 +--
 block/bfq-iosched.h                         |   8 +-
 block/bio.c                                 |  10 +-
 block/blk-cgroup-rwstat.h                   |   8 +-
 block/blk-core.c                            |   8 +-
 block/blk-flush.c                           |   6 +-
 block/blk-merge.c                           |   8 +-
 block/blk-mq-debugfs.c                      |   6 +-
 block/blk-mq.c                              |  15 +--
 block/blk-mq.h                              |   6 +-
 block/blk-throttle.c                        |   7 +-
 block/blk-wbt.c                             |  18 +--
 block/blk-zoned.c                           |   7 +-
 block/blk.h                                 |   2 +-
 block/elevator.h                            |   2 +-
 block/fops.c                                |  12 +-
 block/kyber-iosched.c                       |   8 +-
 block/mq-deadline.c                         |   4 +-
 drivers/block/brd.c                         |   4 +-
 drivers/block/drbd/drbd_actlog.c            |   9 +-
 drivers/block/drbd/drbd_bitmap.c            |   2 +-
 drivers/block/drbd/drbd_int.h               |   5 +-
 drivers/block/drbd/drbd_receiver.c          |  24 ++--
 drivers/block/drbd/drbd_worker.c            |   2 +-
 drivers/block/floppy.c                      |   2 +-
 drivers/block/null_blk/main.c               |   9 +-
 drivers/block/null_blk/null_blk.h           |  12 +-
 drivers/block/null_blk/trace.h              |   2 +-
 drivers/block/null_blk/zoned.c              |   4 +-
 drivers/block/paride/pd.c                   |   2 +
 drivers/block/rnbd/rnbd-proto.h             |   7 +-
 drivers/block/xen-blkback/blkback.c         |   6 +-
 drivers/block/zram/zram_drv.c               |   4 +-
 drivers/md/bcache/super.c                   |  25 ++--
 drivers/md/dm-bufio.c                       |  26 ++---
 drivers/md/dm-ebs-target.c                  |  15 +--
 drivers/md/dm-flakey.c                      |   8 +-
 drivers/md/dm-integrity.c                   |  76 ++++++-------
 drivers/md/dm-io.c                          |  38 +++----
 drivers/md/dm-kcopyd.c                      |  26 ++---
 drivers/md/dm-log.c                         |   8 +-
 drivers/md/dm-raid.c                        |   2 +-
 drivers/md/dm-raid1.c                       |  12 +-
 drivers/md/dm-snap-persistent.c             |  25 ++--
 drivers/md/dm-writecache.c                  |  12 +-
 drivers/md/dm-zone.c                        |   2 +-
 drivers/md/dm-zoned-metadata.c              |   5 +-
 drivers/md/dm-zoned.h                       |   2 +-
 drivers/md/dm.c                             |  12 +-
 drivers/md/md-bitmap.c                      |   6 +-
 drivers/md/md.c                             |  10 +-
 drivers/md/md.h                             |   3 +-
 drivers/md/raid1.c                          |  12 +-
 drivers/md/raid10.c                         |  20 ++--
 drivers/md/raid5-cache.c                    |  12 +-
 drivers/md/raid5-ppl.c                      |  12 +-
 drivers/md/raid5.c                          |   3 +-
 drivers/nvdimm/btt.c                        |   4 +-
 drivers/nvdimm/pmem.c                       |   2 +-
 drivers/nvme/host/ioctl.c                   |   4 +-
 drivers/nvme/host/nvme.h                    |   2 +-
 drivers/nvme/target/io-cmd-bdev.c           |  17 +--
 drivers/nvme/target/zns.c                   |  10 +-
 drivers/scsi/device_handler/scsi_dh_alua.c  |   4 +-
 drivers/scsi/device_handler/scsi_dh_emc.c   |   2 +-
 drivers/scsi/device_handler/scsi_dh_hp_sw.c |   4 +-
 drivers/scsi/device_handler/scsi_dh_rdac.c  |   2 +-
 drivers/scsi/scsi_error.c                   |  16 +--
 drivers/scsi/scsi_lib.c                     |  12 +-
 drivers/scsi/scsi_priv.h                    |   2 +-
 drivers/scsi/sd_zbc.c                       |   2 +-
 drivers/target/target_core_iblock.c         |   4 +-
 drivers/ufs/core/ufshpb.c                   |   7 +-
 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 +-
 fs/buffer.c                                 |  56 ++++-----
 fs/direct-io.c                              |  40 ++++---
 fs/ext4/ext4.h                              |   8 +-
 fs/ext4/fast_commit.c                       |   4 +-
 fs/ext4/mmp.c                               |   2 +-
 fs/ext4/super.c                             |  20 ++--
 fs/f2fs/data.c                              |  11 +-
 fs/f2fs/f2fs.h                              |   6 +-
 fs/f2fs/node.c                              |   2 +-
 fs/f2fs/segment.c                           |   2 +-
 fs/gfs2/bmap.c                              |   5 +-
 fs/gfs2/dir.c                               |   5 +-
 fs/gfs2/log.c                               |   4 +-
 fs/gfs2/log.h                               |   2 +-
 fs/gfs2/lops.c                              |   4 +-
 fs/gfs2/lops.h                              |   2 +-
 fs/gfs2/meta_io.c                           |  18 ++-
 fs/gfs2/quota.c                             |   2 +-
 fs/hfsplus/hfsplus_fs.h                     |   2 +-
 fs/hfsplus/part_tbl.c                       |   5 +-
 fs/hfsplus/super.c                          |   4 +-
 fs/hfsplus/wrapper.c                        |  12 +-
 fs/iomap/direct-io.c                        |   8 +-
 fs/isofs/compress.c                         |   2 +-
 fs/jbd2/commit.c                            |   8 +-
 fs/jbd2/journal.c                           |  19 ++--
 fs/jbd2/recovery.c                          |   4 +-
 fs/mpage.c                                  |   6 +-
 fs/nfs/blocklayout/blocklayout.c            |  13 +--
 fs/nilfs2/btnode.c                          |   8 +-
 fs/nilfs2/btnode.h                          |   4 +-
 fs/nilfs2/btree.c                           |   6 +-
 fs/nilfs2/gcinode.c                         |   7 +-
 fs/nilfs2/mdt.c                             |  19 ++--
 fs/ntfs/aops.c                              |   6 +-
 fs/ntfs/compress.c                          |   2 +-
 fs/ntfs/file.c                              |   2 +-
 fs/ntfs/logfile.c                           |   2 +-
 fs/ntfs/mft.c                               |   4 +-
 fs/ntfs3/file.c                             |   2 +-
 fs/ntfs3/fsntfs.c                           |   2 +-
 fs/ntfs3/inode.c                            |   2 +-
 fs/ntfs3/ntfs_fs.h                          |   2 +-
 fs/ocfs2/aops.c                             |   2 +-
 fs/ocfs2/buffer_head_io.c                   |   8 +-
 fs/ocfs2/cluster/heartbeat.c                |  11 +-
 fs/ocfs2/super.c                            |   2 +-
 fs/reiserfs/inode.c                         |   4 +-
 fs/reiserfs/journal.c                       |  12 +-
 fs/reiserfs/stree.c                         |   4 +-
 fs/reiserfs/super.c                         |   2 +-
 fs/udf/dir.c                                |   2 +-
 fs/udf/directory.c                          |   2 +-
 fs/udf/inode.c                              |   2 +-
 fs/ufs/balloc.c                             |   2 +-
 fs/xfs/xfs_bio_io.c                         |   2 +-
 fs/xfs/xfs_buf.c                            |   4 +-
 fs/xfs/xfs_linux.h                          |   2 +-
 fs/xfs/xfs_log_recover.c                    |   2 +-
 fs/zonefs/super.c                           |   5 +-
 fs/zonefs/trace.h                           |   4 +-
 include/linux/bio.h                         |  10 +-
 include/linux/blk-mq.h                      |  12 +-
 include/linux/blk_types.h                   | 119 +++++++++++---------
 include/linux/blkdev.h                      |  12 +-
 include/linux/blktrace_api.h                |   3 +-
 include/linux/buffer_head.h                 |   9 +-
 include/linux/dm-io.h                       |   4 +-
 include/linux/jbd2.h                        |   2 +-
 include/linux/writeback.h                   |   4 +-
 include/scsi/scsi_cmnd.h                    |   4 +-
 include/scsi/scsi_device.h                  |   2 +-
 include/trace/events/f2fs.h                 |  22 ++--
 include/trace/events/jbd2.h                 |  12 +-
 include/trace/events/nilfs2.h               |   4 +-
 kernel/power/swap.c                         |  29 +++--
 kernel/trace/blktrace.c                     |  51 ++++-----
 158 files changed, 751 insertions(+), 743 deletions(-)