All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Readahead clenups
@ 2017-03-15 16:02 David Sterba
  2017-03-15 16:02 ` [PATCH 1/7] btrfs: preallocate radix tree node for readahead David Sterba
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

I spotted some GFP_NOFS uses in readahead and converted them to GFP_KERNEL with
a few cleanups along the way.

David Sterba (7):
  btrfs: preallocate radix tree node for readahead
  btrfs: use simpler readahead zone lookups
  btrfs: preallocate radix tree node for global readahead tree
  btrfs: remove redundant parameter from btree_readahead_hook
  btrfs: remove redundant parameter from reada_find_zone
  btrfs: remove redundant parameter from reada_start_machine_dev
  btrfs: remove local blocksize variable in reada_find_extent

 fs/btrfs/ctree.h   |  3 +-
 fs/btrfs/disk-io.c |  6 ++--
 fs/btrfs/reada.c   | 89 ++++++++++++++++++++++++++++--------------------------
 fs/btrfs/volumes.c |  2 +-
 4 files changed, 51 insertions(+), 49 deletions(-)

-- 
2.12.0


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

* [PATCH 1/7] btrfs: preallocate radix tree node for readahead
  2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
@ 2017-03-15 16:02 ` David Sterba
  2017-03-20 20:40   ` Liu Bo
  2017-03-15 16:02 ` [PATCH 2/7] btrfs: use simpler readahead zone lookups David Sterba
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We can preallocate the node so insertion does not have to do that under
the lock. The GFP flags for the per-device radix tree are initialized to
 GFP_NOFS & ~__GFP_DIRECT_RECLAIM
but we can use GFP_KERNEL, same as an allocation above anyway, but also
because readahead is optional and not on any critical writeout path.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/reada.c   | 7 +++++++
 fs/btrfs/volumes.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index e88bca87f5d2..fdae8ca79401 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -270,6 +270,12 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
 	if (!zone)
 		return NULL;
 
+	ret = radix_tree_preload(GFP_KERNEL);
+	if (ret) {
+		kfree(zone);
+		return NULL;
+	}
+
 	zone->start = start;
 	zone->end = end;
 	INIT_LIST_HEAD(&zone->list);
@@ -299,6 +305,7 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
 			zone = NULL;
 	}
 	spin_unlock(&fs_info->reada_lock);
+	radix_tree_preload_end();
 
 	return zone;
 }
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 73d56eef5e60..f158b8657ae3 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -247,7 +247,7 @@ static struct btrfs_device *__alloc_device(void)
 	atomic_set(&dev->reada_in_flight, 0);
 	atomic_set(&dev->dev_stats_ccnt, 0);
 	btrfs_device_data_ordered_init(dev);
-	INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
+	INIT_RADIX_TREE(&dev->reada_zones, GFP_KERNEL);
 	INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
 
 	return dev;
-- 
2.12.0


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

* [PATCH 2/7] btrfs: use simpler readahead zone lookups
  2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
  2017-03-15 16:02 ` [PATCH 1/7] btrfs: preallocate radix tree node for readahead David Sterba
@ 2017-03-15 16:02 ` David Sterba
  2017-03-20 20:44   ` Liu Bo
  2017-03-31 17:33   ` David Sterba
  2017-03-15 16:02 ` [PATCH 3/7] btrfs: preallocate radix tree node for global readahead tree David Sterba
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

No point using radix_tree_gang_lookup if we're looking up just one slot.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/reada.c | 52 ++++++++++++++++++++++------------------------------
 1 file changed, 22 insertions(+), 30 deletions(-)

diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index fdae8ca79401..dd78af5d265d 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -246,11 +246,9 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
 	u64 end;
 	int i;
 
-	zone = NULL;
 	spin_lock(&fs_info->reada_lock);
-	ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone,
-				     logical >> PAGE_SHIFT, 1);
-	if (ret == 1 && logical >= zone->start && logical <= zone->end) {
+	zone = radix_tree_lookup(&dev->reada_zones, logical >> PAGE_SHIFT);
+	if (zone && logical >= zone->start && logical <= zone->end) {
 		kref_get(&zone->refcnt);
 		spin_unlock(&fs_info->reada_lock);
 		return zone;
@@ -297,9 +295,9 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
 
 	if (ret == -EEXIST) {
 		kfree(zone);
-		ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone,
-					     logical >> PAGE_SHIFT, 1);
-		if (ret == 1 && logical >= zone->start && logical <= zone->end)
+		zone = radix_tree_lookup(&dev->reada_zones,
+				logical >> PAGE_SHIFT);
+		if (zone && logical >= zone->start && logical <= zone->end)
 			kref_get(&zone->refcnt);
 		else
 			zone = NULL;
@@ -604,7 +602,6 @@ static int reada_pick_zone(struct btrfs_device *dev)
 	u64 top_elems = 0;
 	u64 top_locked_elems = 0;
 	unsigned long index = 0;
-	int ret;
 
 	if (dev->reada_curr_zone) {
 		reada_peer_zones_set_lock(dev->reada_curr_zone, 0);
@@ -615,9 +612,8 @@ static int reada_pick_zone(struct btrfs_device *dev)
 	while (1) {
 		struct reada_zone *zone;
 
-		ret = radix_tree_gang_lookup(&dev->reada_zones,
-					     (void **)&zone, index, 1);
-		if (ret == 0)
+		zone = radix_tree_lookup(&dev->reada_zones, index);
+		if (!zone)
 			break;
 		index = (zone->end >> PAGE_SHIFT) + 1;
 		if (zone->locked) {
@@ -669,19 +665,18 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
 	 * a contiguous block of extents, we could also coagulate them or use
 	 * plugging to speed things up
 	 */
-	ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re,
-				     dev->reada_next >> PAGE_SHIFT, 1);
-	if (ret == 0 || re->logical > dev->reada_curr_zone->end) {
+	re = radix_tree_lookup(&dev->reada_extents,
+			dev->reada_next >> PAGE_SHIFT);
+	if (!re || re->logical > dev->reada_curr_zone->end) {
 		ret = reada_pick_zone(dev);
 		if (!ret) {
 			spin_unlock(&fs_info->reada_lock);
 			return 0;
 		}
-		re = NULL;
-		ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re,
-					dev->reada_next >> PAGE_SHIFT, 1);
+		re = radix_tree_lookup(&dev->reada_extents,
+				dev->reada_next >> PAGE_SHIFT);
 	}
-	if (ret == 0) {
+	if (!re) {
 		spin_unlock(&fs_info->reada_lock);
 		return 0;
 	}
@@ -809,7 +804,6 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
 	struct btrfs_device *device;
 	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
 	unsigned long index;
-	int ret;
 	int i;
 	int j;
 	int cnt;
@@ -821,9 +815,9 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
 		index = 0;
 		while (1) {
 			struct reada_zone *zone;
-			ret = radix_tree_gang_lookup(&device->reada_zones,
-						     (void **)&zone, index, 1);
-			if (ret == 0)
+
+			zone = radix_tree_lookup(&device->reada_zones, index);
+			if (!zone)
 				break;
 			pr_debug("  zone %llu-%llu elems %llu locked %d devs",
 				    zone->start, zone->end, zone->elems,
@@ -841,11 +835,10 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
 		cnt = 0;
 		index = 0;
 		while (all) {
-			struct reada_extent *re = NULL;
+			struct reada_extent *re;
 
-			ret = radix_tree_gang_lookup(&device->reada_extents,
-						     (void **)&re, index, 1);
-			if (ret == 0)
+			re = radix_tree_lookup(&device->reada_extents, index);
+			if (!re)
 				break;
 			pr_debug("  re: logical %llu size %u empty %d scheduled %d",
 				re->logical, fs_info->nodesize,
@@ -870,11 +863,10 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
 	index = 0;
 	cnt = 0;
 	while (all) {
-		struct reada_extent *re = NULL;
+		struct reada_extent *re;
 
-		ret = radix_tree_gang_lookup(&fs_info->reada_tree, (void **)&re,
-					     index, 1);
-		if (ret == 0)
+		re = radix_tree_lookup(&fs_info->reada_tree, index);
+		if (!re)
 			break;
 		if (!re->scheduled) {
 			index = (re->logical >> PAGE_SHIFT) + 1;
-- 
2.12.0


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

* [PATCH 3/7] btrfs: preallocate radix tree node for global readahead tree
  2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
  2017-03-15 16:02 ` [PATCH 1/7] btrfs: preallocate radix tree node for readahead David Sterba
  2017-03-15 16:02 ` [PATCH 2/7] btrfs: use simpler readahead zone lookups David Sterba
@ 2017-03-15 16:02 ` David Sterba
  2017-03-20 20:58   ` Liu Bo
  2017-03-15 16:02 ` [PATCH 4/7] btrfs: remove redundant parameter from btree_readahead_hook David Sterba
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We can preallocate the node so insertion does not have to do that under
the lock. The GFP flags for the global radix tree are initialized to
 GFP_NOFS & ~__GFP_DIRECT_RECLAIM
but we can use GFP_KERNEL, because readahead is optional and not on any
critical writeout path.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c | 2 +-
 fs/btrfs/reada.c   | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 08b74daf35d0..1d4c30327247 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2693,7 +2693,7 @@ int open_ctree(struct super_block *sb,
 	fs_info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
 	fs_info->avg_delayed_ref_runtime = NSEC_PER_SEC >> 6; /* div by 64 */
 	/* readahead state */
-	INIT_RADIX_TREE(&fs_info->reada_tree, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
+	INIT_RADIX_TREE(&fs_info->reada_tree, GFP_KERNEL);
 	spin_lock_init(&fs_info->reada_lock);
 
 	fs_info->thread_pool_size = min_t(unsigned long,
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index dd78af5d265d..4c5a9b241cab 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -391,6 +391,10 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
 		goto error;
 	}
 
+	ret = radix_tree_preload(GFP_KERNEL);
+	if (ret)
+		goto error;
+
 	/* insert extent in reada_tree + all per-device trees, all or nothing */
 	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
 	spin_lock(&fs_info->reada_lock);
@@ -400,13 +404,16 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
 		re_exist->refcnt++;
 		spin_unlock(&fs_info->reada_lock);
 		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+		radix_tree_preload_end();
 		goto error;
 	}
 	if (ret) {
 		spin_unlock(&fs_info->reada_lock);
 		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+		radix_tree_preload_end();
 		goto error;
 	}
+	radix_tree_preload_end();
 	prev_dev = NULL;
 	dev_replace_is_ongoing = btrfs_dev_replace_is_ongoing(
 			&fs_info->dev_replace);
-- 
2.12.0


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

* [PATCH 4/7] btrfs: remove redundant parameter from btree_readahead_hook
  2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
                   ` (2 preceding siblings ...)
  2017-03-15 16:02 ` [PATCH 3/7] btrfs: preallocate radix tree node for global readahead tree David Sterba
@ 2017-03-15 16:02 ` David Sterba
  2017-03-20 21:00   ` Liu Bo
  2017-03-15 16:02 ` [PATCH 5/7] btrfs: remove redundant parameter from reada_find_zone David Sterba
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We can read fs_info from eb.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.h   | 3 +--
 fs/btrfs/disk-io.c | 4 ++--
 fs/btrfs/reada.c   | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 29b7fc28c607..173fac68323a 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3671,8 +3671,7 @@ struct reada_control *btrfs_reada_add(struct btrfs_root *root,
 			      struct btrfs_key *start, struct btrfs_key *end);
 int btrfs_reada_wait(void *handle);
 void btrfs_reada_detach(void *handle);
-int btree_readahead_hook(struct btrfs_fs_info *fs_info,
-			 struct extent_buffer *eb, int err);
+int btree_readahead_hook(struct extent_buffer *eb, int err);
 
 static inline int is_fstree(u64 rootid)
 {
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1d4c30327247..995b28179af9 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -762,7 +762,7 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
 err:
 	if (reads_done &&
 	    test_and_clear_bit(EXTENT_BUFFER_READAHEAD, &eb->bflags))
-		btree_readahead_hook(fs_info, eb, ret);
+		btree_readahead_hook(eb, ret);
 
 	if (ret) {
 		/*
@@ -787,7 +787,7 @@ static int btree_io_failed_hook(struct page *page, int failed_mirror)
 	eb->read_mirror = failed_mirror;
 	atomic_dec(&eb->io_pages);
 	if (test_and_clear_bit(EXTENT_BUFFER_READAHEAD, &eb->bflags))
-		btree_readahead_hook(eb->fs_info, eb, -EIO);
+		btree_readahead_hook(eb, -EIO);
 	return -EIO;	/* we fixed nothing */
 }
 
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 4c5a9b241cab..5edf7328f67d 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -209,9 +209,9 @@ static void __readahead_hook(struct btrfs_fs_info *fs_info,
 	return;
 }
 
-int btree_readahead_hook(struct btrfs_fs_info *fs_info,
-			 struct extent_buffer *eb, int err)
+int btree_readahead_hook(struct extent_buffer *eb, int err)
 {
+	struct btrfs_fs_info *fs_info = eb->fs_info;
 	int ret = 0;
 	struct reada_extent *re;
 
-- 
2.12.0


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

* [PATCH 5/7] btrfs: remove redundant parameter from reada_find_zone
  2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
                   ` (3 preceding siblings ...)
  2017-03-15 16:02 ` [PATCH 4/7] btrfs: remove redundant parameter from btree_readahead_hook David Sterba
@ 2017-03-15 16:02 ` David Sterba
  2017-03-20 21:03   ` Liu Bo
  2017-03-15 16:02 ` [PATCH 6/7] btrfs: remove redundant parameter from reada_start_machine_dev David Sterba
  2017-03-15 16:02 ` [PATCH 7/7] btrfs: remove local blocksize variable in reada_find_extent David Sterba
  6 siblings, 1 reply; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We can read fs_info from dev.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/reada.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 5edf7328f67d..c1fc79cd4b2a 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -235,10 +235,10 @@ int btree_readahead_hook(struct extent_buffer *eb, int err)
 	return ret;
 }
 
-static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
-					  struct btrfs_device *dev, u64 logical,
+static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical,
 					  struct btrfs_bio *bbio)
 {
+	struct btrfs_fs_info *fs_info = dev->fs_info;
 	int ret;
 	struct reada_zone *zone;
 	struct btrfs_block_group_cache *cache = NULL;
@@ -372,7 +372,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
 		 if (!dev->bdev)
 			continue;
 
-		zone = reada_find_zone(fs_info, dev, logical, bbio);
+		zone = reada_find_zone(dev, logical, bbio);
 		if (!zone)
 			continue;
 
-- 
2.12.0


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

* [PATCH 6/7] btrfs: remove redundant parameter from reada_start_machine_dev
  2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
                   ` (4 preceding siblings ...)
  2017-03-15 16:02 ` [PATCH 5/7] btrfs: remove redundant parameter from reada_find_zone David Sterba
@ 2017-03-15 16:02 ` David Sterba
  2017-03-20 21:04   ` Liu Bo
  2017-03-15 16:02 ` [PATCH 7/7] btrfs: remove local blocksize variable in reada_find_extent David Sterba
  6 siblings, 1 reply; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We can read fs_info from dev.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/reada.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index c1fc79cd4b2a..91df381a60ce 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -649,9 +649,9 @@ static int reada_pick_zone(struct btrfs_device *dev)
 	return 1;
 }
 
-static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
-				   struct btrfs_device *dev)
+static int reada_start_machine_dev(struct btrfs_device *dev)
 {
+	struct btrfs_fs_info *fs_info = dev->fs_info;
 	struct reada_extent *re = NULL;
 	int mirror_num = 0;
 	struct extent_buffer *eb = NULL;
@@ -763,8 +763,7 @@ static void __reada_start_machine(struct btrfs_fs_info *fs_info)
 		list_for_each_entry(device, &fs_devices->devices, dev_list) {
 			if (atomic_read(&device->reada_in_flight) <
 			    MAX_IN_FLIGHT)
-				enqueued += reada_start_machine_dev(fs_info,
-								    device);
+				enqueued += reada_start_machine_dev(device);
 		}
 		mutex_unlock(&fs_devices->device_list_mutex);
 		total += enqueued;
-- 
2.12.0


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

* [PATCH 7/7] btrfs: remove local blocksize variable in reada_find_extent
  2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
                   ` (5 preceding siblings ...)
  2017-03-15 16:02 ` [PATCH 6/7] btrfs: remove redundant parameter from reada_start_machine_dev David Sterba
@ 2017-03-15 16:02 ` David Sterba
  2017-03-20 21:04   ` Liu Bo
  6 siblings, 1 reply; 16+ messages in thread
From: David Sterba @ 2017-03-15 16:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The name is misleading and the local variable serves no purpose.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/reada.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 91df381a60ce..64425c3fe4f5 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -318,7 +318,6 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
 	struct btrfs_bio *bbio = NULL;
 	struct btrfs_device *dev;
 	struct btrfs_device *prev_dev;
-	u32 blocksize;
 	u64 length;
 	int real_stripes;
 	int nzones = 0;
@@ -339,7 +338,6 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
 	if (!re)
 		return NULL;
 
-	blocksize = fs_info->nodesize;
 	re->logical = logical;
 	re->top = *top;
 	INIT_LIST_HEAD(&re->extctl);
@@ -349,10 +347,10 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
 	/*
 	 * map block
 	 */
-	length = blocksize;
+	length = fs_info->nodesize;
 	ret = btrfs_map_block(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical,
 			&length, &bbio, 0);
-	if (ret || !bbio || length < blocksize)
+	if (ret || !bbio || length < fs_info->nodesize)
 		goto error;
 
 	if (bbio->num_stripes > BTRFS_MAX_MIRRORS) {
-- 
2.12.0


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

* Re: [PATCH 1/7] btrfs: preallocate radix tree node for readahead
  2017-03-15 16:02 ` [PATCH 1/7] btrfs: preallocate radix tree node for readahead David Sterba
@ 2017-03-20 20:40   ` Liu Bo
  0 siblings, 0 replies; 16+ messages in thread
From: Liu Bo @ 2017-03-20 20:40 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Mar 15, 2017 at 05:02:23PM +0100, David Sterba wrote:
> We can preallocate the node so insertion does not have to do that under
> the lock. The GFP flags for the per-device radix tree are initialized to
>  GFP_NOFS & ~__GFP_DIRECT_RECLAIM
> but we can use GFP_KERNEL, same as an allocation above anyway, but also
> because readahead is optional and not on any critical writeout path.
> 
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/reada.c   | 7 +++++++
>  fs/btrfs/volumes.c | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index e88bca87f5d2..fdae8ca79401 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -270,6 +270,12 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
>  	if (!zone)
>  		return NULL;
>  
> +	ret = radix_tree_preload(GFP_KERNEL);
> +	if (ret) {
> +		kfree(zone);
> +		return NULL;
> +	}
> +
>  	zone->start = start;
>  	zone->end = end;
>  	INIT_LIST_HEAD(&zone->list);
> @@ -299,6 +305,7 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
>  			zone = NULL;
>  	}
>  	spin_unlock(&fs_info->reada_lock);
> +	radix_tree_preload_end();
>  
>  	return zone;
>  }
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 73d56eef5e60..f158b8657ae3 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -247,7 +247,7 @@ static struct btrfs_device *__alloc_device(void)
>  	atomic_set(&dev->reada_in_flight, 0);
>  	atomic_set(&dev->dev_stats_ccnt, 0);
>  	btrfs_device_data_ordered_init(dev);
> -	INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
> +	INIT_RADIX_TREE(&dev->reada_zones, GFP_KERNEL);
>  	INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
>  
>  	return dev;
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/7] btrfs: use simpler readahead zone lookups
  2017-03-15 16:02 ` [PATCH 2/7] btrfs: use simpler readahead zone lookups David Sterba
@ 2017-03-20 20:44   ` Liu Bo
  2017-03-31 17:33   ` David Sterba
  1 sibling, 0 replies; 16+ messages in thread
From: Liu Bo @ 2017-03-20 20:44 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Mar 15, 2017 at 05:02:26PM +0100, David Sterba wrote:
> No point using radix_tree_gang_lookup if we're looking up just one slot.
> 
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/reada.c | 52 ++++++++++++++++++++++------------------------------
>  1 file changed, 22 insertions(+), 30 deletions(-)
> 
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index fdae8ca79401..dd78af5d265d 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -246,11 +246,9 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
>  	u64 end;
>  	int i;
>  
> -	zone = NULL;
>  	spin_lock(&fs_info->reada_lock);
> -	ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone,
> -				     logical >> PAGE_SHIFT, 1);
> -	if (ret == 1 && logical >= zone->start && logical <= zone->end) {
> +	zone = radix_tree_lookup(&dev->reada_zones, logical >> PAGE_SHIFT);
> +	if (zone && logical >= zone->start && logical <= zone->end) {
>  		kref_get(&zone->refcnt);
>  		spin_unlock(&fs_info->reada_lock);
>  		return zone;
> @@ -297,9 +295,9 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
>  
>  	if (ret == -EEXIST) {
>  		kfree(zone);
> -		ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone,
> -					     logical >> PAGE_SHIFT, 1);
> -		if (ret == 1 && logical >= zone->start && logical <= zone->end)
> +		zone = radix_tree_lookup(&dev->reada_zones,
> +				logical >> PAGE_SHIFT);
> +		if (zone && logical >= zone->start && logical <= zone->end)
>  			kref_get(&zone->refcnt);
>  		else
>  			zone = NULL;
> @@ -604,7 +602,6 @@ static int reada_pick_zone(struct btrfs_device *dev)
>  	u64 top_elems = 0;
>  	u64 top_locked_elems = 0;
>  	unsigned long index = 0;
> -	int ret;
>  
>  	if (dev->reada_curr_zone) {
>  		reada_peer_zones_set_lock(dev->reada_curr_zone, 0);
> @@ -615,9 +612,8 @@ static int reada_pick_zone(struct btrfs_device *dev)
>  	while (1) {
>  		struct reada_zone *zone;
>  
> -		ret = radix_tree_gang_lookup(&dev->reada_zones,
> -					     (void **)&zone, index, 1);
> -		if (ret == 0)
> +		zone = radix_tree_lookup(&dev->reada_zones, index);
> +		if (!zone)
>  			break;
>  		index = (zone->end >> PAGE_SHIFT) + 1;
>  		if (zone->locked) {
> @@ -669,19 +665,18 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
>  	 * a contiguous block of extents, we could also coagulate them or use
>  	 * plugging to speed things up
>  	 */
> -	ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re,
> -				     dev->reada_next >> PAGE_SHIFT, 1);
> -	if (ret == 0 || re->logical > dev->reada_curr_zone->end) {
> +	re = radix_tree_lookup(&dev->reada_extents,
> +			dev->reada_next >> PAGE_SHIFT);
> +	if (!re || re->logical > dev->reada_curr_zone->end) {
>  		ret = reada_pick_zone(dev);
>  		if (!ret) {
>  			spin_unlock(&fs_info->reada_lock);
>  			return 0;
>  		}
> -		re = NULL;
> -		ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re,
> -					dev->reada_next >> PAGE_SHIFT, 1);
> +		re = radix_tree_lookup(&dev->reada_extents,
> +				dev->reada_next >> PAGE_SHIFT);
>  	}
> -	if (ret == 0) {
> +	if (!re) {
>  		spin_unlock(&fs_info->reada_lock);
>  		return 0;
>  	}
> @@ -809,7 +804,6 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
>  	struct btrfs_device *device;
>  	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
>  	unsigned long index;
> -	int ret;
>  	int i;
>  	int j;
>  	int cnt;
> @@ -821,9 +815,9 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
>  		index = 0;
>  		while (1) {
>  			struct reada_zone *zone;
> -			ret = radix_tree_gang_lookup(&device->reada_zones,
> -						     (void **)&zone, index, 1);
> -			if (ret == 0)
> +
> +			zone = radix_tree_lookup(&device->reada_zones, index);
> +			if (!zone)
>  				break;
>  			pr_debug("  zone %llu-%llu elems %llu locked %d devs",
>  				    zone->start, zone->end, zone->elems,
> @@ -841,11 +835,10 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
>  		cnt = 0;
>  		index = 0;
>  		while (all) {
> -			struct reada_extent *re = NULL;
> +			struct reada_extent *re;
>  
> -			ret = radix_tree_gang_lookup(&device->reada_extents,
> -						     (void **)&re, index, 1);
> -			if (ret == 0)
> +			re = radix_tree_lookup(&device->reada_extents, index);
> +			if (!re)
>  				break;
>  			pr_debug("  re: logical %llu size %u empty %d scheduled %d",
>  				re->logical, fs_info->nodesize,
> @@ -870,11 +863,10 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
>  	index = 0;
>  	cnt = 0;
>  	while (all) {
> -		struct reada_extent *re = NULL;
> +		struct reada_extent *re;
>  
> -		ret = radix_tree_gang_lookup(&fs_info->reada_tree, (void **)&re,
> -					     index, 1);
> -		if (ret == 0)
> +		re = radix_tree_lookup(&fs_info->reada_tree, index);
> +		if (!re)
>  			break;
>  		if (!re->scheduled) {
>  			index = (re->logical >> PAGE_SHIFT) + 1;
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/7] btrfs: preallocate radix tree node for global readahead tree
  2017-03-15 16:02 ` [PATCH 3/7] btrfs: preallocate radix tree node for global readahead tree David Sterba
@ 2017-03-20 20:58   ` Liu Bo
  0 siblings, 0 replies; 16+ messages in thread
From: Liu Bo @ 2017-03-20 20:58 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Mar 15, 2017 at 05:02:30PM +0100, David Sterba wrote:
> We can preallocate the node so insertion does not have to do that under
> the lock. The GFP flags for the global radix tree are initialized to
>  GFP_NOFS & ~__GFP_DIRECT_RECLAIM
> but we can use GFP_KERNEL, because readahead is optional and not on any
> critical writeout path.
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> 
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/disk-io.c | 2 +-
>  fs/btrfs/reada.c   | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 08b74daf35d0..1d4c30327247 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -2693,7 +2693,7 @@ int open_ctree(struct super_block *sb,
>  	fs_info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
>  	fs_info->avg_delayed_ref_runtime = NSEC_PER_SEC >> 6; /* div by 64 */
>  	/* readahead state */
> -	INIT_RADIX_TREE(&fs_info->reada_tree, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
> +	INIT_RADIX_TREE(&fs_info->reada_tree, GFP_KERNEL);
>  	spin_lock_init(&fs_info->reada_lock);
>  
>  	fs_info->thread_pool_size = min_t(unsigned long,
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index dd78af5d265d..4c5a9b241cab 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -391,6 +391,10 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
>  		goto error;
>  	}
>  
> +	ret = radix_tree_preload(GFP_KERNEL);
> +	if (ret)
> +		goto error;
> +
>  	/* insert extent in reada_tree + all per-device trees, all or nothing */
>  	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
>  	spin_lock(&fs_info->reada_lock);
> @@ -400,13 +404,16 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
>  		re_exist->refcnt++;
>  		spin_unlock(&fs_info->reada_lock);
>  		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
> +		radix_tree_preload_end();
>  		goto error;
>  	}
>  	if (ret) {
>  		spin_unlock(&fs_info->reada_lock);
>  		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
> +		radix_tree_preload_end();
>  		goto error;
>  	}
> +	radix_tree_preload_end();
>  	prev_dev = NULL;
>  	dev_replace_is_ongoing = btrfs_dev_replace_is_ongoing(
>  			&fs_info->dev_replace);
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 4/7] btrfs: remove redundant parameter from btree_readahead_hook
  2017-03-15 16:02 ` [PATCH 4/7] btrfs: remove redundant parameter from btree_readahead_hook David Sterba
@ 2017-03-20 21:00   ` Liu Bo
  0 siblings, 0 replies; 16+ messages in thread
From: Liu Bo @ 2017-03-20 21:00 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Mar 15, 2017 at 05:02:33PM +0100, David Sterba wrote:
> We can read fs_info from eb.
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> 
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/ctree.h   | 3 +--
>  fs/btrfs/disk-io.c | 4 ++--
>  fs/btrfs/reada.c   | 4 ++--
>  3 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 29b7fc28c607..173fac68323a 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -3671,8 +3671,7 @@ struct reada_control *btrfs_reada_add(struct btrfs_root *root,
>  			      struct btrfs_key *start, struct btrfs_key *end);
>  int btrfs_reada_wait(void *handle);
>  void btrfs_reada_detach(void *handle);
> -int btree_readahead_hook(struct btrfs_fs_info *fs_info,
> -			 struct extent_buffer *eb, int err);
> +int btree_readahead_hook(struct extent_buffer *eb, int err);
>  
>  static inline int is_fstree(u64 rootid)
>  {
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 1d4c30327247..995b28179af9 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -762,7 +762,7 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
>  err:
>  	if (reads_done &&
>  	    test_and_clear_bit(EXTENT_BUFFER_READAHEAD, &eb->bflags))
> -		btree_readahead_hook(fs_info, eb, ret);
> +		btree_readahead_hook(eb, ret);
>  
>  	if (ret) {
>  		/*
> @@ -787,7 +787,7 @@ static int btree_io_failed_hook(struct page *page, int failed_mirror)
>  	eb->read_mirror = failed_mirror;
>  	atomic_dec(&eb->io_pages);
>  	if (test_and_clear_bit(EXTENT_BUFFER_READAHEAD, &eb->bflags))
> -		btree_readahead_hook(eb->fs_info, eb, -EIO);
> +		btree_readahead_hook(eb, -EIO);
>  	return -EIO;	/* we fixed nothing */
>  }
>  
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index 4c5a9b241cab..5edf7328f67d 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -209,9 +209,9 @@ static void __readahead_hook(struct btrfs_fs_info *fs_info,
>  	return;
>  }
>  
> -int btree_readahead_hook(struct btrfs_fs_info *fs_info,
> -			 struct extent_buffer *eb, int err)
> +int btree_readahead_hook(struct extent_buffer *eb, int err)
>  {
> +	struct btrfs_fs_info *fs_info = eb->fs_info;
>  	int ret = 0;
>  	struct reada_extent *re;
>  
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 5/7] btrfs: remove redundant parameter from reada_find_zone
  2017-03-15 16:02 ` [PATCH 5/7] btrfs: remove redundant parameter from reada_find_zone David Sterba
@ 2017-03-20 21:03   ` Liu Bo
  0 siblings, 0 replies; 16+ messages in thread
From: Liu Bo @ 2017-03-20 21:03 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Mar 15, 2017 at 05:02:36PM +0100, David Sterba wrote:
> We can read fs_info from dev.
> 
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/reada.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index 5edf7328f67d..c1fc79cd4b2a 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -235,10 +235,10 @@ int btree_readahead_hook(struct extent_buffer *eb, int err)
>  	return ret;
>  }
>  
> -static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
> -					  struct btrfs_device *dev, u64 logical,
> +static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical,
>  					  struct btrfs_bio *bbio)
>  {
> +	struct btrfs_fs_info *fs_info = dev->fs_info;
>  	int ret;
>  	struct reada_zone *zone;
>  	struct btrfs_block_group_cache *cache = NULL;
> @@ -372,7 +372,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
>  		 if (!dev->bdev)
>  			continue;
>  
> -		zone = reada_find_zone(fs_info, dev, logical, bbio);
> +		zone = reada_find_zone(dev, logical, bbio);
>  		if (!zone)
>  			continue;
>  
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 6/7] btrfs: remove redundant parameter from reada_start_machine_dev
  2017-03-15 16:02 ` [PATCH 6/7] btrfs: remove redundant parameter from reada_start_machine_dev David Sterba
@ 2017-03-20 21:04   ` Liu Bo
  0 siblings, 0 replies; 16+ messages in thread
From: Liu Bo @ 2017-03-20 21:04 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Mar 15, 2017 at 05:02:39PM +0100, David Sterba wrote:
> We can read fs_info from dev.
> 
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/reada.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index c1fc79cd4b2a..91df381a60ce 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -649,9 +649,9 @@ static int reada_pick_zone(struct btrfs_device *dev)
>  	return 1;
>  }
>  
> -static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
> -				   struct btrfs_device *dev)
> +static int reada_start_machine_dev(struct btrfs_device *dev)
>  {
> +	struct btrfs_fs_info *fs_info = dev->fs_info;
>  	struct reada_extent *re = NULL;
>  	int mirror_num = 0;
>  	struct extent_buffer *eb = NULL;
> @@ -763,8 +763,7 @@ static void __reada_start_machine(struct btrfs_fs_info *fs_info)
>  		list_for_each_entry(device, &fs_devices->devices, dev_list) {
>  			if (atomic_read(&device->reada_in_flight) <
>  			    MAX_IN_FLIGHT)
> -				enqueued += reada_start_machine_dev(fs_info,
> -								    device);
> +				enqueued += reada_start_machine_dev(device);
>  		}
>  		mutex_unlock(&fs_devices->device_list_mutex);
>  		total += enqueued;
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 7/7] btrfs: remove local blocksize variable in reada_find_extent
  2017-03-15 16:02 ` [PATCH 7/7] btrfs: remove local blocksize variable in reada_find_extent David Sterba
@ 2017-03-20 21:04   ` Liu Bo
  0 siblings, 0 replies; 16+ messages in thread
From: Liu Bo @ 2017-03-20 21:04 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Mar 15, 2017 at 05:02:42PM +0100, David Sterba wrote:
> The name is misleading and the local variable serves no purpose.
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> 
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/reada.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index 91df381a60ce..64425c3fe4f5 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -318,7 +318,6 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
>  	struct btrfs_bio *bbio = NULL;
>  	struct btrfs_device *dev;
>  	struct btrfs_device *prev_dev;
> -	u32 blocksize;
>  	u64 length;
>  	int real_stripes;
>  	int nzones = 0;
> @@ -339,7 +338,6 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
>  	if (!re)
>  		return NULL;
>  
> -	blocksize = fs_info->nodesize;
>  	re->logical = logical;
>  	re->top = *top;
>  	INIT_LIST_HEAD(&re->extctl);
> @@ -349,10 +347,10 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
>  	/*
>  	 * map block
>  	 */
> -	length = blocksize;
> +	length = fs_info->nodesize;
>  	ret = btrfs_map_block(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical,
>  			&length, &bbio, 0);
> -	if (ret || !bbio || length < blocksize)
> +	if (ret || !bbio || length < fs_info->nodesize)
>  		goto error;
>  
>  	if (bbio->num_stripes > BTRFS_MAX_MIRRORS) {
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/7] btrfs: use simpler readahead zone lookups
  2017-03-15 16:02 ` [PATCH 2/7] btrfs: use simpler readahead zone lookups David Sterba
  2017-03-20 20:44   ` Liu Bo
@ 2017-03-31 17:33   ` David Sterba
  1 sibling, 0 replies; 16+ messages in thread
From: David Sterba @ 2017-03-31 17:33 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, bo.li.liu

On Wed, Mar 15, 2017 at 05:02:26PM +0100, David Sterba wrote:
> No point using radix_tree_gang_lookup if we're looking up just one slot.
> 
> Signed-off-by: David Sterba <dsterba@suse.com>

I've bisected to this patch, causes a hang in btrfs/011. I'll revert it
for until I find out the cause.

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

end of thread, other threads:[~2017-03-31 17:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15 16:02 [PATCH 0/7] Readahead clenups David Sterba
2017-03-15 16:02 ` [PATCH 1/7] btrfs: preallocate radix tree node for readahead David Sterba
2017-03-20 20:40   ` Liu Bo
2017-03-15 16:02 ` [PATCH 2/7] btrfs: use simpler readahead zone lookups David Sterba
2017-03-20 20:44   ` Liu Bo
2017-03-31 17:33   ` David Sterba
2017-03-15 16:02 ` [PATCH 3/7] btrfs: preallocate radix tree node for global readahead tree David Sterba
2017-03-20 20:58   ` Liu Bo
2017-03-15 16:02 ` [PATCH 4/7] btrfs: remove redundant parameter from btree_readahead_hook David Sterba
2017-03-20 21:00   ` Liu Bo
2017-03-15 16:02 ` [PATCH 5/7] btrfs: remove redundant parameter from reada_find_zone David Sterba
2017-03-20 21:03   ` Liu Bo
2017-03-15 16:02 ` [PATCH 6/7] btrfs: remove redundant parameter from reada_start_machine_dev David Sterba
2017-03-20 21:04   ` Liu Bo
2017-03-15 16:02 ` [PATCH 7/7] btrfs: remove local blocksize variable in reada_find_extent David Sterba
2017-03-20 21:04   ` Liu Bo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.