]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs/gfs2: Use the enum req_op and blk_opf_t types
authorBart Van Assche <bvanassche@acm.org>
Thu, 14 Jul 2022 18:07:19 +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 first two
gfs2_submit_bhs() arguments into a single argument.

Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220714180729.1065367-54-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/gfs2/log.c
fs/gfs2/log.h
fs/gfs2/lops.c
fs/gfs2/lops.h
fs/gfs2/meta_io.c

index f0ee3ff6f9a876560e808b9c87b794d984ff6a6b..eec4159b08aa4dbfac1fdb3682e83c97d93a66d7 100644 (file)
@@ -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;
@@ -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));
index fc905c2af53ce928fa1ea1ee8dc99e53271d9c1c..653cffcbf86945f3013256dd252caa7fb679b425 100644 (file)
@@ -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);
index 6ba51cbb94cf2049ebae4fe6cf0fbd0ed8c99a6f..90a2d7bc91c4216bb3be45aa78869d7aeb6077e4 100644 (file)
@@ -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) {
@@ -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;
index f707601597dccd2d277846768b1d06f0fbbc588e..1412ffba1d4446b918f7779a762b19564ea6ce95 100644 (file)
@@ -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);
index 3570739f005dbf4d47c459010f5b3799b87c83f6..7e70e0ba5a6c0a09d4b44f2e2c70483571e6411e 100644 (file)
@@ -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));
@@ -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;
@@ -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;