diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-20 23:10:36 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-20 23:10:36 +0100 |
commit | 553637f73c314c742243b8dc5ef072e9dadbe581 (patch) | |
tree | 1c94c2f76775871b23a807f836c395751bede619 /fs/super.c | |
parent | Merge tag 'for-6.3/iter-ubuf-2023-02-16' of git://git.kernel.dk/linux (diff) | |
parent | fs: build the legacy direct I/O code conditionally (diff) | |
download | linux-553637f73c314c742243b8dc5ef072e9dadbe581.tar.xz linux-553637f73c314c742243b8dc5ef072e9dadbe581.zip |
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
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/super.c b/fs/super.c index 8e531174e7c2..84332d5cb817 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1776,3 +1776,27 @@ int thaw_super(struct super_block *sb) return thaw_super_locked(sb); } 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; +} |