for-6.3/dio-2023-02-16

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmPueAQQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgplopEACo17a4Z2p2xCedA0NCqX2ggtsSIdYiluPm
 pgdBzIEsgwKo1XVLGRgGiC8VdMRuzO4Zh/NGn4iRF1a68wjgjnwGWY7r052TUoSr
 q1yya739BpffnkXjj15x86cwl+5rHv2RQkm15+2HqBgcruA63/ZgdKBtjj+EtVKs
 zYOlmgyfFbkn8AdULMGiDKP4lixV8gUelv6vWneBwNrj4iSLnuN1+8nJNsl4wxwg
 ImSpx63AzhUoeL6byc+fmiA8fZhDhSvwON2tCyyCmOjlFM/TLrsm5t1juWiDid1O
 UROkQwQtsmjSUq3ow5fRJfjbZ3HLa1uGQr95DYHy0OBRAteAhDY5Upv0DXNL0ZBh
 uNNg8AXtJbyc+pLHWnncyiTzi+3eWs7WiMn04/a5eDhFvcJ0PZjLIgRi5j1ezUS1
 bWqoPaAIxoMD83WoMxjnKvBpGeMzPHvNTijeZjkGOu0vOk8JhXqNmLTjNG9aLtzf
 1Nvp0o8AqtQAW7cgFazZSWtw4bPk/wZ7mW0zHtqLDHIzXkc7A/Uo0ftdv84G08aW
 pvakNz4aNLwSPf7hxgPP9SgS9CeHhxK8PS6uk3V788SI8qGiew11+EcTNGkQNmvw
 /ItCo93UaWD/7SZLObTLslmet7rFHzz6PXaXrMxrSvaeZMkgr7DWEy9XS+ueOtXO
 fS8QhJX11w==
 =IU45
 -----END PGP SIGNATURE-----

Merge tag 'for-6.3/dio-2023-02-16' of git://git.kernel.dk/linux

Pull legacy dio update from Jens Axboe:
 "We only have a few file systems that use the old dio code, make them
  select it rather than build it unconditionally"

* tag 'for-6.3/dio-2023-02-16' of git://git.kernel.dk/linux:
  fs: build the legacy direct I/O code conditionally
  fs: move sb_init_dio_done_wq out of direct-io.c
This commit is contained in:
Linus Torvalds 2023-02-20 14:10:36 -08:00
commit 553637f73c
17 changed files with 43 additions and 28 deletions

View file

@ -18,6 +18,10 @@ config VALIDATE_FS_PARSER
config FS_IOMAP config FS_IOMAP
bool bool
# old blockdev_direct_IO implementation. Use iomap for new code instead
config LEGACY_DIRECT_IO
bool
if BLOCK if BLOCK
source "fs/ext2/Kconfig" source "fs/ext2/Kconfig"

View file

@ -19,13 +19,14 @@ obj-y := open.o read_write.o file_table.o super.o \
kernel_read_file.o mnt_idmapping.o remap_range.o kernel_read_file.o mnt_idmapping.o remap_range.o
ifeq ($(CONFIG_BLOCK),y) ifeq ($(CONFIG_BLOCK),y)
obj-y += buffer.o direct-io.o mpage.o obj-y += buffer.o mpage.o
else else
obj-y += no-block.o obj-y += no-block.o
endif endif
obj-$(CONFIG_PROC_FS) += proc_namespace.o obj-$(CONFIG_PROC_FS) += proc_namespace.o
obj-$(CONFIG_LEGACY_DIRECT_IO) += direct-io.o
obj-y += notify/ obj-y += notify/
obj-$(CONFIG_EPOLL) += eventpoll.o obj-$(CONFIG_EPOLL) += eventpoll.o
obj-y += anon_inodes.o obj-y += anon_inodes.o

View file

@ -2,6 +2,7 @@
config AFFS_FS config AFFS_FS
tristate "Amiga FFS file system support" tristate "Amiga FFS file system support"
depends on BLOCK depends on BLOCK
select LEGACY_DIRECT_IO
help help
The Fast File System (FFS) is the common file system used on hard The Fast File System (FFS) is the common file system used on hard
disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y

View file

@ -558,30 +558,6 @@ static inline int dio_bio_reap(struct dio *dio, struct dio_submit *sdio)
return ret; return ret;
} }
/*
* Create workqueue for deferred direct IO completions. We allocate the
* workqueue when it's first needed. This avoids creating workqueue for
* filesystems that don't need it and also allows us to create the workqueue
* late enough so the we can include s_id in the name of the workqueue.
*/
int sb_init_dio_done_wq(struct super_block *sb)
{
struct workqueue_struct *old;
struct workqueue_struct *wq = alloc_workqueue("dio/%s",
WQ_MEM_RECLAIM, 0,
sb->s_id);
if (!wq)
return -ENOMEM;
/*
* This has to be atomic as more DIOs can race to create the workqueue
*/
old = cmpxchg(&sb->s_dio_done_wq, NULL, wq);
/* Someone created workqueue before us? Free ours... */
if (old)
destroy_workqueue(wq);
return 0;
}
static int dio_set_defer_completion(struct dio *dio) static int dio_set_defer_completion(struct dio *dio)
{ {
struct super_block *sb = dio->inode->i_sb; struct super_block *sb = dio->inode->i_sb;

View file

@ -3,6 +3,7 @@
config EXFAT_FS config EXFAT_FS
tristate "exFAT filesystem support" tristate "exFAT filesystem support"
select NLS select NLS
select LEGACY_DIRECT_IO
help help
This allows you to mount devices formatted with the exFAT file system. This allows you to mount devices formatted with the exFAT file system.
exFAT is typically used on SD-Cards or USB sticks. exFAT is typically used on SD-Cards or USB sticks.

View file

@ -2,6 +2,7 @@
config EXT2_FS config EXT2_FS
tristate "Second extended fs support" tristate "Second extended fs support"
select FS_IOMAP select FS_IOMAP
select LEGACY_DIRECT_IO
help help
Ext2 is a standard Linux file system for hard disks. Ext2 is a standard Linux file system for hard disks.

View file

@ -2,6 +2,7 @@
config FAT_FS config FAT_FS
tristate tristate
select NLS select NLS
select LEGACY_DIRECT_IO
help help
If you want to use one of the FAT-based file systems (the MS-DOS and If you want to use one of the FAT-based file systems (the MS-DOS and
VFAT (Windows 95) file systems), then you must say Y or M here VFAT (Windows 95) file systems), then you must say Y or M here

View file

@ -3,6 +3,7 @@ config HFS_FS
tristate "Apple Macintosh file system support" tristate "Apple Macintosh file system support"
depends on BLOCK depends on BLOCK
select NLS select NLS
select LEGACY_DIRECT_IO
help help
If you say Y here, you will be able to mount Macintosh-formatted If you say Y here, you will be able to mount Macintosh-formatted
floppy disks and hard drive partitions with full read-write access. floppy disks and hard drive partitions with full read-write access.

View file

@ -4,6 +4,7 @@ config HFSPLUS_FS
depends on BLOCK depends on BLOCK
select NLS select NLS
select NLS_UTF8 select NLS_UTF8
select LEGACY_DIRECT_IO
help help
If you say Y here, you will be able to mount extended format If you say Y here, you will be able to mount extended format
Macintosh-formatted hard drive partitions with full read-write access. Macintosh-formatted hard drive partitions with full read-write access.

View file

@ -120,6 +120,7 @@ extern bool trylock_super(struct super_block *sb);
struct super_block *user_get_super(dev_t, bool excl); struct super_block *user_get_super(dev_t, bool excl);
void put_super(struct super_block *sb); void put_super(struct super_block *sb);
extern bool mount_capable(struct fs_context *); extern bool mount_capable(struct fs_context *);
int sb_init_dio_done_wq(struct super_block *sb);
/* /*
* open.c * open.c
@ -187,9 +188,6 @@ extern void mnt_pin_kill(struct mount *m);
*/ */
extern const struct dentry_operations ns_dentry_operations; extern const struct dentry_operations ns_dentry_operations;
/* direct-io.c: */
int sb_init_dio_done_wq(struct super_block *sb);
/* /*
* fs/stat.c: * fs/stat.c:
*/ */

View file

@ -3,6 +3,7 @@ config JFS_FS
tristate "JFS filesystem support" tristate "JFS filesystem support"
select NLS select NLS
select CRC32 select CRC32
select LEGACY_DIRECT_IO
help help
This is a port of IBM's Journaled Filesystem . More information is This is a port of IBM's Journaled Filesystem . More information is
available in the file <file:Documentation/admin-guide/jfs.rst>. available in the file <file:Documentation/admin-guide/jfs.rst>.

View file

@ -2,6 +2,7 @@
config NILFS2_FS config NILFS2_FS
tristate "NILFS2 file system support" tristate "NILFS2 file system support"
select CRC32 select CRC32
select LEGACY_DIRECT_IO
help help
NILFS2 is a log-structured file system (LFS) supporting continuous NILFS2 is a log-structured file system (LFS) supporting continuous
snapshotting. In addition to versioning capability of the entire snapshotting. In addition to versioning capability of the entire

View file

@ -2,6 +2,7 @@
config NTFS3_FS config NTFS3_FS
tristate "NTFS Read-Write file system support" tristate "NTFS Read-Write file system support"
select NLS select NLS
select LEGACY_DIRECT_IO
help help
Windows OS native file system (NTFS) support up to NTFS version 3.1. Windows OS native file system (NTFS) support up to NTFS version 3.1.

View file

@ -7,6 +7,7 @@ config OCFS2_FS
select QUOTA select QUOTA
select QUOTA_TREE select QUOTA_TREE
select FS_POSIX_ACL select FS_POSIX_ACL
select LEGACY_DIRECT_IO
help help
OCFS2 is a general purpose extent based shared disk cluster file OCFS2 is a general purpose extent based shared disk cluster file
system with many similarities to ext3. It supports 64 bit inode system with many similarities to ext3. It supports 64 bit inode

View file

@ -2,6 +2,7 @@
config REISERFS_FS config REISERFS_FS
tristate "Reiserfs support (deprecated)" tristate "Reiserfs support (deprecated)"
select CRC32 select CRC32
select LEGACY_DIRECT_IO
help help
Reiserfs is deprecated and scheduled to be removed from the kernel Reiserfs is deprecated and scheduled to be removed from the kernel
in 2025. If you are still using it, please migrate to another in 2025. If you are still using it, please migrate to another

View file

@ -1776,3 +1776,27 @@ int thaw_super(struct super_block *sb)
return thaw_super_locked(sb); return thaw_super_locked(sb);
} }
EXPORT_SYMBOL(thaw_super); EXPORT_SYMBOL(thaw_super);
/*
* Create workqueue for deferred direct IO completions. We allocate the
* workqueue when it's first needed. This avoids creating workqueue for
* filesystems that don't need it and also allows us to create the workqueue
* late enough so the we can include s_id in the name of the workqueue.
*/
int sb_init_dio_done_wq(struct super_block *sb)
{
struct workqueue_struct *old;
struct workqueue_struct *wq = alloc_workqueue("dio/%s",
WQ_MEM_RECLAIM, 0,
sb->s_id);
if (!wq)
return -ENOMEM;
/*
* This has to be atomic as more DIOs can race to create the workqueue
*/
old = cmpxchg(&sb->s_dio_done_wq, NULL, wq);
/* Someone created workqueue before us? Free ours... */
if (old)
destroy_workqueue(wq);
return 0;
}

View file

@ -3,6 +3,7 @@ config UDF_FS
tristate "UDF file system support" tristate "UDF file system support"
select CRC_ITU_T select CRC_ITU_T
select NLS select NLS
select LEGACY_DIRECT_IO
help help
This is a file system used on some CD-ROMs and DVDs. Since the This is a file system used on some CD-ROMs and DVDs. Since the
file system is supported by multiple operating systems and is more file system is supported by multiple operating systems and is more