linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] btrfs: handle failures of set_extent_bits in add_excluded_extent
@ 2018-05-22  9:46 Gu Jinxiang
  2018-05-22  9:46 ` [PATCH 2/2] btrfs: propagate failures of __exclude_logged_extent to upper caller Gu Jinxiang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gu Jinxiang @ 2018-05-22  9:46 UTC (permalink / raw)
  To: linux-btrfs; +Cc: nborisov

set_extent_bits may return 0/-EEXIST, so return the result in
add_excluded_extent.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 75cfb80d2551..2e85e99b5e6f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -215,11 +215,16 @@ static int add_excluded_extent(struct btrfs_fs_info *fs_info,
 			       u64 start, u64 num_bytes)
 {
 	u64 end = start + num_bytes - 1;
-	set_extent_bits(&fs_info->freed_extents[0],
+	int ret = 0;
+
+	ret = set_extent_bits(&fs_info->freed_extents[0],
 			start, end, EXTENT_UPTODATE);
-	set_extent_bits(&fs_info->freed_extents[1],
+	if (ret)
+		goto out;
+	ret = set_extent_bits(&fs_info->freed_extents[1],
 			start, end, EXTENT_UPTODATE);
-	return 0;
+out:
+	return ret;
 }
 
 static void free_excluded_extents(struct btrfs_fs_info *fs_info,
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-22 16:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-22  9:46 [PATCH 1/2] btrfs: handle failures of set_extent_bits in add_excluded_extent Gu Jinxiang
2018-05-22  9:46 ` [PATCH 2/2] btrfs: propagate failures of __exclude_logged_extent to upper caller Gu Jinxiang
2018-05-22 10:51   ` Nikolay Borisov
2018-05-22 16:03   ` David Sterba
2018-05-22 10:51 ` [PATCH 1/2] btrfs: handle failures of set_extent_bits in add_excluded_extent Nikolay Borisov
2018-05-22 15:56 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).