summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorMiao Xie2014-09-03 15:35:34 +0200
committerChris Mason2014-09-17 22:38:34 +0200
commitce7213c70c37e3a66bc0b50c45edcbfea505f62f (patch)
tree3b458f3f28ae3d69f508b4bd9194a264f74f6f34 /fs/btrfs/volumes.h
parentBtrfs: fix wrong disk size when writing super blocks (diff)
downloadkernel-qcow2-linux-ce7213c70c37e3a66bc0b50c45edcbfea505f62f.tar.gz
kernel-qcow2-linux-ce7213c70c37e3a66bc0b50c45edcbfea505f62f.tar.xz
kernel-qcow2-linux-ce7213c70c37e3a66bc0b50c45edcbfea505f62f.zip
Btrfs: fix wrong device bytes_used in the super block
device->bytes_used will be changed when allocating a new chunk, and disk_total_size will be changed if resizing is successful. Meanwhile, the on-disk super blocks of the previous transaction might not be updated. Considering the consistency of the metadata in the previous transaction, We should use the size in the previous transaction to check if the super block is beyond the boundary of the device. Though it is not big problem because we don't use it now, but anyway it is better that we make it be consistent with the common metadata, maybe we will use it in the future. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index b30d018fa359..f79d532fedb0 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -95,6 +95,8 @@ struct btrfs_device {
*/
u64 commit_total_bytes;
+ /* bytes used on the current transaction */
+ u64 commit_bytes_used;
/*
* used to manage the device which is resized
*
@@ -420,4 +422,6 @@ static inline void btrfs_dev_stat_reset(struct btrfs_device *dev,
}
void btrfs_update_commit_device_size(struct btrfs_fs_info *fs_info);
+void btrfs_update_commit_device_bytes_used(struct btrfs_root *root,
+ struct btrfs_transaction *transaction);
#endif