summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2021-05-12 19:59:37 +0200
committerIngo Molnar <mingo@kernel.org>2021-05-12 19:59:37 +0200
commit6f0d271d21c5dc12b78cc7d8b241a5acbca5589f (patch)
tree1d8992505405f69d08bdc3d5e24f3ee200c30ffb /fs/btrfs/extent-tree.c
parent1bc67873d401e6c2e6e30be7fef21337db07a042 (diff)
parent88b06399c9c766c283e070b022b5ceafa4f63f19 (diff)
downloadlinux-6f0d271d21c5dc12b78cc7d8b241a5acbca5589f.tar.gz
linux-6f0d271d21c5dc12b78cc7d8b241a5acbca5589f.tar.bz2
linux-6f0d271d21c5dc12b78cc7d8b241a5acbca5589f.zip
Merge branch 'linus' into x86/cleanups, to pick up dependent commits
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 7a28314189b4..f1d15b68994a 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1340,12 +1340,16 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
stripe = bbio->stripes;
for (i = 0; i < bbio->num_stripes; i++, stripe++) {
u64 bytes;
+ struct btrfs_device *device = stripe->dev;
- if (!stripe->dev->bdev) {
+ if (!device->bdev) {
ASSERT(btrfs_test_opt(fs_info, DEGRADED));
continue;
}
+ if (!test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state))
+ continue;
+
ret = do_discard_extent(stripe, &bytes);
if (!ret) {
discarded_bytes += bytes;