diff options
author | Christoph Hellwig <hch@lst.de> | 2020-11-24 11:54:06 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-12-01 22:53:38 +0100 |
commit | 040f04bd2e825f1d80b14a0e0ac3d830339eb779 (patch) | |
tree | 344a715d906949d20f1131c6f169b26fdb8e6eea /drivers/md/dm.c | |
parent | fs: remove get_super_thawed and get_super_exclusive_thawed (diff) | |
download | linux-040f04bd2e825f1d80b14a0e0ac3d830339eb779.tar.xz linux-040f04bd2e825f1d80b14a0e0ac3d830339eb779.zip |
fs: simplify freeze_bdev/thaw_bdev
Store the frozen superblock in struct block_device to avoid the awkward
interface that can return a sb only used a cookie, an ERR_PTR or NULL.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Chao Yu <yuchao0@huawei.com> [f2fs]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 54739f1b579b..50541d336c71 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2392,27 +2392,19 @@ static int lock_fs(struct mapped_device *md) { int r; - WARN_ON(md->frozen_sb); + WARN_ON(test_bit(DMF_FROZEN, &md->flags)); - md->frozen_sb = freeze_bdev(md->bdev); - if (IS_ERR(md->frozen_sb)) { - r = PTR_ERR(md->frozen_sb); - md->frozen_sb = NULL; - return r; - } - - set_bit(DMF_FROZEN, &md->flags); - - return 0; + r = freeze_bdev(md->bdev); + if (!r) + set_bit(DMF_FROZEN, &md->flags); + return r; } static void unlock_fs(struct mapped_device *md) { if (!test_bit(DMF_FROZEN, &md->flags)) return; - - thaw_bdev(md->bdev, md->frozen_sb); - md->frozen_sb = NULL; + thaw_bdev(md->bdev); clear_bit(DMF_FROZEN, &md->flags); } |