fs: add CONFIG_BUFFER_HEAD
authorChristoph Hellwig <hch@lst.de>
Tue, 1 Aug 2023 17:22:01 +0000 (19:22 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Aug 2023 15:13:09 +0000 (09:13 -0600)
Add a new config option that controls building the buffer_head code, and
select it from all file systems and stacking drivers that need it.

For the block device nodes and alternative iomap based buffered I/O path
is provided when buffer_head support is not enabled, and iomap needs a
a small tweak to define the IOMAP_F_BUFFER_HEAD flag to 0 to not call
into the buffer_head code when it doesn't exist.

Otherwise this is just Kconfig and ifdef changes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20230801172201.1923299-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
37 files changed:
block/fops.c
drivers/md/Kconfig
fs/Kconfig
fs/Makefile
fs/adfs/Kconfig
fs/affs/Kconfig
fs/befs/Kconfig
fs/bfs/Kconfig
fs/efs/Kconfig
fs/exfat/Kconfig
fs/ext2/Kconfig
fs/ext4/Kconfig
fs/f2fs/Kconfig
fs/fat/Kconfig
fs/freevxfs/Kconfig
fs/gfs2/Kconfig
fs/hfs/Kconfig
fs/hfsplus/Kconfig
fs/hpfs/Kconfig
fs/isofs/Kconfig
fs/jfs/Kconfig
fs/minix/Kconfig
fs/nilfs2/Kconfig
fs/ntfs/Kconfig
fs/ntfs3/Kconfig
fs/ocfs2/Kconfig
fs/omfs/Kconfig
fs/qnx4/Kconfig
fs/qnx6/Kconfig
fs/reiserfs/Kconfig
fs/sysv/Kconfig
fs/udf/Kconfig
fs/ufs/Kconfig
include/linux/buffer_head.h
include/linux/iomap.h
include/trace/events/block.h
mm/migrate.c

index 063ece37d44e44e487cf0f2b374b43b7f60e5ab4..eaa98a987213d2702f51b10cf5c4f1dc758d0149 100644 (file)
@@ -24,15 +24,6 @@ static inline struct inode *bdev_file_inode(struct file *file)
        return file->f_mapping->host;
 }
 
-static int blkdev_get_block(struct inode *inode, sector_t iblock,
-               struct buffer_head *bh, int create)
-{
-       bh->b_bdev = I_BDEV(inode);
-       bh->b_blocknr = iblock;
-       set_buffer_mapped(bh);
-       return 0;
-}
-
 static blk_opf_t dio_bio_write_op(struct kiocb *iocb)
 {
        blk_opf_t opf = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
@@ -400,7 +391,7 @@ static int blkdev_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
        iomap->type = IOMAP_MAPPED;
        iomap->addr = iomap->offset;
        iomap->length = isize - iomap->offset;
-       iomap->flags |= IOMAP_F_BUFFER_HEAD;
+       iomap->flags |= IOMAP_F_BUFFER_HEAD; /* noop for !CONFIG_BUFFER_HEAD */
        return 0;
 }
 
@@ -408,6 +399,16 @@ static const struct iomap_ops blkdev_iomap_ops = {
        .iomap_begin            = blkdev_iomap_begin,
 };
 
+#ifdef CONFIG_BUFFER_HEAD
+static int blkdev_get_block(struct inode *inode, sector_t iblock,
+               struct buffer_head *bh, int create)
+{
+       bh->b_bdev = I_BDEV(inode);
+       bh->b_blocknr = iblock;
+       set_buffer_mapped(bh);
+       return 0;
+}
+
 static int blkdev_writepage(struct page *page, struct writeback_control *wbc)
 {
        return block_write_full_page(page, blkdev_get_block, wbc);
@@ -453,6 +454,55 @@ const struct address_space_operations def_blk_aops = {
        .migrate_folio  = buffer_migrate_folio_norefs,
        .is_dirty_writeback = buffer_check_dirty_writeback,
 };
+#else /* CONFIG_BUFFER_HEAD */
+static int blkdev_read_folio(struct file *file, struct folio *folio)
+{
+       return iomap_read_folio(folio, &blkdev_iomap_ops);
+}
+
+static void blkdev_readahead(struct readahead_control *rac)
+{
+       iomap_readahead(rac, &blkdev_iomap_ops);
+}
+
+static int blkdev_map_blocks(struct iomap_writepage_ctx *wpc,
+               struct inode *inode, loff_t offset)
+{
+       loff_t isize = i_size_read(inode);
+
+       if (WARN_ON_ONCE(offset >= isize))
+               return -EIO;
+       if (offset >= wpc->iomap.offset &&
+           offset < wpc->iomap.offset + wpc->iomap.length)
+               return 0;
+       return blkdev_iomap_begin(inode, offset, isize - offset,
+                                 IOMAP_WRITE, &wpc->iomap, NULL);
+}
+
+static const struct iomap_writeback_ops blkdev_writeback_ops = {
+       .map_blocks             = blkdev_map_blocks,
+};
+
+static int blkdev_writepages(struct address_space *mapping,
+               struct writeback_control *wbc)
+{
+       struct iomap_writepage_ctx wpc = { };
+
+       return iomap_writepages(mapping, wbc, &wpc, &blkdev_writeback_ops);
+}
+
+const struct address_space_operations def_blk_aops = {
+       .dirty_folio    = filemap_dirty_folio,
+       .release_folio          = iomap_release_folio,
+       .invalidate_folio       = iomap_invalidate_folio,
+       .read_folio             = blkdev_read_folio,
+       .readahead              = blkdev_readahead,
+       .writepages             = blkdev_writepages,
+       .is_partially_uptodate  = iomap_is_partially_uptodate,
+       .error_remove_page      = generic_error_remove_page,
+       .migrate_folio          = filemap_migrate_folio,
+};
+#endif /* CONFIG_BUFFER_HEAD */
 
 /*
  * for a block special file file_inode(file)->i_size is zero
index 444517d1a2336aaafd75f026a5d088eb50adee26..2a8b081bce7dd8509d770b337908e82c946b076f 100644 (file)
@@ -15,6 +15,7 @@ if MD
 config BLK_DEV_MD
        tristate "RAID support"
        select BLOCK_HOLDER_DEPRECATED if SYSFS
+       select BUFFER_HEAD
        # BLOCK_LEGACY_AUTOLOAD requirement should be removed
        # after relevant mdadm enhancements - to make "names=yes"
        # the default - are widely available.
index 18d034ec79539f0469f98edee982a62501f78490..e8b17c81b83a8e5b0bdc5efed60cf82789641539 100644 (file)
@@ -18,8 +18,12 @@ config VALIDATE_FS_PARSER
 config FS_IOMAP
        bool
 
+config BUFFER_HEAD
+       bool
+
 # old blockdev_direct_IO implementation.  Use iomap for new code instead
 config LEGACY_DIRECT_IO
+       depends on BUFFER_HEAD
        bool
 
 if BLOCK
index e513aaee0603a043bc1b0adc68c26b2f65706ea5..f9541f40be4e08fbdee72f39e8c0c7ef856fb3f6 100644 (file)
@@ -17,7 +17,7 @@ obj-y :=      open.o read_write.o file_table.o super.o \
                fs_types.o fs_context.o fs_parser.o fsopen.o init.o \
                kernel_read_file.o mnt_idmapping.o remap_range.o
 
-obj-$(CONFIG_BLOCK)            += buffer.o mpage.o
+obj-$(CONFIG_BUFFER_HEAD)      += buffer.o mpage.o
 obj-$(CONFIG_PROC_FS)          += proc_namespace.o
 obj-$(CONFIG_LEGACY_DIRECT_IO) += direct-io.o
 obj-y                          += notify/
index 44738fed66251f40425fbebbac18ed904a8b9602..1b97058f0c4a9207b3d16ad2f6de3214428e4705 100644 (file)
@@ -2,6 +2,7 @@
 config ADFS_FS
        tristate "ADFS file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          The Acorn Disc Filing System is the standard file system of the
          RiscOS operating system which runs on Acorn's ARM-based Risc PC
index 962b86374e1c155561c7ddf514ae0cb5141d6c1e..1ae432d266c32f95c6b729e01b92e1fe83ebdf92 100644 (file)
@@ -2,6 +2,7 @@
 config AFFS_FS
        tristate "Amiga FFS file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        select LEGACY_DIRECT_IO
        help
          The Fast File System (FFS) is the common file system used on hard
index 9550b6462b8147014913c12d73c6e184f25c3eb0..5fcfc4024ffe6fec67fbb2f02d1a3e3ca0f27848 100644 (file)
@@ -2,6 +2,7 @@
 config BEFS_FS
        tristate "BeOS file system (BeFS) support (read only)"
        depends on BLOCK
+       select BUFFER_HEAD
        select NLS
        help
          The BeOS File System (BeFS) is the native file system of Be, Inc's
index 3a757805b585683a42dc62a0cf3fc0ad4193923d..8e7ef866b62a62b49ca2fa2d9d67c2c1e5f8d774 100644 (file)
@@ -2,6 +2,7 @@
 config BFS_FS
        tristate "BFS file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          Boot File System (BFS) is a file system used under SCO UnixWare to
          allow the bootloader access to the kernel image and other important
index 2df1bac8b375b1e9d70e6d73d344bdf223e1b794..0833e533df9d532349369f0e9f3f1b6cf1c44d49 100644 (file)
@@ -2,6 +2,7 @@
 config EFS_FS
        tristate "EFS file system support (read only)"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          EFS is an older file system used for non-ISO9660 CD-ROMs and hard
          disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer
index 147edeb044691df48afda100ae5275ff63d52c62..cbeca8e44d9b389a37ae392f2399d594dd543633 100644 (file)
@@ -2,6 +2,7 @@
 
 config EXFAT_FS
        tristate "exFAT filesystem support"
+       select BUFFER_HEAD
        select NLS
        select LEGACY_DIRECT_IO
        help
index 77393fda99af09d7e02107cdbc9d05f14a5f4b16..74d98965902e1690c08312037ac9002f63f1cfca 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config EXT2_FS
        tristate "Second extended fs support"
+       select BUFFER_HEAD
        select FS_IOMAP
        select LEGACY_DIRECT_IO
        help
index 86699c8cab281cbc2960f7433980d14af06f156d..e20d59221fc05b162bb72ebabdefb2b83d3cb26d 100644 (file)
@@ -28,6 +28,7 @@ config EXT3_FS_SECURITY
 
 config EXT4_FS
        tristate "The Extended 4 (ext4) filesystem"
+       select BUFFER_HEAD
        select JBD2
        select CRC16
        select CRYPTO
index 03ef087537c7c48d251e936a6d4c029b9dcc0592..68a1e23e1557c74bbc7b47e7b8c99ea6bf603474 100644 (file)
@@ -2,6 +2,7 @@
 config F2FS_FS
        tristate "F2FS filesystem support"
        depends on BLOCK
+       select BUFFER_HEAD
        select NLS
        select CRYPTO
        select CRYPTO_CRC32
index afe83b4e7172808aec5eab2677584fdeb6245129..25fae1c83725bc9293c26e9191690241d77b1295 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config FAT_FS
        tristate
+       select BUFFER_HEAD
        select NLS
        select LEGACY_DIRECT_IO
        help
index 0e2fc08f7de49262fd7833b208105f5896d82ec9..912107ebea6f40d1b19890bca44bb80759fe77ac 100644 (file)
@@ -2,6 +2,7 @@
 config VXFS_FS
        tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          FreeVxFS is a file system driver that support the VERITAS VxFS(TM)
          file system format.  VERITAS VxFS(TM) is the standard file system
index 03c966840422ecd670e347a2ebdf900957afb953..be7f87a8e11ae185fcde84063b2b9aadfa2cfbe6 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config GFS2_FS
        tristate "GFS2 file system support"
+       select BUFFER_HEAD
        select FS_POSIX_ACL
        select CRC32
        select LIBCRC32C
index d985066006d588565104f78ab4ebee8164c5a1a4..5ea5cd8ecea9c0323a9582721789d47c432f6e8f 100644 (file)
@@ -2,6 +2,7 @@
 config HFS_FS
        tristate "Apple Macintosh file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        select NLS
        select LEGACY_DIRECT_IO
        help
index 8034e7827a690bff92c9bd759113edfd43c0ebdc..8ce4a33a9ac7881fca1aadb3650b1ad4a45afa5f 100644 (file)
@@ -2,6 +2,7 @@
 config HFSPLUS_FS
        tristate "Apple Extended HFS file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        select NLS
        select NLS_UTF8
        select LEGACY_DIRECT_IO
index ec975f4668775f7b6bfeb4f275b8a24fe4978d8f..ac1e9318e65a4a39eafa3c07449639c05c19a8f3 100644 (file)
@@ -2,6 +2,7 @@
 config HPFS_FS
        tristate "OS/2 HPFS file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        select FS_IOMAP
        help
          OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
index 08ffd37b9bb8f65ea186881e519ca03638884422..51434f2a471b0fced9f97b7dbaf85e5a5eccc028 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config ISO9660_FS
        tristate "ISO 9660 CDROM file system support"
+       select BUFFER_HEAD
        help
          This is the standard file system used on CD-ROMs.  It was previously
          known as "High Sierra File System" and is called "hsfs" on other
index 51e856f0e4b8d6b907efafc65e444fcbbcf6c86f..17488440eef1a9ad8c80b9195993a078f9228a59 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config JFS_FS
        tristate "JFS filesystem support"
+       select BUFFER_HEAD
        select NLS
        select CRC32
        select LEGACY_DIRECT_IO
index de2003974ff0d095088275870f018f9d66f1fbcd..90ddfad2a75e8f010211cef3f2fbf79cbc6575cd 100644 (file)
@@ -2,6 +2,7 @@
 config MINIX_FS
        tristate "Minix file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          Minix is a simple operating system used in many classes about OS's.
          The minix file system (method to organize files on a hard disk
index 7d59567465e12121bdee436fd29e3eb7a6330db2..7dae168e346e30d32a0f1ddfbfc733408e600324 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config NILFS2_FS
        tristate "NILFS2 file system support"
+       select BUFFER_HEAD
        select CRC32
        select LEGACY_DIRECT_IO
        help
index f93e69a612833f8458d1020408d27ef15b2e921d..7b2509741735a98f0134d6945db801cee900698a 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config NTFS_FS
        tristate "NTFS file system support"
+       select BUFFER_HEAD
        select NLS
        help
          NTFS is the file system of Microsoft Windows NT, 2000, XP and 2003.
index 96cc236f7f7bd3bc3ed4355d89fbea88759d57af..cdfdf51e55d797e0e5fecc349e2f157f09fea7d8 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config NTFS3_FS
        tristate "NTFS Read-Write file system support"
+       select BUFFER_HEAD
        select NLS
        select LEGACY_DIRECT_IO
        help
index 3123da7cfb301f92a8ae2f6eec16c8d9f57e3e7d..2514d36cbe015728468a3890cdf9c684c52383d9 100644 (file)
@@ -2,6 +2,7 @@
 config OCFS2_FS
        tristate "OCFS2 file system support"
        depends on INET && SYSFS && CONFIGFS_FS
+       select BUFFER_HEAD
        select JBD2
        select CRC32
        select QUOTA
index 42b2ec35a05bfb503a3fc910493a9e14f9f6f97c..8470f6c3e64e6a9d54c49ee3f0de350a222093d1 100644 (file)
@@ -2,6 +2,7 @@
 config OMFS_FS
        tristate "SonicBlue Optimized MPEG File System support"
        depends on BLOCK
+       select BUFFER_HEAD
        select CRC_ITU_T
        help
          This is the proprietary file system used by the Rio Karma music
index 45b5b98376c43635551d9377e5282a716054c7de..a2eb826e76c602ef5fbfb1bfbd036363bcadecc2 100644 (file)
@@ -2,6 +2,7 @@
 config QNX4FS_FS
        tristate "QNX4 file system support (read only)"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          This is the file system used by the real-time operating systems
          QNX 4 and QNX 6 (the latter is also called QNX RTP).
index 6a9d6bce158622e7d0c39585484284d662a67113..8e865d72204e758cf5f104320500700406fb2872 100644 (file)
@@ -2,6 +2,7 @@
 config QNX6FS_FS
        tristate "QNX6 file system support (read only)"
        depends on BLOCK && CRC32
+       select BUFFER_HEAD
        help
          This is the file system used by the real-time operating systems
          QNX 6 (also called QNX RTP).
index 4d22ecfe0fab653924e7d4fae445af49f089b6d4..0e6fe26458fede95dd298b6a1123220810a8c5df 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config REISERFS_FS
        tristate "Reiserfs support (deprecated)"
+       select BUFFER_HEAD
        select CRC32
        select LEGACY_DIRECT_IO
        help
index b4e23e03fbeba3a7bde6661064efa603a1d189d7..67b3f90afbfd67605d0658d05463870417fa0712 100644 (file)
@@ -2,6 +2,7 @@
 config SYSV_FS
        tristate "System V/Xenix/V7/Coherent file system support"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          SCO, Xenix and Coherent are commercial Unix systems for Intel
          machines, and Version 7 was used on the DEC PDP-11. Saying Y
index 82e8bfa2dfd98942f6d551739fa1564e96d08648..8f7ce30d47fdce76cbd2a4a03c4c8ea62f9c759c 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config UDF_FS
        tristate "UDF file system support"
+       select BUFFER_HEAD
        select CRC_ITU_T
        select NLS
        select LEGACY_DIRECT_IO
index 6d30adb6b890fc84254d8801dfeb8cc2e5599196..9301e7ecd0921013d9312a1a15fa7593243c4197 100644 (file)
@@ -2,6 +2,7 @@
 config UFS_FS
        tristate "UFS file system support (read only)"
        depends on BLOCK
+       select BUFFER_HEAD
        help
          BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
          OpenBSD and NeXTstep) use a file system called UFS. Some System V
index 7002a9ff63a3daf0f59956266a6c9ab16ed9346a..c89ef50d5112fc9ad8c8eae471605d4624044af8 100644 (file)
@@ -16,8 +16,6 @@
 #include <linux/wait.h>
 #include <linux/atomic.h>
 
-#ifdef CONFIG_BLOCK
-
 enum bh_state_bits {
        BH_Uptodate,    /* Contains valid data */
        BH_Dirty,       /* Is dirty */
@@ -198,7 +196,6 @@ void set_bh_page(struct buffer_head *bh,
                struct page *page, unsigned long offset);
 void folio_set_bh(struct buffer_head *bh, struct folio *folio,
                  unsigned long offset);
-bool try_to_free_buffers(struct folio *);
 struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
                                        bool retry);
 struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
@@ -213,10 +210,6 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate);
 
 /* Things to do with buffers at mapping->private_list */
 void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
-int inode_has_buffers(struct inode *);
-void invalidate_inode_buffers(struct inode *);
-int remove_inode_buffers(struct inode *inode);
-int sync_mapping_buffers(struct address_space *mapping);
 int generic_buffers_fsync_noflush(struct file *file, loff_t start, loff_t end,
                                  bool datasync);
 int generic_buffers_fsync(struct file *file, loff_t start, loff_t end,
@@ -240,9 +233,6 @@ void __bforget(struct buffer_head *);
 void __breadahead(struct block_device *, sector_t block, unsigned int size);
 struct buffer_head *__bread_gfp(struct block_device *,
                                sector_t block, unsigned size, gfp_t gfp);
-void invalidate_bh_lrus(void);
-void invalidate_bh_lrus_cpu(void);
-bool has_bh_in_lru(int cpu, void *dummy);
 struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
 void free_buffer_head(struct buffer_head * bh);
 void unlock_buffer(struct buffer_head *bh);
@@ -258,8 +248,6 @@ int __bh_read(struct buffer_head *bh, blk_opf_t op_flags, bool wait);
 void __bh_read_batch(int nr, struct buffer_head *bhs[],
                     blk_opf_t op_flags, bool force_lock);
 
-extern int buffer_heads_over_limit;
-
 /*
  * Generic address_space_operations implementations for buffer_head-backed
  * address_spaces.
@@ -304,8 +292,6 @@ extern int buffer_migrate_folio_norefs(struct address_space *,
 #define buffer_migrate_folio_norefs NULL
 #endif
 
-void buffer_init(void);
-
 /*
  * inline definitions
  */
@@ -465,7 +451,20 @@ __bread(struct block_device *bdev, sector_t block, unsigned size)
 
 bool block_dirty_folio(struct address_space *mapping, struct folio *folio);
 
-#else /* CONFIG_BLOCK */
+#ifdef CONFIG_BUFFER_HEAD
+
+void buffer_init(void);
+bool try_to_free_buffers(struct folio *folio);
+int inode_has_buffers(struct inode *inode);
+void invalidate_inode_buffers(struct inode *inode);
+int remove_inode_buffers(struct inode *inode);
+int sync_mapping_buffers(struct address_space *mapping);
+void invalidate_bh_lrus(void);
+void invalidate_bh_lrus_cpu(void);
+bool has_bh_in_lru(int cpu, void *dummy);
+extern int buffer_heads_over_limit;
+
+#else /* CONFIG_BUFFER_HEAD */
 
 static inline void buffer_init(void) {}
 static inline bool try_to_free_buffers(struct folio *folio) { return true; }
@@ -473,9 +472,10 @@ 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; }
+static inline void invalidate_bh_lrus(void) {}
 static inline void invalidate_bh_lrus_cpu(void) {}
 static inline bool has_bh_in_lru(int cpu, void *dummy) { return false; }
 #define buffer_heads_over_limit 0
 
-#endif /* CONFIG_BLOCK */
+#endif /* CONFIG_BUFFER_HEAD */
 #endif /* _LINUX_BUFFER_HEAD_H */
index e2b836c2e119ae7d574874ddd35732a4e30e7d3a..54f50d34fd9d4fc63af844622d2625e4e4eb88c1 100644 (file)
@@ -58,7 +58,11 @@ struct vm_fault;
 #define IOMAP_F_DIRTY          (1U << 1)
 #define IOMAP_F_SHARED         (1U << 2)
 #define IOMAP_F_MERGED         (1U << 3)
+#ifdef CONFIG_BUFFER_HEAD
 #define IOMAP_F_BUFFER_HEAD    (1U << 4)
+#else
+#define IOMAP_F_BUFFER_HEAD    0
+#endif /* CONFIG_BUFFER_HEAD */
 #define IOMAP_F_XATTR          (1U << 5)
 
 /*
index 40e60c33cc6f3d8da3da47f4bb745d1f5e1c749c..0e128ad5146015f703e12245422691e1fb34574b 100644 (file)
@@ -12,6 +12,7 @@
 
 #define RWBS_LEN       8
 
+#ifdef CONFIG_BUFFER_HEAD
 DECLARE_EVENT_CLASS(block_buffer,
 
        TP_PROTO(struct buffer_head *bh),
@@ -61,6 +62,7 @@ DEFINE_EVENT(block_buffer, block_dirty_buffer,
 
        TP_ARGS(bh)
 );
+#endif /* CONFIG_BUFFER_HEAD */
 
 /**
  * block_rq_requeue - place block IO request back on a queue
index 24baad2571e314740f3d85f32292e9fac2072648..fe6f8d454aff83e738fc9800b07dc9e043fcaa6d 100644 (file)
@@ -684,7 +684,7 @@ int migrate_folio(struct address_space *mapping, struct folio *dst,
 }
 EXPORT_SYMBOL(migrate_folio);
 
-#ifdef CONFIG_BLOCK
+#ifdef CONFIG_BUFFER_HEAD
 /* Returns true if all buffers are successfully locked */
 static bool buffer_migrate_lock_buffers(struct buffer_head *head,
                                                        enum migrate_mode mode)
@@ -837,7 +837,7 @@ int buffer_migrate_folio_norefs(struct address_space *mapping,
        return __buffer_migrate_folio(mapping, dst, src, mode, true);
 }
 EXPORT_SYMBOL_GPL(buffer_migrate_folio_norefs);
-#endif
+#endif /* CONFIG_BUFFER_HEAD */
 
 int filemap_migrate_folio(struct address_space *mapping,
                struct folio *dst, struct folio *src, enum migrate_mode mode)