mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +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 (unlikely(bio_check_eod(bio)))
|
||||
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;
|
||||
}
|
||||
|
||||
@ -989,7 +990,7 @@ again:
|
||||
if (likely(try_cmpxchg(&part->bd_stamp, &stamp, now)))
|
||||
__part_stat_add(part, io_ticks, end ? now - stamp : 1);
|
||||
}
|
||||
if (part->bd_partno) {
|
||||
if (bdev_is_partition(part)) {
|
||||
part = bdev_whole(part);
|
||||
goto again;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static bool blk_mq_check_inflight(struct request *rq, void *priv)
|
||||
struct mq_inflight *mi = priv;
|
||||
|
||||
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)
|
||||
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 { \
|
||||
__part_stat_add((part), field, addnd); \
|
||||
if ((part)->bd_partno) \
|
||||
if (bdev_is_partition(part)) \
|
||||
__part_stat_add(bdev_whole(part), field, addnd); \
|
||||
} while (0)
|
||||
|
||||
|
@ -966,7 +966,7 @@ char *bdev_name(char *buf, char *end, struct block_device *bdev,
|
||||
|
||||
hd = bdev->bd_disk;
|
||||
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 (buf < end)
|
||||
*buf = 'p';
|
||||
|
Loading…
Reference in New Issue
Block a user