summaryrefslogtreecommitdiff
path: root/block/partitions/core.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-05-02 16:00:32 +0300
committerJens Axboe <axboe@kernel.dk>2024-05-03 17:59:59 +0300
commit140ce28dd3bee8e53acc27f123ae474d69ef66f0 (patch)
treebadd9cf1f719edebd6757cadf433821b0e93889a /block/partitions/core.c
parentd0487577e6e0b640d71375a6ec2f9e8a2d3555f2 (diff)
downloadlinux-140ce28dd3bee8e53acc27f123ae474d69ef66f0.tar.xz
block: add a disk_has_partscan helper
Add a helper to check if partition scanning is enabled instead of open coding the check in a few places. This now always checks for the hidden flag even if all but one of the callers are never reachable for hidden gendisks. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20240502130033.1958492-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/partitions/core.c')
-rw-r--r--block/partitions/core.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index b11e88c82c8c..37b5f92d07fe 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -573,10 +573,7 @@ static int blk_add_partitions(struct gendisk *disk)
struct parsed_partitions *state;
int ret = -EAGAIN, p;
- if (disk->flags & GENHD_FL_NO_PART)
- return 0;
-
- if (test_bit(GD_SUPPRESS_PART_SCAN, &disk->state))
+ if (!disk_has_partscan(disk))
return 0;
state = check_partition(disk);