Message ID | 20220629233145.2779494-37-bvanassche@acm.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Improve static type checking for request flags | expand |
On Wed, Jun 29, 2022 at 4:32 PM Bart Van Assche <bvanassche@acm.org> wrote: > > 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. > > Cc: Song Liu <song@kernel.org> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: Song Liu <song@kernel.org> > --- > drivers/md/raid5.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c > index 5d09256d7f81..b11d8b6a2dc2 100644 > --- a/drivers/md/raid5.c > +++ b/drivers/md/raid5.c > @@ -1082,7 +1082,8 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) > should_defer = conf->batch_bio_dispatch && conf->group_cnt; > > for (i = disks; i--; ) { > - int op, op_flags = 0; > + enum req_op op; > + blk_opf_t op_flags = 0; > int replace_only = 0; > struct bio *bi, *rbi; > struct md_rdev *rdev, *rrdev = NULL; > @@ -5896,7 +5897,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) > (unsigned long long)logical_sector); > > sh = raid5_get_active_stripe(conf, new_sector, previous, > - (bi->bi_opf & REQ_RAHEAD), 0); > + !!(bi->bi_opf & REQ_RAHEAD), 0); > if (sh) { > if (unlikely(previous)) { > /* expansion might have moved on while waiting for a
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 5d09256d7f81..b11d8b6a2dc2 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1082,7 +1082,8 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) should_defer = conf->batch_bio_dispatch && conf->group_cnt; for (i = disks; i--; ) { - int op, op_flags = 0; + enum req_op op; + blk_opf_t op_flags = 0; int replace_only = 0; struct bio *bi, *rbi; struct md_rdev *rdev, *rrdev = NULL; @@ -5896,7 +5897,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) (unsigned long long)logical_sector); sh = raid5_get_active_stripe(conf, new_sector, previous, - (bi->bi_opf & REQ_RAHEAD), 0); + !!(bi->bi_opf & REQ_RAHEAD), 0); if (sh) { if (unlikely(previous)) { /* expansion might have moved on while waiting for a
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. Cc: Song Liu <song@kernel.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/md/raid5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)