Skip to content

Commit ae7e965

Browse files
damien-lemoalaxboe
authored andcommitted
dm: Refactor is_abnormal_io()
Use a single switch-case to simplify is_abnormal_io() and make this function more readable and easier to modify. Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f4d5dc3 commit ae7e965

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

drivers/md/dm.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,20 +1598,18 @@ static void __send_abnormal_io(struct clone_info *ci, struct dm_target *ti,
15981598

15991599
static bool is_abnormal_io(struct bio *bio)
16001600
{
1601-
enum req_op op = bio_op(bio);
1602-
1603-
if (op != REQ_OP_READ && op != REQ_OP_WRITE && op != REQ_OP_FLUSH) {
1604-
switch (op) {
1605-
case REQ_OP_DISCARD:
1606-
case REQ_OP_SECURE_ERASE:
1607-
case REQ_OP_WRITE_ZEROES:
1608-
return true;
1609-
default:
1610-
break;
1611-
}
1601+
switch (bio_op(bio)) {
1602+
case REQ_OP_READ:
1603+
case REQ_OP_WRITE:
1604+
case REQ_OP_FLUSH:
1605+
return false;
1606+
case REQ_OP_DISCARD:
1607+
case REQ_OP_SECURE_ERASE:
1608+
case REQ_OP_WRITE_ZEROES:
1609+
return true;
1610+
default:
1611+
return false;
16121612
}
1613-
1614-
return false;
16151613
}
16161614

16171615
static blk_status_t __process_abnormal_io(struct clone_info *ci,

0 commit comments

Comments
 (0)