btrfs: move file prototypes to file.h
authorJosef Bacik <josef@toxicpanda.com>
Wed, 26 Oct 2022 19:08:30 +0000 (15:08 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Dec 2022 17:00:46 +0000 (18:00 +0100)
Move these out of ctree.h into file.h to cut down on code in ctree.h.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/extent_io.c
fs/btrfs/file.c
fs/btrfs/file.h [new file with mode: 0644]
fs/btrfs/free-space-cache.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/ordered-data.c
fs/btrfs/reflink.c
fs/btrfs/tree-log.c

index 87930337b3012984c0680f832973afa517c03e5b..3a46b5b688e3097b01a0b55a71924b574a9aabd1 100644 (file)
@@ -688,32 +688,6 @@ int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
 int btrfs_del_orphan_item(struct btrfs_trans_handle *trans,
                          struct btrfs_root *root, u64 offset);
 
-/* file.c */
-int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
-extern const struct file_operations btrfs_file_operations;
-int btrfs_drop_extents(struct btrfs_trans_handle *trans,
-                      struct btrfs_root *root, struct btrfs_inode *inode,
-                      struct btrfs_drop_extents_args *args);
-int btrfs_replace_file_extents(struct btrfs_inode *inode,
-                          struct btrfs_path *path, const u64 start,
-                          const u64 end,
-                          struct btrfs_replace_extent_info *extent_info,
-                          struct btrfs_trans_handle **trans_out);
-int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
-                             struct btrfs_inode *inode, u64 start, u64 end);
-ssize_t btrfs_do_write_iter(struct kiocb *iocb, struct iov_iter *from,
-                           const struct btrfs_ioctl_encoded_io_args *encoded);
-int btrfs_release_file(struct inode *inode, struct file *file);
-int btrfs_dirty_pages(struct btrfs_inode *inode, struct page **pages,
-                     size_t num_pages, loff_t pos, size_t write_bytes,
-                     struct extent_state **cached, bool noreserve);
-int btrfs_fdatawrite_range(struct inode *inode, loff_t start, loff_t end);
-int btrfs_check_nocow_lock(struct btrfs_inode *inode, loff_t pos,
-                          size_t *write_bytes, bool nowait);
-void btrfs_check_nocow_unlock(struct btrfs_inode *inode);
-bool btrfs_find_delalloc_in_range(struct btrfs_inode *inode, u64 start, u64 end,
-                                 u64 *delalloc_start_ret, u64 *delalloc_end_ret);
-
 /* super.c */
 int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                        unsigned long new_flags);
index ea31a326ae93d23cea4f6853fad2c8f598f0c9bc..7fe637408e986f2c16bbcca259e3867c898c7a0b 100644 (file)
@@ -33,6 +33,7 @@
 #include "fs.h"
 #include "accessors.h"
 #include "file-item.h"
+#include "file.h"
 
 static struct kmem_cache *extent_buffer_cache;
 
index 22063340a4c2fe793d2a38c1e6c319ca357f07b2..b94dc4b2c4867277945827ed1d367bf9a6c2862f 100644 (file)
@@ -35,6 +35,7 @@
 #include "extent-tree.h"
 #include "file-item.h"
 #include "ioctl.h"
+#include "file.h"
 
 /* simple helper to fault in pages and copy.  This should go away
  * and be replaced with calls into generic code.
diff --git a/fs/btrfs/file.h b/fs/btrfs/file.h
new file mode 100644 (file)
index 0000000..f3d794e
--- /dev/null
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef BTRFS_FILE_H
+#define BTRFS_FILE_H
+
+extern const struct file_operations btrfs_file_operations;
+
+int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
+int btrfs_drop_extents(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root, struct btrfs_inode *inode,
+                      struct btrfs_drop_extents_args *args);
+int btrfs_replace_file_extents(struct btrfs_inode *inode,
+                          struct btrfs_path *path, const u64 start,
+                          const u64 end,
+                          struct btrfs_replace_extent_info *extent_info,
+                          struct btrfs_trans_handle **trans_out);
+int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
+                             struct btrfs_inode *inode, u64 start, u64 end);
+ssize_t btrfs_do_write_iter(struct kiocb *iocb, struct iov_iter *from,
+                           const struct btrfs_ioctl_encoded_io_args *encoded);
+int btrfs_release_file(struct inode *inode, struct file *file);
+int btrfs_dirty_pages(struct btrfs_inode *inode, struct page **pages,
+                     size_t num_pages, loff_t pos, size_t write_bytes,
+                     struct extent_state **cached, bool noreserve);
+int btrfs_fdatawrite_range(struct inode *inode, loff_t start, loff_t end);
+int btrfs_check_nocow_lock(struct btrfs_inode *inode, loff_t pos,
+                          size_t *write_bytes, bool nowait);
+void btrfs_check_nocow_unlock(struct btrfs_inode *inode);
+bool btrfs_find_delalloc_in_range(struct btrfs_inode *inode, u64 start, u64 end,
+                                 u64 *delalloc_start_ret, u64 *delalloc_end_ret);
+
+#endif
index bc1b9aa164ec5218def583d8ba4b07b28c8e2176..aef075b6318849a32f4bf0297dff62790a9fc6a1 100644 (file)
@@ -28,6 +28,7 @@
 #include "inode-item.h"
 #include "accessors.h"
 #include "file-item.h"
+#include "file.h"
 
 #define BITS_PER_BITMAP                (PAGE_SIZE * 8UL)
 #define MAX_CACHE_BYTES_PER_GIG        SZ_64K
index 7111eec812dc95ad544a0127be9689c6087dbbbc..3fe3301b88b39867e1426e27823a13b4226301cb 100644 (file)
@@ -64,6 +64,7 @@
 #include "file-item.h"
 #include "uuid-tree.h"
 #include "ioctl.h"
+#include "file.h"
 
 struct btrfs_iget_args {
        u64 ino;
index 4c5c2f890adcaa5d4179240b58f6769245defb2d..dba1f07b4194d1d66d9ea159673440b583fc652e 100644 (file)
@@ -58,6 +58,7 @@
 #include "dir-item.h"
 #include "uuid-tree.h"
 #include "ioctl.h"
+#include "file.h"
 
 #ifdef CONFIG_64BIT
 /* If we have a 32-bit userspace and 64-bit kernel, then the UAPI
index 1c36407803ca709353857dc96c35083dd6ffc0d9..2aea2a17ed958f34458b230238e3aaf961c5d086 100644 (file)
@@ -18,6 +18,7 @@
 #include "delalloc-space.h"
 #include "qgroup.h"
 #include "subpage.h"
+#include "file.h"
 
 static struct kmem_cache *btrfs_ordered_extent_cache;
 
index 204bb884ab9144f0ae4c8f561f0b00a066dd7c69..3c962b5d8dbdd25154afb2496d3f82746e79ab1c 100644 (file)
@@ -13,6 +13,7 @@
 #include "subpage.h"
 #include "accessors.h"
 #include "file-item.h"
+#include "file.h"
 
 #define BTRFS_MAX_DEDUPE_LEN   SZ_16M
 
index 7be540fb5c4af23491f3774e7cedf806ee9488a0..1c505713511c56a1b0f0f17be3cf20260dfb2572 100644 (file)
@@ -27,6 +27,7 @@
 #include "root-tree.h"
 #include "dir-item.h"
 #include "file-item.h"
+#include "file.h"
 
 #define MAX_CONFLICT_INODES 10