Skip to content

Commit 3f9b8fb

Browse files
author
Al Viro
committed
Use bdev_is_paritition() instead of open-coding it
Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 39cd87c commit 3f9b8fb

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

block/blk-core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,8 @@ void submit_bio_noacct(struct bio *bio)
759759
if (!bio_flagged(bio, BIO_REMAPPED)) {
760760
if (unlikely(bio_check_eod(bio)))
761761
goto end_io;
762-
if (bdev->bd_partno && unlikely(blk_partition_remap(bio)))
762+
if (bdev_is_partition(bdev) &&
763+
unlikely(blk_partition_remap(bio)))
763764
goto end_io;
764765
}
765766

@@ -989,7 +990,7 @@ void update_io_ticks(struct block_device *part, unsigned long now, bool end)
989990
if (likely(try_cmpxchg(&part->bd_stamp, &stamp, now)))
990991
__part_stat_add(part, io_ticks, end ? now - stamp : 1);
991992
}
992-
if (part->bd_partno) {
993+
if (bdev_is_partition(part)) {
993994
part = bdev_whole(part);
994995
goto again;
995996
}

block/blk-mq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static bool blk_mq_check_inflight(struct request *rq, void *priv)
9292
struct mq_inflight *mi = priv;
9393

9494
if (rq->part && blk_do_io_stat(rq) &&
95-
(!mi->part->bd_partno || rq->part == mi->part) &&
95+
(!bdev_is_partition(mi->part) || rq->part == mi->part) &&
9696
blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT)
9797
mi->inflight[rq_data_dir(rq)]++;
9898

include/linux/part_stat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static inline void part_stat_set_all(struct block_device *part, int value)
5959

6060
#define part_stat_add(part, field, addnd) do { \
6161
__part_stat_add((part), field, addnd); \
62-
if ((part)->bd_partno) \
62+
if (bdev_is_partition(part)) \
6363
__part_stat_add(bdev_whole(part), field, addnd); \
6464
} while (0)
6565

lib/vsprintf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ char *bdev_name(char *buf, char *end, struct block_device *bdev,
966966

967967
hd = bdev->bd_disk;
968968
buf = string(buf, end, hd->disk_name, spec);
969-
if (bdev->bd_partno) {
969+
if (bdev_is_partition(bdev)) {
970970
if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) {
971971
if (buf < end)
972972
*buf = 'p';

0 commit comments

Comments
 (0)