Skip to contentSkip to conversation

move block bits out of fs.h

PATCH In review Christoph Hellwig 5 participants 32 messages Jun 20, 2020 – Jun 24, 2020

Subsystems (14)
lore
Share & tools
lore
#0 lore raw

Hi Jens,

this series removes various remaining block bits out of fs.h and cleans up a few loose ends around that.

Diffstat:

 drivers/tty/sysrq.c         |    2 
 fs/adfs/super.c             |    1 
 fs/affs/file.c              |    1 
 fs/befs/linuxvfs.c          |    1 
 fs/block_dev.c              |    5 -
 fs/efs/super.c              |    1 
 fs/hfs/inode.c              |    1 
 fs/internal.h               |   17 +++-
 fs/jfs/jfs_mount.c          |    1 
 fs/jfs/resize.c             |    1 
 fs/ntfs/dir.c               |    1 
 fs/proc/devices.c           |    1 
 fs/quota/dquot.c            |    1 
 fs/reiserfs/procfs.c        |    1 
 include/linux/bio.h         |    3 
 include/linux/blk_types.h   |   39 +++++++++-
 include/linux/blkdev.h      |  140 ++++++++++++++++++++++--------------
 include/linux/buffer_head.h |    1 
 include/linux/dasd_mod.h    |    2 
 include/linux/fs.h          |  169 --------------------------------------------
 include/linux/genhd.h       |   39 ++++++++--
 include/linux/jbd2.h        |    1 
 security/loadpin/loadpin.c  |    1 
 23 files changed, 192 insertions(+), 238 deletions(-)
#1 lore raw

PATCH 1/10 tty/sysrq: emergency_thaw_all does not depend on CONFIG_BLOCK

We can also thaw non-block file systems. Remove the CONFIG_BLOCK in sysrq.c after making the prototype available unconditionally.

---
 drivers/tty/sysrq.c | 2 --
 include/linux/fs.h  | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/tty/sysrq.c +0 -2
index 7c95afa905a083..a8e39b2cdd5526 100644
@@ -403,7 +403,6 @@ static const struct sysrq_key_op sysrq_moom_op = {
 	.enable_mask	= SYSRQ_ENABLE_SIGNAL,
 };
 
-#ifdef CONFIG_BLOCK
 static void sysrq_handle_thaw(int key)
 {
 	emergency_thaw_all();
@@ -414,7 +413,6 @@ static const struct sysrq_key_op sysrq_thaw_op = {
 	.action_msg	= "Emergency Thaw of all frozen filesystems",
 	.enable_mask	= SYSRQ_ENABLE_SIGNAL,
 };
-#endif
 
 static void sysrq_handle_kill(int key)
 {
include/linux/fs.h +1 -1
index 3f881a892ea746..7f40dbafbf6d49 100644
@@ -2593,7 +2593,6 @@ 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_all(void);
 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 *);
@@ -2633,6 +2632,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
 	return false;
 }
 #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;
Signature · 1 line
2.26.2
maintainer Reviewed-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] tty/sysrq: emergency_thaw_all does not depend on CONFIG_BLOCK

Quoted 9 lines · Christoph Hellwig

We can also thaw non-block file systems. Remove the CONFIG_BLOCK in sysrq.c after making the prototype available unconditionally.

---
 drivers/tty/sysrq.c | 2 --
 include/linux/fs.h  | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
#5 lore raw

PATCH 2/10 block: mark bd_finish_claiming static

In reply to Christoph Hellwig
---
 fs/block_dev.c     | 5 ++---
 include/linux/fs.h | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)
fs/block_dev.c +2 -3
index 0ae656e022fd57..0e0d43dc27d331 100644
@@ -1187,8 +1187,8 @@ static void bd_clear_claiming(struct block_device *whole, void *holder)
  * Finish exclusive open of a block device. Mark the device as exlusively
  * open by the holder and wake up all waiters for exclusive open to finish.
  */
-void bd_finish_claiming(struct block_device *bdev, struct block_device *whole,
-			void *holder)
+static void bd_finish_claiming(struct block_device *bdev,
+		struct block_device *whole, void *holder)
 {
 	spin_lock(&bdev_lock);
 	BUG_ON(!bd_may_claim(bdev, whole, holder));
@@ -1203,7 +1203,6 @@ void bd_finish_claiming(struct block_device *bdev, struct block_device *whole,
 	bd_clear_claiming(whole, holder);
 	spin_unlock(&bdev_lock);
 }
-EXPORT_SYMBOL(bd_finish_claiming);
 
 /**
  * bd_abort_claiming - abort claiming of a block device
include/linux/fs.h +0 -2
index 7f40dbafbf6d49..b1c960e9b84e3a 100644
@@ -2646,8 +2646,6 @@ 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_finish_claiming(struct block_device *bdev,
-			       struct block_device *whole, 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);
Signature · 1 line
2.26.2
#8 lore raw

PATCH 3/10 fs: remove an unused block_device_operations forward declaration

In reply to Christoph Hellwig
---
 include/linux/fs.h | 2 --
 1 file changed, 2 deletions(-)
include/linux/fs.h +0 -2
index b1c960e9b84e3a..0d282c853691a3 100644
@@ -1774,8 +1774,6 @@ struct dir_context {
 	loff_t pos;
 };
 
-struct block_device_operations;
-
 /* These macros are for out of kernel modules to test that
  * the kernel supports the unlocked_ioctl and compat_ioctl
  * fields in struct file_operations. */
Signature · 1 line
2.26.2
#11 lore raw

PATCH 4/10 fs: remove the HAVE_UNLOCKED_IOCTL and HAVE_COMPAT_IOCTL defines

In reply to Christoph Hellwig

These are not defined anywhere, and contrary to the comments we really do not care about out of tree code at all.

---
 include/linux/fs.h | 6 ------
 1 file changed, 6 deletions(-)
include/linux/fs.h +0 -6
index 0d282c853691a3..224edcc5b56e62 100644
@@ -1774,12 +1774,6 @@ struct dir_context {
 	loff_t pos;
 };
 
-/* These macros are for out of kernel modules to test that
- * the kernel supports the unlocked_ioctl and compat_ioctl
- * fields in struct file_operations. */
-#define HAVE_COMPAT_IOCTL 1
-#define HAVE_UNLOCKED_IOCTL 1
-
 /*
  * These flags let !MMU mmap() govern direct device mapping vs immediate
  * copying more easily for MAP_PRIVATE, especially for ROM filesystems.
Signature · 1 line
2.26.2
Reviewed-by on v1 4/10
#12 lore raw

Re: [PATCH 04/10] fs: remove the HAVE_UNLOCKED_IOCTL and HAVE_COMPAT_IOCTL defines

Quoted 2 lines · Christoph Hellwig

These are not defined anywhere, and contrary to the comments we really do not care about out of tree code at all.

#14 lore raw

PATCH 5/10 fs: remove the mount_bdev and kill_block_super stubs

In reply to Christoph Hellwig

No one calls these functions without CONFIG_BLOCK, so don't bother stubbing them out.

---
 include/linux/fs.h | 16 ----------------
 1 file changed, 16 deletions(-)
include/linux/fs.h +0 -16
index 224edcc5b56e62..9ee09e2b5a9716 100644
@@ -2256,18 +2256,9 @@ struct file_system_type {
 
 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
 
-#ifdef CONFIG_BLOCK
 extern struct dentry *mount_bdev(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data,
 	int (*fill_super)(struct super_block *, void *, int));
-#else
-static inline struct dentry *mount_bdev(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data,
-	int (*fill_super)(struct super_block *, void *, int))
-{
-	return ERR_PTR(-ENODEV);
-}
-#endif
 extern struct dentry *mount_single(struct file_system_type *fs_type,
 	int flags, void *data,
 	int (*fill_super)(struct super_block *, void *, int));
@@ -2276,14 +2267,7 @@ extern struct dentry *mount_nodev(struct file_system_type *fs_type,
 	int (*fill_super)(struct super_block *, void *, int));
 extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path);
 void generic_shutdown_super(struct super_block *sb);
-#ifdef CONFIG_BLOCK
 void kill_block_super(struct super_block *sb);
-#else
-static inline void kill_block_super(struct super_block *sb)
-{
-	BUG();
-}
-#endif
 void kill_anon_super(struct super_block *sb);
 void kill_litter_super(struct super_block *sb);
 void deactivate_super(struct super_block *sb);
Signature · 1 line
2.26.2
#16 lore raw

PATCH 6/10 block: simplify sb_is_blkdev_sb

In reply to Christoph Hellwig

Just use IS_ENABLED instead of providing a stub for !CONFIG_BLOCK.

---
 include/linux/fs.h | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
include/linux/fs.h +6 -12
index 9ee09e2b5a9716..7f3ae38335d4b3 100644
@@ -2557,6 +2557,12 @@ extern struct kmem_cache *names_cachep;
 #define __getname()		kmem_cache_alloc(names_cachep, GFP_KERNEL)
 #define __putname(name)		kmem_cache_free(names_cachep, (void *)(name))
 
+extern struct super_block *blockdev_superblock;
+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 *);
@@ -2572,13 +2578,6 @@ 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 *);
-
-extern struct super_block *blockdev_superblock;
-
-static inline bool sb_is_blkdev_sb(struct super_block *sb)
-{
-	return sb == blockdev_superblock;
-}
 #else
 static inline void bd_forget(struct inode *inode) {}
 static inline int sync_blockdev(struct block_device *bdev) { return 0; }
@@ -2602,11 +2601,6 @@ static inline int emergency_thaw_bdev(struct super_block *sb)
 static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
 {
 }
-
-static inline bool sb_is_blkdev_sb(struct super_block *sb)
-{
-	return false;
-}
 #endif
 void emergency_thaw_all(void);
 extern int sync_filesystem(struct super_block *);
Signature · 1 line
2.26.2
#19 lore raw

PATCH 7/10 block: move block-related definitions out of fs.h

In reply to Christoph Hellwig

Move most of the block related definition out of fs.h into more suitable headers.

---
 fs/affs/file.c             |  1 +
 fs/hfs/inode.c             |  1 +
 fs/internal.h              | 17 ++++++-
 fs/ntfs/dir.c              |  1 +
 fs/proc/devices.c          |  1 +
 fs/quota/dquot.c           |  1 +
 fs/reiserfs/procfs.c       |  1 +
 include/linux/blkdev.h     | 46 +++++++++++++++++++
 include/linux/fs.h         | 92 --------------------------------------
 include/linux/genhd.h      | 27 +++++++++++
 include/linux/jbd2.h       |  1 +
 security/loadpin/loadpin.c |  1 +
 12 files changed, 96 insertions(+), 94 deletions(-)
fs/affs/file.c +1 -0
index a85817f54483f7..a26a0f96c1197a 100644
@@ -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);
fs/hfs/inode.c +1 -0
index 2f224b98ee94a6..f35a37c65e5fff 100644
@@ -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"
fs/internal.h +15 -2
index 9b863a7bd70892..969988d3d39732 100644
@@ -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
fs/ntfs/dir.c +1 -0
index 3c4811469ae863..a87d4391e6b55d 100644
@@ -8,6 +8,7 @@
 
 #include <linux/buffer_head.h>
 #include <linux/slab.h>
+#include <linux/blkdev.h>
 
 #include "dir.h"
 #include "aops.h"
fs/proc/devices.c +1 -0
index 37d38697eaf876..837971e7410978 100644
@@ -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)
 {
fs/quota/dquot.c +1 -0
index 7b4bac91146b51..bb02989d92b618 100644
@@ -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>
fs/reiserfs/procfs.c +1 -0
index ff336513c2544c..155b8287033361 100644
@@ -15,6 +15,7 @@
 #include "reiserfs.h"
 #include <linux/init.h>
 #include <linux/proc_fs.h>
+#include <linux/blkdev.h>
 
 /*
  * LOCKING:
include/linux/blkdev.h +46 -0

50 lines not on this page · raw message

include/linux/fs.h +0 -92

120 lines not on this page · raw message

include/linux/genhd.h +27 -0
index 392aad5e29a231..83f8e0d8322836 100644
@@ -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) { }
include/linux/jbd2.h +1 -0
index f613d8529863f6..ef3f9e1ce8ad2d 100644
@@ -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
 
security/loadpin/loadpin.c +1 -0
index ee5cb944f4ad1b..670a1aebb8a10f 100644
@@ -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>
Signature · 1 line
2.26.2
#21 lore raw

PATCH 8/10 fs: move the buffer_heads_over_limit stub to buffer_head.h

In reply to Christoph Hellwig

Move the !CONFIG_BLOCK stub to the same place as the non-stub declaration.

---
 include/linux/blkdev.h      | 1 -
 include/linux/buffer_head.h | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +0 -1
index 50fccb121b876e..973253ce202d87 100644
@@ -1840,7 +1840,6 @@ struct block_device;
 /*
  * stubs for when the block layer is configured out
  */
-#define buffer_heads_over_limit 0
 
 static inline long nr_blockdev_pages(void)
 {
include/linux/buffer_head.h +1 -0
index 22fb11e2d2e04d..6b47f94378c5ad 100644
@@ -406,6 +406,7 @@ static inline int inode_has_buffers(struct inode *inode) { return 0; }
 static inline void invalidate_inode_buffers(struct inode *inode) {}
 static inline int remove_inode_buffers(struct inode *inode) { return 1; }
 static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
+#define buffer_heads_over_limit 0
 
 #endif /* CONFIG_BLOCK */
 #endif /* _LINUX_BUFFER_HEAD_H */
Signature · 1 line
2.26.2
Reviewed-by on v1 8/10
#22 lore raw

Re: [PATCH 08/10] fs: move the buffer_heads_over_limit stub to buffer_head.h

Quoted 2 lines · Christoph Hellwig

Move the !CONFIG_BLOCK stub to the same place as the non-stub declaration.

#24 lore raw

PATCH 9/10 block: reduce ifdef CONFIG_BLOCK madness in headers

In reply to Christoph Hellwig

Large part of bio.h, blkdev.h and genhd.h are under ifdef CONFIG_BLOCK for no good reason. Only stub out function that are called from code that is not dependent on CONFIG_BLOCK and leave the harmless other declarations around.

---
 include/linux/bio.h    |  3 --
 include/linux/blkdev.h | 92 ++++++++++++++++++------------------------
 include/linux/genhd.h  | 14 +++----
 3 files changed, 46 insertions(+), 63 deletions(-)
include/linux/bio.h +0 -3
index 91676d4b2dfe77..0282f8aa85935c 100644
@@ -8,8 +8,6 @@
 #include <linux/highmem.h>
 #include <linux/mempool.h>
 #include <linux/ioprio.h>
-
-#ifdef CONFIG_BLOCK
 /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
 #include <linux/blk_types.h>
 
@@ -824,5 +822,4 @@ static inline void bio_set_polled(struct bio *bio, struct kiocb *kiocb)
 		bio->bi_opf |= REQ_NOWAIT;
 }
 
-#endif /* CONFIG_BLOCK */
 #endif /* __LINUX_BIO_H */
include/linux/blkdev.h +40 -52

136 lines not on this page · raw message

include/linux/genhd.h +6 -8
index 83f8e0d8322836..31a54072ffd653 100644
@@ -19,8 +19,6 @@
 #include <linux/blk_types.h>
 #include <asm/local.h>
 
-#ifdef CONFIG_BLOCK
-
 #define dev_to_disk(device)	container_of((device), struct gendisk, part0.__dev)
 #define dev_to_part(device)	container_of((device), struct hd_struct, __dev)
 #define disk_to_dev(disk)	(&(disk)->part0.__dev)
@@ -337,12 +335,9 @@ static inline void set_capacity(struct gendisk *disk, sector_t size)
 	disk->part0.nr_sects = size;
 }
 
-extern dev_t blk_lookup_devt(const char *name, int partno);
-
 int bdev_disk_changed(struct block_device *bdev, bool invalidate);
 int blk_add_partitions(struct gendisk *disk, struct block_device *bdev);
 int blk_drop_partitions(struct block_device *bdev);
-extern void printk_all_partitions(void);
 
 extern struct gendisk *__alloc_disk_node(int minors, int node_id);
 extern struct kobject *get_disk_and_module(struct gendisk *disk);
@@ -400,10 +395,13 @@ static inline void bd_unlink_disk_holder(struct block_device *bdev,
 }
 #endif /* CONFIG_SYSFS */
 
+#ifdef CONFIG_BLOCK
+void printk_all_partitions(void);
+dev_t blk_lookup_devt(const char *name, int partno);
 #else /* CONFIG_BLOCK */
-
-static inline void printk_all_partitions(void) { }
-
+static inline void printk_all_partitions(void)
+{
+}
 static inline dev_t blk_lookup_devt(const char *name, int partno)
 {
 	dev_t devt = MKDEV(0, 0);
Signature · 1 line
2.26.2
#25 lore raw

PATCH 10/10 block: move struct block_device to blk_types.h

In reply to Christoph Hellwig

Move the struct block_device definition together with most of the block layer definitions, as it has nothing to do with the rest of fs.h.

---
 fs/adfs/super.c           |  1 +
 fs/befs/linuxvfs.c        |  1 +
 fs/efs/super.c            |  1 +
 fs/jfs/jfs_mount.c        |  1 +
 fs/jfs/resize.c           |  1 +
 include/linux/blk_types.h | 39 ++++++++++++++++++++++++++++++++++++-
 include/linux/blkdev.h    |  1 +
 include/linux/dasd_mod.h  |  2 ++
 include/linux/fs.h        | 41 ---------------------------------------
 9 files changed, 46 insertions(+), 42 deletions(-)
fs/adfs/super.c +1 -0
index a3cc8ecb50da1a..d553bb5bc17abd 100644
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/statfs.h>
 #include <linux/user_namespace.h>
+#include <linux/blkdev.h>
 #include "adfs.h"
 #include "dir_f.h"
 #include "dir_fplus.h"
fs/befs/linuxvfs.c +1 -0
index 64cdf4d8e42451..2482032021cac7 100644
@@ -22,6 +22,7 @@
 #include <linux/cred.h>
 #include <linux/exportfs.h>
 #include <linux/seq_file.h>
+#include <linux/blkdev.h>
 
 #include "befs.h"
 #include "btree.h"
fs/efs/super.c +1 -0
index 4a6ebff2af76f3..a4a945d0ac6a42 100644
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/buffer_head.h>
 #include <linux/vfs.h>
+#include <linux/blkdev.h>
 
 #include "efs.h"
 #include <linux/efs_vh.h>
fs/jfs/jfs_mount.c +1 -0
index eb8b9e233d73db..2935d4c776ec75 100644
@@ -36,6 +36,7 @@
 
 #include <linux/fs.h>
 #include <linux/buffer_head.h>
+#include <linux/blkdev.h>
 
 #include "jfs_incore.h"
 #include "jfs_filsys.h"
fs/jfs/resize.c +1 -0
index 66acea9d878b97..bde787c354fcc1 100644
@@ -6,6 +6,7 @@
 #include <linux/fs.h>
 #include <linux/buffer_head.h>
 #include <linux/quotaops.h>
+#include <linux/blkdev.h>
 #include "jfs_incore.h"
 #include "jfs_filsys.h"
 #include "jfs_metapage.h"
include/linux/blk_types.h +38 -1
index ccb895f911b185..a602132cbe32c2 100644
@@ -14,12 +14,49 @@ struct bio_set;
 struct bio;
 struct bio_integrity_payload;
 struct page;
-struct block_device;
 struct io_context;
 struct cgroup_subsys_state;
 typedef void (bio_end_io_t) (struct bio *);
 struct bio_crypt_ctx;
 
+struct block_device {
+	dev_t			bd_dev;  /* not a kdev_t - it's a search key */
+	int			bd_openers;
+	struct inode *		bd_inode;	/* will die */
+	struct super_block *	bd_super;
+	struct mutex		bd_mutex;	/* open/close mutex */
+	void *			bd_claiming;
+	void *			bd_holder;
+	int			bd_holders;
+	bool			bd_write_holder;
+#ifdef CONFIG_SYSFS
+	struct list_head	bd_holder_disks;
+#endif
+	struct block_device *	bd_contains;
+	unsigned		bd_block_size;
+	u8			bd_partno;
+	struct hd_struct *	bd_part;
+	/* number of times partitions within this device have been opened. */
+	unsigned		bd_part_count;
+	int			bd_invalidated;
+	struct gendisk *	bd_disk;
+	struct request_queue *  bd_queue;
+	struct backing_dev_info *bd_bdi;
+	struct list_head	bd_list;
+	/*
+	 * Private data.  You must have bd_claim'ed the block_device
+	 * to use this.  NOTE:  bd_claim allows an owner to claim
+	 * the same device multiple times, the owner must take special
+	 * care to not mess up bd_private for that case.
+	 */
+	unsigned long		bd_private;
+
+	/* The counter of freeze processes */
+	int			bd_fsfreeze_count;
+	/* Mutex for freeze */
+	struct mutex		bd_fsfreeze_mutex;
+} __randomize_layout;
+
 /*
  * Block error status values.  See block/blk-core:blk_errors for the details.
  * Alpha cannot write a byte atomically, so we need to use 32-bit value.
include/linux/blkdev.h +1 -0
index 0f021ee2ce1c3b..60d07e89582bfa 100644
@@ -1932,6 +1932,7 @@ 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 *I_BDEV(struct inode *inode);
 struct block_device *bdget(dev_t);
 struct block_device *bdgrab(struct block_device *bdev);
 void bdput(struct block_device *);
include/linux/dasd_mod.h +2 -0
index d39abad2ff6e4c..14e6cf8c62677f 100644
@@ -4,6 +4,8 @@
 
 #include <asm/dasd.h>
 
+struct gendisk;
+
 extern int dasd_biodasdinfo(struct gendisk *disk, dasd_information2_t *info);
 
 #endif
include/linux/fs.h +0 -41

53 lines not on this page · raw message

Signature · 1 line
2.26.2
maintainer
#27 lore raw
In reply to Christoph Hellwig
Quoted 22 lines · Christoph Hellwig

Hi Jens,

this series removes various remaining block bits out of fs.h and cleans up a few loose ends around that.

Diffstat:

 drivers/tty/sysrq.c         |    2 
 fs/adfs/super.c             |    1 
 fs/affs/file.c              |    1 
 fs/befs/linuxvfs.c          |    1 
 fs/block_dev.c              |    5 -
 fs/efs/super.c              |    1 
 fs/hfs/inode.c              |    1 
 fs/internal.h               |   17 +++-
 fs/jfs/jfs_mount.c          |    1 
 fs/jfs/resize.c             |    1 
 fs/ntfs/dir.c               |    1 
 fs/proc/devices.c           |    1 
 fs/quota/dquot.c            |    1 
 fs/reiserfs/procfs.c        |    1 
 include/linux/bio.h         |    3 
 include/linux/blk_types.h   |   39 +++++++++-
Quoted 8 lines
 include/linux/blkdev.h      |  140 ++++++++++++++++++++++--------------
 include/linux/buffer_head.h |    1 
 include/linux/dasd_mod.h    |    2 
 include/linux/fs.h          |  169 --------------------------------------------
 include/linux/genhd.h       |   39 ++++++++--
 include/linux/jbd2.h        |    1 
 security/loadpin/loadpin.c  |    1 
 23 files changed, 192 insertions(+), 238 deletions(-)

Applied for 5.9 - I kept this in a separate topic branch, fwiw. There's the potential for some annoying issues with this, so would rather have it in a branch we can modify easily, if we need to.

Signature · 1 line
Jens Axboe
#28 lore raw
Quoted 3 lines · Jens Axboe

Applied for 5.9 - I kept this in a separate topic branch, fwiw. There's the potential for some annoying issues with this, so would rather have it in a branch we can modify easily, if we need to.

Hmm, I have a bunch of things building on top of this pending, so that branch split will be interesting to handle.

maintainer
#29 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Jens Axboe

Applied for 5.9 - I kept this in a separate topic branch, fwiw. There's the potential for some annoying issues with this, so would rather have it in a branch we can modify easily, if we need to.

Hmm, I have a bunch of things building on top of this pending, so that branch split will be interesting to handle.

We can stuff it in for-5.9/block, but then I'd rather just rebase that on 5.8-rc2 now since it's still early days. If we don't, we already have conflicts...

Signature · 1 line
Jens Axboe
#30 lore raw
Quoted 6 lines · Jens Axboe
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Jens Axboe

Applied for 5.9 - I kept this in a separate topic branch, fwiw. There's the potential for some annoying issues with this, so would rather have it in a branch we can modify easily, if we need to.

Quoted 6 lines
Quoted 2 lines

Hmm, I have a bunch of things building on top of this pending, so that branch split will be interesting to handle.

We can stuff it in for-5.9/block, but then I'd rather just rebase that on 5.8-rc2 now since it's still early days. If we don't, we already have conflicts...

I'll happily rebase. rc1 also has funny ext4 warnings which are pretty annoying.

maintainer
#31 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Jens Axboe
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Jens Axboe

Applied for 5.9 - I kept this in a separate topic branch, fwiw. There's the potential for some annoying issues with this, so would rather have it in a branch we can modify easily, if we need to.

Hmm, I have a bunch of things building on top of this pending, so that branch split will be interesting to handle.

Quoted 6 lines
Quoted 3 lines

We can stuff it in for-5.9/block, but then I'd rather just rebase that on 5.8-rc2 now since it's still early days. If we don't, we already have conflicts...

I'll happily rebase. rc1 also has funny ext4 warnings which are pretty annoying.

Done, pushed it out.

Signature · 1 line
Jens Axboe