* [PATCH] fix find_free_dev_extent
@ 2009-07-24 6:53 Yan Zheng
0 siblings, 0 replies; only message in thread
From: Yan Zheng @ 2009-07-24 6:53 UTC (permalink / raw)
To: chris Mason, linux-btrfs
find_free_dev_extent does not properly handle the case:
device is not complete free, and there is a free extent
at the beginning of the device.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
---
diff -urp 1/fs/btrfs/volumes.c 2/fs/btrfs/volumes.c
--- 1/fs/btrfs/volumes.c 2009-07-24 09:57:18.679312973 +0800
+++ 2/fs/btrfs/volumes.c 2009-07-24 11:25:19.381057978 +0800
@@ -758,9 +758,13 @@ static noinline int find_free_dev_extent
ret = btrfs_search_slot(trans, root, &key, path, 0, 0);
if (ret < 0)
goto error;
- ret = btrfs_previous_item(root, path, 0, key.type);
- if (ret < 0)
- goto error;
+ if (ret > 0) {
+ ret = btrfs_previous_item(root, path, key.objectid, key.type);
+ if (ret < 0)
+ goto error;
+ if (ret > 0)
+ start_found = 1;
+ }
l = path->nodes[0];
btrfs_item_key_to_cpu(l, &key, path->slots[0]);
while (1) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-07-24 6:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-24 6:53 [PATCH] fix find_free_dev_extent Yan Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox