Skip to content

Commit

Permalink
xfs use fs_holder_ops for the log and RT devices
Browse files Browse the repository at this point in the history
Use the generic fs_holder_ops to shut down the file system when the
log or RT device goes away instead of duplicating the logic.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: "Darrick J. Wong" <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
Christoph Hellwig authored and brauner committed Aug 11, 2023
1 parent 8d945b5 commit 8ffa54e
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions fs/xfs/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,6 @@ xfs_setup_dax_always(
return 0;
}

static void
xfs_bdev_mark_dead(
struct block_device *bdev)
{
xfs_force_shutdown(bdev->bd_holder, SHUTDOWN_DEVICE_REMOVED);
}

static const struct blk_holder_ops xfs_holder_ops = {
.mark_dead = xfs_bdev_mark_dead,
};

STATIC int
xfs_blkdev_get(
xfs_mount_t *mp,
Expand All @@ -396,8 +385,8 @@ xfs_blkdev_get(
{
int error = 0;

*bdevp = blkdev_get_by_path(name, BLK_OPEN_READ | BLK_OPEN_WRITE, mp,
&xfs_holder_ops);
*bdevp = blkdev_get_by_path(name, BLK_OPEN_READ | BLK_OPEN_WRITE,
mp->m_super, &fs_holder_ops);
if (IS_ERR(*bdevp)) {
error = PTR_ERR(*bdevp);
xfs_warn(mp, "Invalid device [%s], error=%d", name, error);
Expand Down Expand Up @@ -529,10 +518,10 @@ xfs_open_devices(
xfs_free_buftarg(mp->m_ddev_targp);
out_close_rtdev:
if (rtdev)
blkdev_put(rtdev, mp);
blkdev_put(rtdev, sb);
out_close_logdev:
if (logdev && logdev != ddev)
blkdev_put(logdev, mp);
blkdev_put(logdev, sb);
goto out_relock;
}

Expand Down

0 comments on commit 8ffa54e

Please sign in to comment.