]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
block: move block-related definitions out of fs.h
authorChristoph Hellwig <hch@lst.de>
Sat, 20 Jun 2020 07:16:41 +0000 (09:16 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 24 Jun 2020 15:16:02 +0000 (09:16 -0600)
Move most of the block related definition out of fs.h into more suitable
headers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 files changed:
fs/affs/file.c
fs/hfs/inode.c
fs/internal.h
fs/ntfs/dir.c
fs/proc/devices.c
fs/quota/dquot.c
fs/reiserfs/procfs.c
include/linux/blkdev.h
include/linux/fs.h
include/linux/genhd.h
include/linux/jbd2.h
security/loadpin/loadpin.c

index a85817f54483f742bd42955d8995c69eb5d2891a..a26a0f96c1197a10bd5c4ac33cc8650100fe3c2f 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/uio.h>
+#include <linux/blkdev.h>
 #include "affs.h"
 
 static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext);
index 2f224b98ee94a6f2b4e77d3c2132a97758596446..f35a37c65e5fffb5a9b0bce1b85420a6d7de4a40 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/cred.h>
 #include <linux/uio.h>
 #include <linux/xattr.h>
+#include <linux/blkdev.h>
 
 #include "hfs_fs.h"
 #include "btree.h"
index 9b863a7bd708924f5bc5b204d342c22dc0836639..969988d3d397329e9bdf58ec178b672ecfb35818 100644 (file)
@@ -23,7 +23,9 @@ struct user_namespace;
 extern void __init bdev_cache_init(void);
 
 extern int __sync_blockdev(struct block_device *bdev, int wait);
-
+void iterate_bdevs(void (*)(struct block_device *, void *), void *);
+void emergency_thaw_bdev(struct super_block *sb);
+void bd_forget(struct inode *inode);
 #else
 static inline void bdev_cache_init(void)
 {
@@ -33,7 +35,18 @@ static inline int __sync_blockdev(struct block_device *bdev, int wait)
 {
        return 0;
 }
-#endif
+static inline void iterate_bdevs(void (*f)(struct block_device *, void *),
+               void *arg)
+{
+}
+static inline int emergency_thaw_bdev(struct super_block *sb)
+{
+       return 0;
+}
+static inline void bd_forget(struct inode *inode)
+{
+}
+#endif /* CONFIG_BLOCK */
 
 /*
  * buffer.c
index 3c4811469ae863b89b2612b87c2662a62f317cd1..a87d4391e6b55d488f659bfb9f69b126b4dce1b3 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/buffer_head.h>
 #include <linux/slab.h>
+#include <linux/blkdev.h>
 
 #include "dir.h"
 #include "aops.h"
index 37d38697eaf876132efbe40d90bfad222e88b7c5..837971e741097832d4033c24dc77749ae9bf82ce 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/blkdev.h>
 
 static int devinfo_show(struct seq_file *f, void *v)
 {
index 7b4bac91146b512680b958fad9d92a4936660a8e..bb02989d92b61860cba9a21072d402461bd7620f 100644 (file)
@@ -78,6 +78,7 @@
 #include <linux/namei.h>
 #include <linux/capability.h>
 #include <linux/quotaops.h>
+#include <linux/blkdev.h>
 #include "../internal.h" /* ugh */
 
 #include <linux/uaccess.h>
index ff336513c2544cd9aa1bb4f4f43acd7e5c36e19f..155b82870333619cc967d16382e4be6b0c8c995d 100644 (file)
@@ -15,6 +15,7 @@
 #include "reiserfs.h"
 #include <linux/init.h>
 #include <linux/proc_fs.h>
+#include <linux/blkdev.h>
 
 /*
  * LOCKING:
index c0701237116d0c096c13ef27f690525c20572dc8..cf8f692f62a991e6710d0ae98f8cd64f5c5cf92d 100644 (file)
@@ -1918,4 +1918,50 @@ static inline void bio_end_io_acct(struct bio *bio, unsigned long start_time)
 }
 #endif /* CONFIG_BLOCK */
 
+int bdev_read_only(struct block_device *bdev);
+int set_blocksize(struct block_device *bdev, int size);
+
+const char *bdevname(struct block_device *bdev, char *buffer);
+struct block_device *lookup_bdev(const char *);
+
+void blkdev_show(struct seq_file *seqf, off_t offset);
+
+#define BDEVNAME_SIZE  32      /* Largest string for a blockdev identifier */
+#define BDEVT_SIZE     10      /* Largest string for MAJ:MIN for blkdev */
+#ifdef CONFIG_BLOCK
+#define BLKDEV_MAJOR_MAX       512
+#else
+#define BLKDEV_MAJOR_MAX       0
+#endif
+
+int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder);
+struct block_device *blkdev_get_by_path(const char *path, fmode_t mode,
+               void *holder);
+struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, void *holder);
+struct block_device *bd_start_claiming(struct block_device *bdev, void *holder);
+void bd_abort_claiming(struct block_device *bdev, struct block_device *whole,
+               void *holder);
+void blkdev_put(struct block_device *bdev, fmode_t mode);
+
+struct block_device *bdget(dev_t);
+struct block_device *bdgrab(struct block_device *bdev);
+void bdput(struct block_device *);
+
+#ifdef CONFIG_BLOCK
+void invalidate_bdev(struct block_device *bdev);
+int sync_blockdev(struct block_device *bdev);
+#else
+static inline void invalidate_bdev(struct block_device *bdev)
+{
+}
+static inline int sync_blockdev(struct block_device *bdev)
+{
+       return 0;
+}
 #endif
+int fsync_bdev(struct block_device *bdev);
+
+struct super_block *freeze_bdev(struct block_device *bdev);
+int thaw_bdev(struct block_device *bdev, struct super_block *sb);
+
+#endif /* _LINUX_BLKDEV_H */
index 7f3ae38335d4b33058c3e0dd83bc022eeee84561..add30c3bdf9a28a13d626056338982f44a30df88 100644 (file)
@@ -2563,79 +2563,10 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
        return IS_ENABLED(CONFIG_BLOCK) && sb == blockdev_superblock;
 }
 
-#ifdef CONFIG_BLOCK
-extern int register_blkdev(unsigned int, const char *);
-extern void unregister_blkdev(unsigned int, const char *);
-extern struct block_device *bdget(dev_t);
-extern struct block_device *bdgrab(struct block_device *bdev);
-extern void bd_set_size(struct block_device *, loff_t size);
-extern void bd_forget(struct inode *inode);
-extern void bdput(struct block_device *);
-extern void invalidate_bdev(struct block_device *);
-extern void iterate_bdevs(void (*)(struct block_device *, void *), void *);
-extern int sync_blockdev(struct block_device *bdev);
-extern struct super_block *freeze_bdev(struct block_device *);
-extern void emergency_thaw_bdev(struct super_block *sb);
-extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
-extern int fsync_bdev(struct block_device *);
-#else
-static inline void bd_forget(struct inode *inode) {}
-static inline int sync_blockdev(struct block_device *bdev) { return 0; }
-static inline void invalidate_bdev(struct block_device *bdev) {}
-
-static inline struct super_block *freeze_bdev(struct block_device *sb)
-{
-       return NULL;
-}
-
-static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
-{
-       return 0;
-}
-
-static inline int emergency_thaw_bdev(struct super_block *sb)
-{
-       return 0;
-}
-
-static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
-{
-}
-#endif
 void emergency_thaw_all(void);
 extern int sync_filesystem(struct super_block *);
 extern const struct file_operations def_blk_fops;
 extern const struct file_operations def_chr_fops;
-#ifdef CONFIG_BLOCK
-extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
-extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
-extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder);
-extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode,
-                                              void *holder);
-extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode,
-                                             void *holder);
-extern struct block_device *bd_start_claiming(struct block_device *bdev,
-                                             void *holder);
-extern void bd_abort_claiming(struct block_device *bdev,
-                             struct block_device *whole, void *holder);
-extern void blkdev_put(struct block_device *bdev, fmode_t mode);
-
-#ifdef CONFIG_SYSFS
-extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
-extern void bd_unlink_disk_holder(struct block_device *bdev,
-                                 struct gendisk *disk);
-#else
-static inline int bd_link_disk_holder(struct block_device *bdev,
-                                     struct gendisk *disk)
-{
-       return 0;
-}
-static inline void bd_unlink_disk_holder(struct block_device *bdev,
-                                        struct gendisk *disk)
-{
-}
-#endif
-#endif
 
 /* fs/char_dev.c */
 #define CHRDEV_MAJOR_MAX 512
@@ -2666,31 +2597,12 @@ static inline void unregister_chrdev(unsigned int major, const char *name)
        __unregister_chrdev(major, 0, 256, name);
 }
 
-/* fs/block_dev.c */
-#define BDEVNAME_SIZE  32      /* Largest string for a blockdev identifier */
-#define BDEVT_SIZE     10      /* Largest string for MAJ:MIN for blkdev */
-
-#ifdef CONFIG_BLOCK
-#define BLKDEV_MAJOR_MAX       512
-extern const char *bdevname(struct block_device *bdev, char *buffer);
-extern struct block_device *lookup_bdev(const char *);
-extern void blkdev_show(struct seq_file *,off_t);
-
-#else
-#define BLKDEV_MAJOR_MAX       0
-#endif
-
 extern void init_special_inode(struct inode *, umode_t, dev_t);
 
 /* Invalid inode operations -- fs/bad_inode.c */
 extern void make_bad_inode(struct inode *);
 extern bool is_bad_inode(struct inode *);
 
-#ifdef CONFIG_BLOCK
-extern int revalidate_disk(struct gendisk *);
-extern int check_disk_change(struct block_device *);
-extern int __invalidate_device(struct block_device *, bool);
-#endif
 unsigned long invalidate_mapping_pages(struct address_space *mapping,
                                        pgoff_t start, pgoff_t end);
 
@@ -3090,10 +3002,6 @@ static inline void remove_inode_hash(struct inode *inode)
 
 extern void inode_sb_list_add(struct inode *inode);
 
-#ifdef CONFIG_BLOCK
-extern int bdev_read_only(struct block_device *);
-#endif
-extern int set_blocksize(struct block_device *, int);
 extern int sb_set_blocksize(struct super_block *, int);
 extern int sb_min_blocksize(struct super_block *, int);
 
index 392aad5e29a231cf90aa02cf34ec7e3afbbb8c07..83f8e0d832283639d3d6c3e0d341943f1c7d8fe4 100644 (file)
@@ -373,6 +373,33 @@ extern void blk_unregister_region(dev_t devt, unsigned long range);
 
 #define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)
 
+int register_blkdev(unsigned int major, const char *name);
+void unregister_blkdev(unsigned int major, const char *name);
+
+int revalidate_disk(struct gendisk *disk);
+int check_disk_change(struct block_device *bdev);
+int __invalidate_device(struct block_device *bdev, bool kill_dirty);
+void bd_set_size(struct block_device *bdev, loff_t size);
+
+/* for drivers/char/raw.c: */
+int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
+long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
+
+#ifdef CONFIG_SYSFS
+int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
+void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk);
+#else
+static inline int bd_link_disk_holder(struct block_device *bdev,
+                                     struct gendisk *disk)
+{
+       return 0;
+}
+static inline void bd_unlink_disk_holder(struct block_device *bdev,
+                                        struct gendisk *disk)
+{
+}
+#endif /* CONFIG_SYSFS */
+
 #else /* CONFIG_BLOCK */
 
 static inline void printk_all_partitions(void) { }
index d56128df2aff9f6d83bc7a8b1194b36c894fc969..4aaa29772bb0f1d91f2f17c005f5fc820c7648cd 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/timer.h>
 #include <linux/slab.h>
 #include <linux/bit_spinlock.h>
+#include <linux/blkdev.h>
 #include <crypto/hash.h>
 #endif
 
index ee5cb944f4ad1bdd70c2a91001c53bc72ba1b2e1..670a1aebb8a10fa097822edd2c77cb8367792da6 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/fs.h>
 #include <linux/lsm_hooks.h>
 #include <linux/mount.h>
+#include <linux/blkdev.h>
 #include <linux/path.h>
 #include <linux/sched.h>       /* current */
 #include <linux/string_helpers.h>