Skip to contentSkip to conversation

btrfs: break up extent_io.c a little bit

PATCH In review Josef Bacik 2 participants 15 messages Sep 23, 2019 – Sep 24, 2019 Btrfs file system

lore
Share & tools
lore
#0 lore raw

v3 cover btrfs: break up extent_io.c a little bit

v1->v2:
- renamed find_delalloc_range to btrfs_find_delalloc_range for now.

-- Original email --

Currently extent_io.c includes all of the extent-io-tree code, the extent buffer code, the code to do IO on extent buffers and data extents, as well as a bunch of other random stuff. The random stuff just needs to be cleaned up, and is probably too invasive for this point in the development cycle. Instead I simply tackled moving the big obvious things out into their own files. I will follow up with cleanups for the rest of the stuff, but those can probably wait until the next cycle as they are going to be slightly more risky. As usual I didn't try to change anything, I simply moved code around. Any time I needed to make actual changes to functions I made a separate patch for that work, so for example breaking up the init/exit functions for extent-io-tree. Everything else is purely cut and paste into new files. The diffstat is as follows

 fs/btrfs/Makefile         |    3 +-
 fs/btrfs/ctree.h          |    3 +-
 fs/btrfs/disk-io.h        |    2 +
 fs/btrfs/extent-buffer.c  | 1266 ++++++++
 fs/btrfs/extent-buffer.h  |  152 +
 fs/btrfs/extent-io-tree.c | 1955 ++++++++++++
 fs/btrfs/extent-io-tree.h |  248 ++
 fs/btrfs/extent_io.c      | 7555 +++++++++++++--------------------------------
 fs/btrfs/extent_io.h      |  372 +--
 fs/btrfs/super.c          |   16 +-
 10 files changed, 5843 insertions(+), 5729 deletions(-)

Thanks,

Josef

#1 lore raw

PATCH v3 1/9 btrfs: separate out the extent leak code

We check both extent buffer and extent state leaks in the same function, separate these two functions out so we can move them around.

---
 fs/btrfs/extent_io.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)
fs/btrfs/extent_io.c +19 -12
index 4dc5e6939856..8db378fa14da 100644
@@ -60,11 +60,24 @@ void btrfs_leak_debug_del(struct list_head *entry)
 }
 
 static inline
-void btrfs_leak_debug_check(void)
+void btrfs_extent_buffer_leak_debug_check(void)
 {
-	struct extent_state *state;
 	struct extent_buffer *eb;
 
+	while (!list_empty(&buffers)) {
+		eb = list_entry(buffers.next, struct extent_buffer, leak_list);
+		pr_err("BTRFS: buffer leak start %llu len %lu refs %d bflags %lu\n",
+		       eb->start, eb->len, atomic_read(&eb->refs), eb->bflags);
+		list_del(&eb->leak_list);
+		kmem_cache_free(extent_buffer_cache, eb);
+	}
+}
+
+static inline
+void btrfs_extent_state_leak_debug_check(void)
+{
+	struct extent_state *state;
+
 	while (!list_empty(&states)) {
 		state = list_entry(states.next, struct extent_state, leak_list);
 		pr_err("BTRFS: state leak: start %llu end %llu state %u in tree %d refs %d\n",
@@ -74,14 +87,6 @@ void btrfs_leak_debug_check(void)
 		list_del(&state->leak_list);
 		kmem_cache_free(extent_state_cache, state);
 	}
-
-	while (!list_empty(&buffers)) {
-		eb = list_entry(buffers.next, struct extent_buffer, leak_list);
-		pr_err("BTRFS: buffer leak start %llu len %lu refs %d bflags %lu\n",
-		       eb->start, eb->len, atomic_read(&eb->refs), eb->bflags);
-		list_del(&eb->leak_list);
-		kmem_cache_free(extent_buffer_cache, eb);
-	}
 }
 
 #define btrfs_debug_check_extent_io_range(tree, start, end)		\
@@ -105,7 +110,8 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller,
 #else
 #define btrfs_leak_debug_add(new, head)	do {} while (0)
 #define btrfs_leak_debug_del(entry)	do {} while (0)
-#define btrfs_leak_debug_check()	do {} while (0)
+#define btrfs_extent_buffer_leak_debug_check()	do {} while (0)
+#define btrfs_extent_state_leak_debug_check()	do {} while (0)
 #define btrfs_debug_check_extent_io_range(c, s, e)	do {} while (0)
 #endif
 
@@ -235,7 +241,8 @@ int __init extent_io_init(void)
 
 void __cold extent_io_exit(void)
 {
-	btrfs_leak_debug_check();
+	btrfs_extent_buffer_leak_debug_check();
+	btrfs_extent_state_leak_debug_check();
 
 	/*
 	 * Make sure all delayed rcu free are flushed before we
Signature · 1 line
2.21.0
#2 lore raw

PATCH v3 2/9 btrfs: separate out the extent io init function

In reply to Josef Bacik

We are moving extent_io_tree into it's on file, so separate out the extent_state init stuff from extent_io_tree_init().

---
 fs/btrfs/extent_io.c | 18 +++++++++++-------
 fs/btrfs/extent_io.h |  2 ++
 fs/btrfs/super.c     |  9 ++++++++-
 3 files changed, 21 insertions(+), 8 deletions(-)
fs/btrfs/extent_io.c +11 -7
index 8db378fa14da..ca763b99aa27 100644
@@ -202,19 +202,23 @@ static int __must_check flush_write_bio(struct extent_page_data *epd)
 	return ret;
 }
 
-int __init extent_io_init(void)
+int __init extent_state_cache_init(void)
 {
 	extent_state_cache = kmem_cache_create("btrfs_extent_state",
 			sizeof(struct extent_state), 0,
 			SLAB_MEM_SPREAD, NULL);
 	if (!extent_state_cache)
 		return -ENOMEM;
+	return 0;
+}
 
+int __init extent_io_init(void)
+{
 	extent_buffer_cache = kmem_cache_create("btrfs_extent_buffer",
 			sizeof(struct extent_buffer), 0,
 			SLAB_MEM_SPREAD, NULL);
 	if (!extent_buffer_cache)
-		goto free_state_cache;
+		return -ENOMEM;
 
 	if (bioset_init(&btrfs_bioset, BIO_POOL_SIZE,
 			offsetof(struct btrfs_io_bio, bio),
@@ -232,24 +236,24 @@ int __init extent_io_init(void)
 free_buffer_cache:
 	kmem_cache_destroy(extent_buffer_cache);
 	extent_buffer_cache = NULL;
+	return -ENOMEM;
+}
 
-free_state_cache:
+void __cold extent_state_cache_exit(void)
+{
+	btrfs_extent_state_leak_debug_check();
 	kmem_cache_destroy(extent_state_cache);
-	extent_state_cache = NULL;
-	return -ENOMEM;
 }
 
 void __cold extent_io_exit(void)
 {
 	btrfs_extent_buffer_leak_debug_check();
-	btrfs_extent_state_leak_debug_check();
 
 	/*
 	 * Make sure all delayed rcu free are flushed before we
 	 * destroy caches.
 	 */
 	rcu_barrier();
-	kmem_cache_destroy(extent_state_cache);
 	kmem_cache_destroy(extent_buffer_cache);
 	bioset_exit(&btrfs_bioset);
 }
fs/btrfs/extent_io.h +2 -0
index cf3424d58fec..e813f593202d 100644
@@ -556,4 +556,6 @@ bool find_lock_delalloc_range(struct inode *inode,
 struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
 					       u64 start);
 
+int __init extent_state_cache_init(void);
+void __cold extent_state_cache_exit(void);
 #endif
fs/btrfs/super.c +8 -1
index 1b151af25772..843015b9a11e 100644
@@ -2360,10 +2360,14 @@ static int __init init_btrfs_fs(void)
 	if (err)
 		goto free_cachep;
 
-	err = extent_map_init();
+	err = extent_state_cache_init();
 	if (err)
 		goto free_extent_io;
 
+	err = extent_map_init();
+	if (err)
+		goto free_extent_state_cache;
+
 	err = ordered_data_init();
 	if (err)
 		goto free_extent_map;
@@ -2422,6 +2426,8 @@ static int __init init_btrfs_fs(void)
 	ordered_data_exit();
 free_extent_map:
 	extent_map_exit();
+free_extent_state_cache:
+	extent_state_cache_exit();
 free_extent_io:
 	extent_io_exit();
 free_cachep:
@@ -2442,6 +2448,7 @@ static void __exit exit_btrfs_fs(void)
 	btrfs_prelim_ref_exit();
 	ordered_data_exit();
 	extent_map_exit();
+	extent_state_cache_exit();
 	extent_io_exit();
 	btrfs_interface_exit();
 	btrfs_end_io_wq_exit();
Signature · 1 line
2.21.0
#3 lore raw

PATCH v3 3/9 btrfs: move extent_io_tree defs to their own header

In reply to Josef Bacik

extent_io.c/h are huge, encompassing a bunch of different things. The extent_io_tree code can live on its own, so separate this out.

---
 fs/btrfs/ctree.h          |   1 +
 fs/btrfs/extent-io-tree.h | 227 ++++++++++++++++++++++++++++++++++++++
 fs/btrfs/extent_io.c      |   1 +
 fs/btrfs/extent_io.h      | 217 +-----------------------------------
 4 files changed, 230 insertions(+), 216 deletions(-)
 create mode 100644 fs/btrfs/extent-io-tree.h
fs/btrfs/ctree.h +1 -0
index 19d669d12ca1..5e7ff169683c 100644
@@ -28,6 +28,7 @@
 #include <linux/dynamic_debug.h>
 #include <linux/refcount.h>
 #include <linux/crc32c.h>
+#include "extent-io-tree.h"
 #include "extent_io.h"
 #include "extent_map.h"
 #include "async-thread.h"
fs/btrfs/extent-io-tree.h new file +227 -0

227 lines not on this page · raw message

fs/btrfs/extent_io.c +1 -0
index ca763b99aa27..577b920ed4b9 100644
@@ -14,6 +14,7 @@
 #include <linux/prefetch.h>
 #include <linux/cleancache.h>
 #include "extent_io.h"
+#include "extent-io-tree.h"
 #include "extent_map.h"
 #include "ctree.h"
 #include "btrfs_inode.h"
fs/btrfs/extent_io.h +1 -216

254 lines not on this page · raw message

Signature · 1 line
2.21.0
#4 lore raw

PATCH v3 4/9 btrfs: export find_delalloc_range

In reply to Josef Bacik

This utilizes internal stuff to the extent_io_tree, so we need to export it before we move it.

---
 fs/btrfs/extent-io-tree.h |  3 +++
 fs/btrfs/extent_io.c      | 10 +++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
fs/btrfs/extent-io-tree.h +3 -0
index 6f53387445ca..02fbb0d4fa88 100644
@@ -223,5 +223,8 @@ void find_first_clear_extent_bit(struct extent_io_tree *tree, u64 start,
 				 u64 *start_ret, u64 *end_ret, unsigned bits);
 int extent_invalidatepage(struct extent_io_tree *tree,
 			  struct page *page, unsigned long offset);
+bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
+			       u64 *end, u64 max_bytes,
+			       struct extent_state **cached_state);
 
 #endif /* BTRFS_EXTENT_IO_TREE_H */
fs/btrfs/extent_io.c +5 -5
index 577b920ed4b9..690e1ac0b54d 100644
@@ -1688,9 +1688,9 @@ void find_first_clear_extent_bit(struct extent_io_tree *tree, u64 start,
  *
  * true is returned if we find something, false if nothing was in the tree
  */
-static noinline bool find_delalloc_range(struct extent_io_tree *tree,
-					u64 *start, u64 *end, u64 max_bytes,
-					struct extent_state **cached_state)
+bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
+			       u64 *end, u64 max_bytes,
+			       struct extent_state **cached_state)
 {
 	struct rb_node *node;
 	struct extent_state *state;
@@ -1808,8 +1808,8 @@ noinline_for_stack bool find_lock_delalloc_range(struct inode *inode,
 	/* step one, find a bunch of delalloc bytes starting at start */
 	delalloc_start = *start;
 	delalloc_end = 0;
-	found = find_delalloc_range(tree, &delalloc_start, &delalloc_end,
-				    max_bytes, &cached_state);
+	found = btrfs_find_delalloc_range(tree, &delalloc_start, &delalloc_end,
+					  max_bytes, &cached_state);
 	if (!found || delalloc_end <= *start) {
 		*start = delalloc_start;
 		*end = delalloc_end;
Signature · 1 line
2.21.0
#5 lore raw

PATCH v3 5/9 btrfs: move the failrec tree stuff into extent-io-tree.h

In reply to Josef Bacik

This needs to be cleaned up in the future, but for now it belongs to the extent-io-tree stuff since it uses the internal tree search code. Needed to export get_state_failrec and set_state_failrec as well since we're not going to move the actual IO part of the failrec stuff out at this point.

---
 fs/btrfs/extent-io-tree.h | 18 ++++++++++++++++++
 fs/btrfs/extent_io.c      |  8 ++++----
 fs/btrfs/extent_io.h      | 11 -----------
 3 files changed, 22 insertions(+), 15 deletions(-)
fs/btrfs/extent-io-tree.h +18 -0
index 02fbb0d4fa88..0ba3222ee1f0 100644
@@ -4,6 +4,7 @@
 #define BTRFS_EXTENT_IO_TREE_H
 
 struct extent_changeset;
+struct io_failure_record;
 
 /* bits for the extent state */
 #define EXTENT_DIRTY		(1U << 0)
@@ -227,4 +228,21 @@ bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
 			       u64 *end, u64 max_bytes,
 			       struct extent_state **cached_state);
 
+/* This should be reworked in the future and put elsewhere. */
+int get_state_failrec(struct extent_io_tree *tree, u64 start,
+		      struct io_failure_record **failrec);
+int set_state_failrec(struct extent_io_tree *tree, u64 start,
+		      struct io_failure_record *failrec);
+void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start,
+		u64 end);
+int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
+				struct io_failure_record **failrec_ret);
+int free_io_failure(struct extent_io_tree *failure_tree,
+		    struct extent_io_tree *io_tree,
+		    struct io_failure_record *rec);
+int clean_io_failure(struct btrfs_fs_info *fs_info,
+		     struct extent_io_tree *failure_tree,
+		     struct extent_io_tree *io_tree, u64 start,
+		     struct page *page, u64 ino, unsigned int pg_offset);
+
 #endif /* BTRFS_EXTENT_IO_TREE_H */
fs/btrfs/extent_io.c +4 -4
index 690e1ac0b54d..8767b9ba848b 100644
@@ -2026,8 +2026,8 @@ u64 count_range_bits(struct extent_io_tree *tree,
  * set the private field for a given byte offset in the tree.  If there isn't
  * an extent_state there already, this does nothing.
  */
-static noinline int set_state_failrec(struct extent_io_tree *tree, u64 start,
-		struct io_failure_record *failrec)
+int set_state_failrec(struct extent_io_tree *tree, u64 start,
+		      struct io_failure_record *failrec)
 {
 	struct rb_node *node;
 	struct extent_state *state;
@@ -2054,8 +2054,8 @@ static noinline int set_state_failrec(struct extent_io_tree *tree, u64 start,
 	return ret;
 }
 
-static noinline int get_state_failrec(struct extent_io_tree *tree, u64 start,
-		struct io_failure_record **failrec)
+int get_state_failrec(struct extent_io_tree *tree, u64 start,
+		      struct io_failure_record **failrec)
 {
 	struct rb_node *node;
 	struct extent_state *state;
fs/btrfs/extent_io.h +0 -11
index 8c782d061132..e22045cef89b 100644
@@ -296,10 +296,6 @@ struct btrfs_inode;
 int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
 		      u64 length, u64 logical, struct page *page,
 		      unsigned int pg_offset, int mirror_num);
-int clean_io_failure(struct btrfs_fs_info *fs_info,
-		     struct extent_io_tree *failure_tree,
-		     struct extent_io_tree *io_tree, u64 start,
-		     struct page *page, u64 ino, unsigned int pg_offset);
 void end_extent_writepage(struct page *page, int err, u64 start, u64 end);
 int btrfs_repair_eb_io_failure(struct extent_buffer *eb, int mirror_num);
 
@@ -323,19 +319,12 @@ struct io_failure_record {
 };
 
 
-void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start,
-		u64 end);
-int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
-				struct io_failure_record **failrec_ret);
 bool btrfs_check_repairable(struct inode *inode, unsigned failed_bio_pages,
 			    struct io_failure_record *failrec, int fail_mirror);
 struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio,
 				    struct io_failure_record *failrec,
 				    struct page *page, int pg_offset, int icsum,
 				    bio_end_io_t *endio_func, void *data);
-int free_io_failure(struct extent_io_tree *failure_tree,
-		    struct extent_io_tree *io_tree,
-		    struct io_failure_record *rec);
 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
 bool find_lock_delalloc_range(struct inode *inode,
 			     struct page *locked_page, u64 *start,
Signature · 1 line
2.21.0
#6 lore raw

PATCH v3 7/9 btrfs: separate out the extent buffer init code

In reply to Josef Bacik

We want to move this into it's own file, so separate out the init/exit code for setting up the extent_buffer cache.

---
 fs/btrfs/extent_io.c | 36 +++++++++++++++++++-----------------
 fs/btrfs/extent_io.h |  2 ++
 fs/btrfs/super.c     |  9 ++++++++-
 3 files changed, 29 insertions(+), 18 deletions(-)
fs/btrfs/extent_io.c +19 -17
index 4adcdcdd80c3..e4bc40302225 100644
@@ -137,32 +137,30 @@ static int __must_check flush_write_bio(struct extent_page_data *epd)
 
 int __init extent_io_init(void)
 {
-	extent_buffer_cache = kmem_cache_create("btrfs_extent_buffer",
-			sizeof(struct extent_buffer), 0,
-			SLAB_MEM_SPREAD, NULL);
-	if (!extent_buffer_cache)
-		return -ENOMEM;
-
 	if (bioset_init(&btrfs_bioset, BIO_POOL_SIZE,
 			offsetof(struct btrfs_io_bio, bio),
 			BIOSET_NEED_BVECS))
-		goto free_buffer_cache;
+		return -ENOMEM;
 
-	if (bioset_integrity_create(&btrfs_bioset, BIO_POOL_SIZE))
-		goto free_bioset;
+	if (bioset_integrity_create(&btrfs_bioset, BIO_POOL_SIZE)) {
+		bioset_exit(&btrfs_bioset);
+		return -ENOMEM;
+	}
 
 	return 0;
+}
 
-free_bioset:
-	bioset_exit(&btrfs_bioset);
-
-free_buffer_cache:
-	kmem_cache_destroy(extent_buffer_cache);
-	extent_buffer_cache = NULL;
-	return -ENOMEM;
+int __init extent_buffer_init(void)
+{
+	extent_buffer_cache = kmem_cache_create("btrfs_extent_buffer",
+			sizeof(struct extent_buffer), 0,
+			SLAB_MEM_SPREAD, NULL);
+	if (!extent_buffer_cache)
+		return -ENOMEM;
+	return 0;
 }
 
-void __cold extent_io_exit(void)
+void __cold extent_buffer_exit(void)
 {
 	btrfs_extent_buffer_leak_debug_check();
 
@@ -172,6 +170,10 @@ void __cold extent_io_exit(void)
 	 */
 	rcu_barrier();
 	kmem_cache_destroy(extent_buffer_cache);
+}
+
+void __cold extent_io_exit(void)
+{
 	bioset_exit(&btrfs_bioset);
 }
 
fs/btrfs/extent_io.h +2 -0
index e22045cef89b..e2246956e544 100644
@@ -332,4 +332,6 @@ bool find_lock_delalloc_range(struct inode *inode,
 #endif
 struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
 					       u64 start);
+int __init extent_buffer_init(void);
+void __cold extent_buffer_exit(void);
 #endif
fs/btrfs/super.c +8 -1
index 843015b9a11e..7207bb39f236 100644
@@ -2360,10 +2360,14 @@ static int __init init_btrfs_fs(void)
 	if (err)
 		goto free_cachep;
 
-	err = extent_state_cache_init();
+	err = extent_buffer_init();
 	if (err)
 		goto free_extent_io;
 
+	err = extent_state_cache_init();
+	if (err)
+		goto free_extent_buffer;
+
 	err = extent_map_init();
 	if (err)
 		goto free_extent_state_cache;
@@ -2428,6 +2432,8 @@ static int __init init_btrfs_fs(void)
 	extent_map_exit();
 free_extent_state_cache:
 	extent_state_cache_exit();
+free_extent_buffer:
+	extent_buffer_exit();
 free_extent_io:
 	extent_io_exit();
 free_cachep:
@@ -2449,6 +2455,7 @@ static void __exit exit_btrfs_fs(void)
 	ordered_data_exit();
 	extent_map_exit();
 	extent_state_cache_exit();
+	extent_buffer_exit();
 	extent_io_exit();
 	btrfs_interface_exit();
 	btrfs_end_io_wq_exit();
Signature · 1 line
2.21.0
#7 lore raw

PATCH v3 8/9 btrfs: migrate the extent_buffer code out of extent-io.h

In reply to Josef Bacik

There's two main things we do with extent buffers, we mess with the buffers themselves, and then we do IO on those buffers. Separate out the actual extent buffer manipulation code from extent_io since they are unrelated.

---
 fs/btrfs/ctree.h         |   2 +-
 fs/btrfs/disk-io.h       |   2 +
 fs/btrfs/extent-buffer.h | 152 +++++++++++++++++++++++++++++++++++++++
 fs/btrfs/extent_io.h     | 148 +-------------------------------------
 4 files changed, 157 insertions(+), 147 deletions(-)
 create mode 100644 fs/btrfs/extent-buffer.h
fs/btrfs/ctree.h +1 -1
index 5e7ff169683c..c3a7df64db32 100644
@@ -29,7 +29,7 @@
 #include <linux/refcount.h>
 #include <linux/crc32c.h>
 #include "extent-io-tree.h"
-#include "extent_io.h"
+#include "extent-buffer.h"
 #include "extent_map.h"
 #include "async-thread.h"
 #include "block-rsv.h"
fs/btrfs/disk-io.h +2 -0
index a6958103d87e..affb45b1ed82 100644
@@ -6,6 +6,8 @@
 #ifndef BTRFS_DISK_IO_H
 #define BTRFS_DISK_IO_H
 
+#include "extent_io.h"
+
 #define BTRFS_SUPER_INFO_OFFSET SZ_64K
 #define BTRFS_SUPER_INFO_SIZE 4096
 
fs/btrfs/extent-buffer.h new file +152 -0

152 lines not on this page · raw message

fs/btrfs/extent_io.h +2 -146

193 lines not on this page · raw message

Signature · 1 line
2.21.0
#8 lore raw

PATCH v3 9/9 btrfs: move the extent-buffer code

In reply to Josef Bacik

This moves the extent buffer code into its own file.

---
 fs/btrfs/Makefile        |    3 +-
 fs/btrfs/extent-buffer.c | 1268 ++++++++++++++++++++++++++++++++++++++
 fs/btrfs/extent_io.c     | 1257 -------------------------------------
 3 files changed, 1270 insertions(+), 1258 deletions(-)
 create mode 100644 fs/btrfs/extent-buffer.c
fs/btrfs/Makefile +2 -1
index 7ce7202f5fe8..4d669c1d09fa 100644
@@ -11,7 +11,8 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
 	   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
 	   reada.o backref.o ulist.o qgroup.o send.o dev-replace.o raid56.o \
 	   uuid-tree.o props.o free-space-tree.o tree-checker.o space-info.o \
-	   block-rsv.o delalloc-space.o block-group.o extent-io-tree.o
+	   block-rsv.o delalloc-space.o block-group.o extent-io-tree.o \
+	   extent-buffer.o
 
 btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
 btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
fs/btrfs/extent-buffer.c new file +1268 -0

1,268 lines not on this page · raw message

fs/btrfs/extent_io.c +0 -1257

1,292 lines not on this page · raw message

Signature · 1 line
2.21.0
#10 lore raw
Quoted 5 lines · David Sterba
Quoted 2 lines · Josef Bacik

v1->v2:
- renamed find_delalloc_range to btrfs_find_delalloc_range for now.

The series is V3, what changed V2->V3?

Wtf, I must not have saved. It should have had

v2->v3:
- Fix build errors with CONFIG_BTRFS_DEBUG turned on.

Thanks,

Josef

#11 lore raw
In reply to Josef Bacik
Quoted 17 lines · Josef Bacik

v1->v2:
- renamed find_delalloc_range to btrfs_find_delalloc_range for now.

-- Original email --

Currently extent_io.c includes all of the extent-io-tree code, the extent buffer code, the code to do IO on extent buffers and data extents, as well as a bunch of other random stuff. The random stuff just needs to be cleaned up, and is probably too invasive for this point in the development cycle. Instead I simply tackled moving the big obvious things out into their own files. I will follow up with cleanups for the rest of the stuff, but those can probably wait until the next cycle as they are going to be slightly more risky. As usual I didn't try to change anything, I simply moved code around. Any time I needed to make actual changes to functions I made a separate patch for that work, so for example breaking up the init/exit functions for extent-io-tree. Everything else is purely cut and paste into new files. The diffstat is as follows

Quoted 11 lines
 fs/btrfs/Makefile         |    3 +-
 fs/btrfs/ctree.h          |    3 +-
 fs/btrfs/disk-io.h        |    2 +
 fs/btrfs/extent-buffer.c  | 1266 ++++++++
 fs/btrfs/extent-buffer.h  |  152 +
 fs/btrfs/extent-io-tree.c | 1955 ++++++++++++
 fs/btrfs/extent-io-tree.h |  248 ++
 fs/btrfs/extent_io.c      | 7555 +++++++++++++--------------------------------
 fs/btrfs/extent_io.h      |  372 +--
 fs/btrfs/super.c          |   16 +-
 10 files changed, 5843 insertions(+), 5729 deletions(-)

I got some strange merge conflicts, it turns out patch 6/9 did not make it to the mailinglist (nor patchwork where I could pick it eventually). For that it's useful to have the list of commits too along with the diffstat, ie. what format-patch generates.

#12 lore raw
Quoted 30 lines · David Sterba
Quoted 17 lines · Josef Bacik

v1->v2:
- renamed find_delalloc_range to btrfs_find_delalloc_range for now.

-- Original email --

Currently extent_io.c includes all of the extent-io-tree code, the extent buffer code, the code to do IO on extent buffers and data extents, as well as a bunch of other random stuff. The random stuff just needs to be cleaned up, and is probably too invasive for this point in the development cycle. Instead I simply tackled moving the big obvious things out into their own files. I will follow up with cleanups for the rest of the stuff, but those can probably wait until the next cycle as they are going to be slightly more risky. As usual I didn't try to change anything, I simply moved code around. Any time I needed to make actual changes to functions I made a separate patch for that work, so for example breaking up the init/exit functions for extent-io-tree. Everything else is purely cut and paste into new files. The diffstat is as follows

Quoted 11 lines
 fs/btrfs/Makefile         |    3 +-
 fs/btrfs/ctree.h          |    3 +-
 fs/btrfs/disk-io.h        |    2 +
 fs/btrfs/extent-buffer.c  | 1266 ++++++++
 fs/btrfs/extent-buffer.h  |  152 +
 fs/btrfs/extent-io-tree.c | 1955 ++++++++++++
 fs/btrfs/extent-io-tree.h |  248 ++
 fs/btrfs/extent_io.c      | 7555 +++++++++++++--------------------------------
 fs/btrfs/extent_io.h      |  372 +--
 fs/btrfs/super.c          |   16 +-
 10 files changed, 5843 insertions(+), 5729 deletions(-)
Quoted 4 lines

I got some strange merge conflicts, it turns out patch 6/9 did not make it to the mailinglist (nor patchwork where I could pick it eventually). For that it's useful to have the list of commits too along with the diffstat, ie. what format-patch generates.

Huh weird. I see you merged up through patch 5, I'll rebase and resend and maybe this time the ML will take it.

How about I start sending pull requests through github for everything in addition to sending stuff to the mailinglist, that way it's easier to track the bigger things? Thanks,

Josef

#13 lore raw
Quoted 7 lines · Josef Bacik
Quoted 4 lines

I got some strange merge conflicts, it turns out patch 6/9 did not make it to the mailinglist (nor patchwork where I could pick it eventually). For that it's useful to have the list of commits too along with the diffstat, ie. what format-patch generates.

Huh weird. I see you merged up through patch 5, I'll rebase and resend and maybe this time the ML will take it.

Yeah I merged what I had, even some of the 7-9 applied but that could cause conflicts after your changes.

Quoted 3 lines

How about I start sending pull requests through github for everything in addition to sending stuff to the mailinglist, that way it's easier to track the bigger things? Thanks,

You can always send a link to git branch with the patches, not only for cases like that, but we also want the mailig list copy. I almost always process the mailinglist to send replies and to check previous iterations. IOW, git branch is for convenience.

#14 lore raw
Quoted 12 lines · David Sterba
Quoted 7 lines · Josef Bacik
Quoted 4 lines

I got some strange merge conflicts, it turns out patch 6/9 did not make it to the mailinglist (nor patchwork where I could pick it eventually). For that it's useful to have the list of commits too along with the diffstat, ie. what format-patch generates.

Huh weird. I see you merged up through patch 5, I'll rebase and resend and maybe this time the ML will take it.

Yeah I merged what I had, even some of the 7-9 applied but that could cause conflicts after your changes.

Quoted 8 lines
Quoted 3 lines

How about I start sending pull requests through github for everything in addition to sending stuff to the mailinglist, that way it's easier to track the bigger things? Thanks,

You can always send a link to git branch with the patches, not only for cases like that, but we also want the mailig list copy. I almost always process the mailinglist to send replies and to check previous iterations. IOW, git branch is for convenience.

Yeah I'm not saying replace the mailinglist stuff, but augment it with a github PR to make sure things don't get lost. I'll follow up with that shortly.

Josef