Skip to content

Commit

Permalink
fs/gfs2: Use the enum req_op and blk_opf_t types
Browse files Browse the repository at this point in the history
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 first two
gfs2_submit_bhs() arguments into a single argument.

Reviewed-by: Andreas Gruenbacher <[email protected]>
Cc: Bob Peterson <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
bvanassche authored and axboe committed Jul 14, 2022
1 parent 7649c87 commit 67688c0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions fs/gfs2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ void gfs2_flush_revokes(struct gfs2_sbd *sdp)

void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
u64 seq, u32 tail, u32 lblock, u32 flags,
int op_flags)
blk_opf_t op_flags)
{
struct gfs2_log_header *lh;
u32 hash, crc;
Expand Down Expand Up @@ -905,7 +905,7 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,

static void log_write_header(struct gfs2_sbd *sdp, u32 flags)
{
int op_flags = REQ_PREFLUSH | REQ_FUA | REQ_META | REQ_SYNC;
blk_opf_t op_flags = REQ_PREFLUSH | REQ_FUA | REQ_META | REQ_SYNC;
enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state);

gfs2_assert_withdraw(sdp, (state != SFS_FROZEN));
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ extern void gfs2_log_reserve(struct gfs2_sbd *sdp, struct gfs2_trans *tr,
unsigned int *extra_revokes);
extern void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
u64 seq, u32 tail, u32 lblock, u32 flags,
int op_flags);
blk_opf_t op_flags);
extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl,
u32 type);
extern void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
Expand Down
4 changes: 2 additions & 2 deletions fs/gfs2/lops.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static void gfs2_end_log_write(struct bio *bio)
* there is no pending bio, then this is a no-op.
*/

void gfs2_log_submit_bio(struct bio **biop, int opf)
void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf)
{
struct bio *bio = *biop;
if (bio) {
Expand Down Expand Up @@ -292,7 +292,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno,
*/

static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno,
struct bio **biop, int op,
struct bio **biop, enum req_op op,
bio_end_io_t *end_io, bool flush)
{
struct bio *bio = *biop;
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/lops.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern u64 gfs2_log_bmap(struct gfs2_jdesc *jd, unsigned int lbn);
extern void gfs2_log_write(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
struct page *page, unsigned size, unsigned offset,
u64 blkno);
extern void gfs2_log_submit_bio(struct bio **biop, int opf);
extern void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf);
extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
struct gfs2_log_header_host *head, bool keep_cache);
Expand Down
9 changes: 4 additions & 5 deletions fs/gfs2/meta_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
{
struct buffer_head *bh, *head;
int nr_underway = 0;
int write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc);
blk_opf_t write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc);

BUG_ON(!PageLocked(page));
BUG_ON(!page_has_buffers(page));
Expand Down Expand Up @@ -217,14 +217,13 @@ static void gfs2_meta_read_endio(struct bio *bio)
* Submit several consecutive buffer head I/O requests as a single bio I/O
* request. (See submit_bh_wbc.)
*/
static void gfs2_submit_bhs(int op, int op_flags, struct buffer_head *bhs[],
int num)
static void gfs2_submit_bhs(blk_opf_t opf, struct buffer_head *bhs[], int num)
{
while (num > 0) {
struct buffer_head *bh = *bhs;
struct bio *bio;

bio = bio_alloc(bh->b_bdev, num, op | op_flags, GFP_NOIO);
bio = bio_alloc(bh->b_bdev, num, opf, GFP_NOIO);
bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
while (num > 0) {
bh = *bhs;
Expand Down Expand Up @@ -288,7 +287,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
}
}

gfs2_submit_bhs(REQ_OP_READ, REQ_META | REQ_PRIO, bhs, num);
gfs2_submit_bhs(REQ_OP_READ | REQ_META | REQ_PRIO, bhs, num);
if (!(flags & DIO_WAIT))
return 0;

Expand Down

0 comments on commit 67688c0

Please sign in to comment.