diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-03-10 12:39:20 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-03-10 12:39:20 -0400 |
commit | 4184ea7f908d95f329febc3665cf66da8568b467 (patch) | |
tree | ef16aabf4604c9c1aba23e222ff7fb4510052ebb /fs/btrfs/volumes.c | |
parent | b9447ef80bd301b932ac4d85c9622e929de5fd62 (diff) |
Btrfs: Fix locking around adding new space_info
Storage allocated to different raid levels in btrfs is tracked by
a btrfs_space_info structure, and all of the current space_infos are
collected into a list_head.
Most filesystems have 3 or 4 of these structs total, and the list is
only changed when new raid levels are added or at unmount time.
This commit adds rcu locking on the list head, and properly frees
things at unmount time. It also clears the space_info->full flag
whenever new space is added to the FS.
The locking for the space info list goes like this:
reads: protected by rcu_read_lock()
writes: protected by the chunk_mutex
At unmount time we don't need special locking because all the readers
are gone.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1316139bf9e8..7aa3810d7f69 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1459,6 +1459,8 @@ static int __btrfs_grow_device(struct btrfs_trans_handle *trans, | |||
1459 | device->fs_devices->total_rw_bytes += diff; | 1459 | device->fs_devices->total_rw_bytes += diff; |
1460 | 1460 | ||
1461 | device->total_bytes = new_size; | 1461 | device->total_bytes = new_size; |
1462 | btrfs_clear_space_info_full(device->dev_root->fs_info); | ||
1463 | |||
1462 | return btrfs_update_device(trans, device); | 1464 | return btrfs_update_device(trans, device); |
1463 | } | 1465 | } |
1464 | 1466 | ||