Commit ae7e965b authored by Damien Le Moal's avatar Damien Le Moal Committed by Jens Axboe
Browse files

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: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240704052816.623865-3-dlemoal@kernel.org


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f4d5dc33
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -1598,21 +1598,19 @@ static void __send_abnormal_io(struct clone_info *ci, struct dm_target *ti,

static bool is_abnormal_io(struct bio *bio)
{
	enum req_op op = bio_op(bio);

	if (op != REQ_OP_READ && op != REQ_OP_WRITE && op != REQ_OP_FLUSH) {
		switch (op) {
	switch (bio_op(bio)) {
	case REQ_OP_READ:
	case REQ_OP_WRITE:
	case REQ_OP_FLUSH:
		return false;
	case REQ_OP_DISCARD:
	case REQ_OP_SECURE_ERASE:
	case REQ_OP_WRITE_ZEROES:
		return true;
	default:
			break;
		}
	}

		return false;
	}
}

static blk_status_t __process_abnormal_io(struct clone_info *ci,
					  struct dm_target *ti)