Преглед на файлове

Btrfs: make sure that we've made everything in pinned tree clean

Since we have two trees for recording pinned extents, we need to go through
both of them to make sure that we've done everything clean.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Liu Bo преди 13 години
родител
ревизия
ed0eaa1498
променени са 1 файла, в които са добавени 11 реда и са изтрити 0 реда
  1. 11 0
      fs/btrfs/disk-io.c

+ 11 - 0
fs/btrfs/disk-io.c

@@ -3557,8 +3557,10 @@ static int btrfs_destroy_pinned_extent(struct btrfs_root *root,
 	u64 start;
 	u64 start;
 	u64 end;
 	u64 end;
 	int ret;
 	int ret;
+	bool loop = true;
 
 
 	unpin = pinned_extents;
 	unpin = pinned_extents;
+again:
 	while (1) {
 	while (1) {
 		ret = find_first_extent_bit(unpin, 0, &start, &end,
 		ret = find_first_extent_bit(unpin, 0, &start, &end,
 					    EXTENT_DIRTY);
 					    EXTENT_DIRTY);
@@ -3576,6 +3578,15 @@ static int btrfs_destroy_pinned_extent(struct btrfs_root *root,
 		cond_resched();
 		cond_resched();
 	}
 	}
 
 
+	if (loop) {
+		if (unpin == &root->fs_info->freed_extents[0])
+			unpin = &root->fs_info->freed_extents[1];
+		else
+			unpin = &root->fs_info->freed_extents[0];
+		loop = false;
+		goto again;
+	}
+
 	return 0;
 	return 0;
 }
 }