diff options
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 314041fdfa43..7503bd46819b 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -938,6 +938,20 @@ int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask) | |||
938 | } | 938 | } |
939 | EXPORT_SYMBOL(lock_extent); | 939 | EXPORT_SYMBOL(lock_extent); |
940 | 940 | ||
941 | int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, | ||
942 | gfp_t mask) | ||
943 | { | ||
944 | int err; | ||
945 | u64 failed_start; | ||
946 | |||
947 | err = set_extent_bit(tree, start, end, EXTENT_LOCKED, 1, | ||
948 | &failed_start, mask); | ||
949 | if (err == -EEXIST) | ||
950 | return 0; | ||
951 | return 1; | ||
952 | } | ||
953 | EXPORT_SYMBOL(try_lock_extent); | ||
954 | |||
941 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, | 955 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, |
942 | gfp_t mask) | 956 | gfp_t mask) |
943 | { | 957 | { |