mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 13:34:30 +00:00
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>
This commit is contained in:
parent
39cd87c4eb
commit
3f9b8fb46e
@ -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 @@ again:
|
|||||||
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)
|
|||||||
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)
|
|||||||
|
|
||||||
#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,
|
|||||||
|
|
||||||
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';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user