summaryrefslogtreecommitdiff
path: root/drivers/block/zram
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-03-30 07:29:06 +0200
committerJens Axboe <axboe@kernel.dk>2022-04-18 06:54:09 -0600
commitdbdc1be32591af023db2812706f01e6cd2f42bfc (patch)
treeecdb59b4ebcdc9bb0f1eea5e086aa9ea0e3c733f /drivers/block/zram
parent7a86d6dc1493326feb0d3ce5af2f34401dd3defa (diff)
downloadlwn-dbdc1be32591af023db2812706f01e6cd2f42bfc.tar.gz
lwn-dbdc1be32591af023db2812706f01e6cd2f42bfc.zip
block: add a disk_openers helper
Add a helper that returns the openers for a given gendisk to avoid having drivers poke into disk->part0 to get at this information in a somewhat cumbersome way. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20220330052917.2566582-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/zram')
-rw-r--r--drivers/block/zram/zram_drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 70d4bd662ab6..dc5ac5963377 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1800,7 +1800,7 @@ static ssize_t reset_store(struct device *dev,
mutex_lock(&disk->open_mutex);
/* Do not reset an active device or claimed device */
- if (disk->part0->bd_openers || zram->claim) {
+ if (disk_openers(disk) || zram->claim) {
mutex_unlock(&disk->open_mutex);
return -EBUSY;
}
@@ -1989,7 +1989,7 @@ static int zram_remove(struct zram *zram)
bool claimed;
mutex_lock(&zram->disk->open_mutex);
- if (zram->disk->part0->bd_openers) {
+ if (disk_openers(zram->disk)) {
mutex_unlock(&zram->disk->open_mutex);
return -EBUSY;
}