]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs/hfsplus: Use the enum req_op and blk_opf_t types
authorBart Van Assche <bvanassche@acm.org>
Thu, 14 Jul 2022 18:07:20 +0000 (11:07 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 14 Jul 2022 18:14:32 +0000 (12:14 -0600)
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. Combine the last two
hfsplus_submit_bio() arguments into a single argument.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220714180729.1065367-55-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/hfsplus/hfsplus_fs.h
fs/hfsplus/part_tbl.c
fs/hfsplus/super.c
fs/hfsplus/wrapper.c

index 396e73aa096128eb5eb1a056ade059ff90324a84..a5db2e3b29801abfadd265f8aeefad3ce7668d92 100644 (file)
@@ -525,7 +525,7 @@ int hfsplus_compare_dentry(const struct dentry *dentry, unsigned int len,
 
 /* wrapper.c */
 int hfsplus_submit_bio(struct super_block *sb, sector_t sector, void *buf,
-                      void **data, int op, int op_flags);
+                      void **data, blk_opf_t opf);
 int hfsplus_read_wrapper(struct super_block *sb);
 
 /*
index 63164ebc52fa14f56570984908e409d5d0a4ba69..9ec21664eda6b4d65b909ac1287957c120f5ffd1 100644 (file)
@@ -112,8 +112,7 @@ static int hfs_parse_new_pmap(struct super_block *sb, void *buf,
                if ((u8 *)pm - (u8 *)buf >= buf_size) {
                        res = hfsplus_submit_bio(sb,
                                                 *part_start + HFS_PMAP_BLK + i,
-                                                buf, (void **)&pm, REQ_OP_READ,
-                                                0);
+                                                buf, (void **)&pm, REQ_OP_READ);
                        if (res)
                                return res;
                }
@@ -137,7 +136,7 @@ int hfs_part_find(struct super_block *sb,
                return -ENOMEM;
 
        res = hfsplus_submit_bio(sb, *part_start + HFS_PMAP_BLK,
-                                buf, &data, REQ_OP_READ, 0);
+                                buf, &data, REQ_OP_READ);
        if (res)
                goto out;
 
index 8479add998b582800f36e08a848963af52d03b9d..122ed89ebf9f22901a7580a0470e5a0d8636cc0b 100644 (file)
@@ -221,7 +221,7 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait)
 
        error2 = hfsplus_submit_bio(sb,
                                   sbi->part_start + HFSPLUS_VOLHEAD_SECTOR,
-                                  sbi->s_vhdr_buf, NULL, REQ_OP_WRITE,
+                                  sbi->s_vhdr_buf, NULL, REQ_OP_WRITE |
                                   REQ_SYNC);
        if (!error)
                error = error2;
@@ -230,7 +230,7 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait)
 
        error2 = hfsplus_submit_bio(sb,
                                  sbi->part_start + sbi->sect_count - 2,
-                                 sbi->s_backup_vhdr_buf, NULL, REQ_OP_WRITE,
+                                 sbi->s_backup_vhdr_buf, NULL, REQ_OP_WRITE |
                                  REQ_SYNC);
        if (!error)
                error2 = error;
index 0b8ad6586df532721486a4a74cbebaf538afa3c6..0b791adf02e53d6498e5c36fc94b2402b77ad2a0 100644 (file)
@@ -45,8 +45,9 @@ struct hfsplus_wd {
  * will work correctly.
  */
 int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
-                      void *buf, void **data, int op, int op_flags)
+                      void *buf, void **data, blk_opf_t opf)
 {
+       const enum req_op op = opf & REQ_OP_MASK;
        struct bio *bio;
        int ret = 0;
        u64 io_size;
@@ -63,10 +64,10 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
        offset = start & (io_size - 1);
        sector &= ~((io_size >> HFSPLUS_SECTOR_SHIFT) - 1);
 
-       bio = bio_alloc(sb->s_bdev, 1, op | op_flags, GFP_NOIO);
+       bio = bio_alloc(sb->s_bdev, 1, opf, GFP_NOIO);
        bio->bi_iter.bi_sector = sector;
 
-       if (op != WRITE && data)
+       if (op != REQ_OP_WRITE && data)
                *data = (u8 *)buf + offset;
 
        while (io_size > 0) {
@@ -184,7 +185,7 @@ int hfsplus_read_wrapper(struct super_block *sb)
 reread:
        error = hfsplus_submit_bio(sb, part_start + HFSPLUS_VOLHEAD_SECTOR,
                                   sbi->s_vhdr_buf, (void **)&sbi->s_vhdr,
-                                  REQ_OP_READ, 0);
+                                  REQ_OP_READ);
        if (error)
                goto out_free_backup_vhdr;
 
@@ -216,8 +217,7 @@ reread:
 
        error = hfsplus_submit_bio(sb, part_start + part_size - 2,
                                   sbi->s_backup_vhdr_buf,
-                                  (void **)&sbi->s_backup_vhdr, REQ_OP_READ,
-                                  0);
+                                  (void **)&sbi->s_backup_vhdr, REQ_OP_READ);
        if (error)
                goto out_free_backup_vhdr;