Commit 3f9b8fb4 authored by Al Viro's avatar Al Viro

Use bdev_is_paritition() instead of open-coding it

Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 39cd87c4
...@@ -759,7 +759,8 @@ void submit_bio_noacct(struct bio *bio) ...@@ -759,7 +759,8 @@ void submit_bio_noacct(struct bio *bio)
if (!bio_flagged(bio, BIO_REMAPPED)) { if (!bio_flagged(bio, BIO_REMAPPED)) {
if (unlikely(bio_check_eod(bio))) if (unlikely(bio_check_eod(bio)))
goto end_io; goto end_io;
if (bdev->bd_partno && unlikely(blk_partition_remap(bio))) if (bdev_is_partition(bdev) &&
unlikely(blk_partition_remap(bio)))
goto end_io; goto end_io;
} }
...@@ -989,7 +990,7 @@ void update_io_ticks(struct block_device *part, unsigned long now, bool end) ...@@ -989,7 +990,7 @@ void update_io_ticks(struct block_device *part, unsigned long now, bool end)
if (likely(try_cmpxchg(&part->bd_stamp, &stamp, now))) if (likely(try_cmpxchg(&part->bd_stamp, &stamp, now)))
__part_stat_add(part, io_ticks, end ? now - stamp : 1); __part_stat_add(part, io_ticks, end ? now - stamp : 1);
} }
if (part->bd_partno) { if (bdev_is_partition(part)) {
part = bdev_whole(part); part = bdev_whole(part);
goto again; goto again;
} }
......
...@@ -92,7 +92,7 @@ static bool blk_mq_check_inflight(struct request *rq, void *priv) ...@@ -92,7 +92,7 @@ static bool blk_mq_check_inflight(struct request *rq, void *priv)
struct mq_inflight *mi = priv; struct mq_inflight *mi = priv;
if (rq->part && blk_do_io_stat(rq) && if (rq->part && blk_do_io_stat(rq) &&
(!mi->part->bd_partno || rq->part == mi->part) && (!bdev_is_partition(mi->part) || rq->part == mi->part) &&
blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT)
mi->inflight[rq_data_dir(rq)]++; mi->inflight[rq_data_dir(rq)]++;
......
...@@ -59,7 +59,7 @@ static inline void part_stat_set_all(struct block_device *part, int value) ...@@ -59,7 +59,7 @@ static inline void part_stat_set_all(struct block_device *part, int value)
#define part_stat_add(part, field, addnd) do { \ #define part_stat_add(part, field, addnd) do { \
__part_stat_add((part), field, addnd); \ __part_stat_add((part), field, addnd); \
if ((part)->bd_partno) \ if (bdev_is_partition(part)) \
__part_stat_add(bdev_whole(part), field, addnd); \ __part_stat_add(bdev_whole(part), field, addnd); \
} while (0) } while (0)
......
...@@ -966,7 +966,7 @@ char *bdev_name(char *buf, char *end, struct block_device *bdev, ...@@ -966,7 +966,7 @@ char *bdev_name(char *buf, char *end, struct block_device *bdev,
hd = bdev->bd_disk; hd = bdev->bd_disk;
buf = string(buf, end, hd->disk_name, spec); buf = string(buf, end, hd->disk_name, spec);
if (bdev->bd_partno) { if (bdev_is_partition(bdev)) {
if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) { if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) {
if (buf < end) if (buf < end)
*buf = 'p'; *buf = 'p';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment