diff options
author | Stefan Behrens <sbehrens@giantdisaster.de> | 2012-11-05 09:50:14 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2012-12-12 17:15:35 -0500 |
commit | a8a6dab77997a371f1925a4001021eea3ee5cb88 (patch) | |
tree | 6dc4eb0c51673652e01877619cc98fbcd1825778 /fs/btrfs/volumes.c | |
parent | 3ec706c831d4c96905c287013c8228b21619a1d9 (diff) |
Btrfs: add btrfs_scratch_superblock() function
This new function is used by the device replace procedure in
a later patch.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 96bb2e4446aa..6cd8a32c4484 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -5106,3 +5106,21 @@ int btrfs_get_dev_stats(struct btrfs_root *root, | |||
5106 | stats->nr_items = BTRFS_DEV_STAT_VALUES_MAX; | 5106 | stats->nr_items = BTRFS_DEV_STAT_VALUES_MAX; |
5107 | return 0; | 5107 | return 0; |
5108 | } | 5108 | } |
5109 | |||
5110 | int btrfs_scratch_superblock(struct btrfs_device *device) | ||
5111 | { | ||
5112 | struct buffer_head *bh; | ||
5113 | struct btrfs_super_block *disk_super; | ||
5114 | |||
5115 | bh = btrfs_read_dev_super(device->bdev); | ||
5116 | if (!bh) | ||
5117 | return -EINVAL; | ||
5118 | disk_super = (struct btrfs_super_block *)bh->b_data; | ||
5119 | |||
5120 | memset(&disk_super->magic, 0, sizeof(disk_super->magic)); | ||
5121 | set_buffer_dirty(bh); | ||
5122 | sync_dirty_buffer(bh); | ||
5123 | brelse(bh); | ||
5124 | |||
5125 | return 0; | ||
5126 | } | ||