mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
fs/hfsplus: Use the enum req_op and blk_opf_t types
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>
This commit is contained in:
parent
67688c08b7
commit
c85f99929e
@ -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);
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user