Skip to contentSkip to conversation

btrfs: move fiemap code into its own file

PATCH In review [email protected] 3 participants 3 messages May 22, 2024 – May 23, 2024 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: move fiemap code into its own file

From: Filipe Manana <[email protected]>

Currently the core of the fiemap code lives in extent_io.c, which does not make any sense because it's not related to extent IO at all (and it was not as well before the big rewrite of fiemap I did some time ago). The entry point for fiemap, btrfs_fiemap(), lives in inode.c since it's an inode operation.

Since there's a significant amount of fiemap code, move all of it into a dedicated file, including its entry point inode.c:btrfs_fiemap().

---
 fs/btrfs/Makefile    |   2 +-
 fs/btrfs/extent_io.c | 871 ----------------------------------------
 fs/btrfs/extent_io.h |   2 -
 fs/btrfs/fiemap.c    | 930 +++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/fiemap.h    |  11 +
 fs/btrfs/inode.c     |  52 +--
 6 files changed, 943 insertions(+), 925 deletions(-)
 create mode 100644 fs/btrfs/fiemap.c
 create mode 100644 fs/btrfs/fiemap.h
fs/btrfs/Makefile +1 -1
index 525af975f61c..50b19d15e956 100644
@@ -33,7 +33,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.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 discard.o reflink.o \
 	   subpage.o tree-mod-log.o extent-io-tree.o fs.o messages.o bio.o \
-	   lru_cache.o raid-stripe-tree.o
+	   lru_cache.o raid-stripe-tree.o fiemap.o
 
 btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
 btrfs-$(CONFIG_BTRFS_FS_REF_VERIFY) += ref-verify.o
fs/btrfs/extent_io.c +0 -871

877 lines not on this page · raw message

fs/btrfs/extent_io.h +0 -2
index dca6b12769ec..ecf89424502e 100644
@@ -242,8 +242,6 @@ int btrfs_writepages(struct address_space *mapping, struct writeback_control *wb
 int btree_write_cache_pages(struct address_space *mapping,
 			    struct writeback_control *wbc);
 void btrfs_readahead(struct readahead_control *rac);
-int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
-		  u64 start, u64 len);
 int set_folio_extent_mapped(struct folio *folio);
 int set_page_extent_mapped(struct page *page);
 void clear_page_extent_mapped(struct page *page);
fs/btrfs/fiemap.c new file +930 -0

930 lines not on this page · raw message

fs/btrfs/fiemap.h new file +11 -0
new file mode 100644
index 000000000000..cfd74b35988f
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef BTRFS_FIEMAP_H
+#define BTRFS_FIEMAP_H
+
+#include <linux/fiemap.h>
+
+int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+		 u64 start, u64 len);
+
+#endif /* BTRFS_FIEMAP_H */
fs/btrfs/inode.c +1 -51

64 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 8 lines · On Wed, May 22, 2024 at 09:15:59PM +0100, [email protected] wrote:

From: Filipe Manana <[email protected]>

Currently the core of the fiemap code lives in extent_io.c, which does not make any sense because it's not related to extent IO at all (and it was not as well before the big rewrite of fiemap I did some time ago). The entry point for fiemap, btrfs_fiemap(), lives in inode.c since it's an inode operation.

Quoted 4 lines

Since there's a significant amount of fiemap code, move all of it into a dedicated file, including its entry point inode.c:btrfs_fiemap().