Skip to content

Commit 9aa29a2

Browse files
fdmananakdave
authored andcommitted
btrfs: move the direct IO code into its own file
The direct IO code is over a thousand lines and it's currently spread between file.c and inode.c, which makes it not easy to locate some parts of it sometimes. Also inode.c is about 11 thousand lines and file.c about 4 thousand lines, both too big. So move all the direct IO code into a dedicated file, so that it's easy to locate all its code and reduce the sizes of inode.c and file.c. This is a pure move of code without any other changes except export a a couple functions from inode.c (get_extent_allocation_hint() and create_io_em()) because they are used in inode.c and the new direct-io.c file, and a couple functions from file.c (btrfs_buffered_write() and btrfs_write_check()) because they are used both in file.c and in the new direct-io.c file. Reviewed-by: Boris Burkov <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0d9b7e1 commit 9aa29a2

File tree

8 files changed

+1095
-1059
lines changed

8 files changed

+1095
-1059
lines changed

fs/btrfs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
3333
uuid-tree.o props.o free-space-tree.o tree-checker.o space-info.o \
3434
block-rsv.o delalloc-space.o block-group.o discard.o reflink.o \
3535
subpage.o tree-mod-log.o extent-io-tree.o fs.o messages.o bio.o \
36-
lru_cache.o raid-stripe-tree.o fiemap.o
36+
lru_cache.o raid-stripe-tree.o fiemap.o direct-io.o
3737

3838
btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
3939
btrfs-$(CONFIG_BTRFS_FS_REF_VERIFY) += ref-verify.o

fs/btrfs/btrfs_inode.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,6 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,
610610
ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
611611
const struct btrfs_ioctl_encoded_io_args *encoded);
612612

613-
ssize_t btrfs_dio_read(struct kiocb *iocb, struct iov_iter *iter,
614-
size_t done_before);
615-
struct iomap_dio *btrfs_dio_write(struct kiocb *iocb, struct iov_iter *iter,
616-
size_t done_before);
617613
struct btrfs_inode *btrfs_find_first_inode(struct btrfs_root *root, u64 min_ino);
618614

619615
extern const struct dentry_operations btrfs_dentry_operations;
@@ -630,5 +626,10 @@ void btrfs_inode_unlock(struct btrfs_inode *inode, unsigned int ilock_flags);
630626
void btrfs_update_inode_bytes(struct btrfs_inode *inode, const u64 add_bytes,
631627
const u64 del_bytes);
632628
void btrfs_assert_inode_range_clean(struct btrfs_inode *inode, u64 start, u64 end);
629+
u64 btrfs_get_extent_allocation_hint(struct btrfs_inode *inode, u64 start,
630+
u64 num_bytes);
631+
struct extent_map *btrfs_create_io_em(struct btrfs_inode *inode, u64 start,
632+
const struct btrfs_file_extent *file_extent,
633+
int type);
633634

634635
#endif

0 commit comments

Comments
 (0)