Skip to content

Commit dfc0f63

Browse files
committed
Merge tag 'erofs-for-6.17-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs
Pull erofs fixes from Gao Xiang: - Align FSDAX enablement among multiple devices - Fix EROFS_FS_ZIP_ACCEL build dependency again to prevent forcing CRYPTO{,_DEFLATE}=y even if EROFS=m - Fix atomic context detection to properly launch kworkers on demand - Fix block count statistics for 48-bit addressing support * tag 'erofs-for-6.17-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: fix block count report when 48-bit layout is on erofs: fix atomic context detection when !CONFIG_DEBUG_LOCK_ALLOC erofs: Do not select tristate symbols from bool symbols erofs: Fallback to normal access if DAX is not supported on extra device
2 parents 3a4a036 + 0b96d9b commit dfc0f63

File tree

3 files changed

+37
-24
lines changed

3 files changed

+37
-24
lines changed

fs/erofs/Kconfig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33
config EROFS_FS
44
tristate "EROFS filesystem support"
55
depends on BLOCK
6+
select CACHEFILES if EROFS_FS_ONDEMAND
67
select CRC32
8+
select CRYPTO if EROFS_FS_ZIP_ACCEL
9+
select CRYPTO_DEFLATE if EROFS_FS_ZIP_ACCEL
710
select FS_IOMAP
11+
select LZ4_DECOMPRESS if EROFS_FS_ZIP
12+
select NETFS_SUPPORT if EROFS_FS_ONDEMAND
13+
select XXHASH if EROFS_FS_XATTR
14+
select XZ_DEC if EROFS_FS_ZIP_LZMA
15+
select XZ_DEC_MICROLZMA if EROFS_FS_ZIP_LZMA
16+
select ZLIB_INFLATE if EROFS_FS_ZIP_DEFLATE
17+
select ZSTD_DECOMPRESS if EROFS_FS_ZIP_ZSTD
818
help
919
EROFS (Enhanced Read-Only File System) is a lightweight read-only
1020
file system with modern designs (e.g. no buffer heads, inline
@@ -38,7 +48,6 @@ config EROFS_FS_DEBUG
3848
config EROFS_FS_XATTR
3949
bool "EROFS extended attributes"
4050
depends on EROFS_FS
41-
select XXHASH
4251
default y
4352
help
4453
Extended attributes are name:value pairs associated with inodes by
@@ -94,7 +103,6 @@ config EROFS_FS_BACKED_BY_FILE
94103
config EROFS_FS_ZIP
95104
bool "EROFS Data Compression Support"
96105
depends on EROFS_FS
97-
select LZ4_DECOMPRESS
98106
default y
99107
help
100108
Enable transparent compression support for EROFS file systems.
@@ -104,8 +112,6 @@ config EROFS_FS_ZIP
104112
config EROFS_FS_ZIP_LZMA
105113
bool "EROFS LZMA compressed data support"
106114
depends on EROFS_FS_ZIP
107-
select XZ_DEC
108-
select XZ_DEC_MICROLZMA
109115
help
110116
Saying Y here includes support for reading EROFS file systems
111117
containing LZMA compressed data, specifically called microLZMA. It
@@ -117,7 +123,6 @@ config EROFS_FS_ZIP_LZMA
117123
config EROFS_FS_ZIP_DEFLATE
118124
bool "EROFS DEFLATE compressed data support"
119125
depends on EROFS_FS_ZIP
120-
select ZLIB_INFLATE
121126
help
122127
Saying Y here includes support for reading EROFS file systems
123128
containing DEFLATE compressed data. It gives better compression
@@ -132,7 +137,6 @@ config EROFS_FS_ZIP_DEFLATE
132137
config EROFS_FS_ZIP_ZSTD
133138
bool "EROFS Zstandard compressed data support"
134139
depends on EROFS_FS_ZIP
135-
select ZSTD_DECOMPRESS
136140
help
137141
Saying Y here includes support for reading EROFS file systems
138142
containing Zstandard compressed data. It gives better compression
@@ -147,8 +151,6 @@ config EROFS_FS_ZIP_ZSTD
147151
config EROFS_FS_ZIP_ACCEL
148152
bool "EROFS hardware decompression support"
149153
depends on EROFS_FS_ZIP
150-
select CRYPTO
151-
select CRYPTO_DEFLATE
152154
help
153155
Saying Y here includes hardware accelerator support for reading
154156
EROFS file systems containing compressed data. It gives better
@@ -163,9 +165,7 @@ config EROFS_FS_ZIP_ACCEL
163165
config EROFS_FS_ONDEMAND
164166
bool "EROFS fscache-based on-demand read support (deprecated)"
165167
depends on EROFS_FS
166-
select NETFS_SUPPORT
167168
select FSCACHE
168-
select CACHEFILES
169169
select CACHEFILES_ONDEMAND
170170
help
171171
This permits EROFS to use fscache-backed data blobs with on-demand

fs/erofs/super.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
174174
if (!erofs_is_fileio_mode(sbi)) {
175175
dif->dax_dev = fs_dax_get_by_bdev(file_bdev(file),
176176
&dif->dax_part_off, NULL, NULL);
177+
if (!dif->dax_dev && test_opt(&sbi->opt, DAX_ALWAYS)) {
178+
erofs_info(sb, "DAX unsupported by %s. Turning off DAX.",
179+
dif->path);
180+
clear_opt(&sbi->opt, DAX_ALWAYS);
181+
}
177182
} else if (!S_ISREG(file_inode(file)->i_mode)) {
178183
fput(file);
179184
return -EINVAL;
@@ -210,8 +215,13 @@ static int erofs_scan_devices(struct super_block *sb,
210215
ondisk_extradevs, sbi->devs->extra_devices);
211216
return -EINVAL;
212217
}
213-
if (!ondisk_extradevs)
218+
if (!ondisk_extradevs) {
219+
if (test_opt(&sbi->opt, DAX_ALWAYS) && !sbi->dif0.dax_dev) {
220+
erofs_info(sb, "DAX unsupported by block device. Turning off DAX.");
221+
clear_opt(&sbi->opt, DAX_ALWAYS);
222+
}
214223
return 0;
224+
}
215225

216226
if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb))
217227
sbi->devs->flatdev = true;
@@ -313,8 +323,8 @@ static int erofs_read_superblock(struct super_block *sb)
313323
sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact));
314324
if (erofs_sb_has_48bit(sbi) && dsb->rootnid_8b) {
315325
sbi->root_nid = le64_to_cpu(dsb->rootnid_8b);
316-
sbi->dif0.blocks = (sbi->dif0.blocks << 32) |
317-
le16_to_cpu(dsb->rb.blocks_hi);
326+
sbi->dif0.blocks = sbi->dif0.blocks |
327+
((u64)le16_to_cpu(dsb->rb.blocks_hi) << 32);
318328
} else {
319329
sbi->root_nid = le16_to_cpu(dsb->rb.rootnid_2b);
320330
}
@@ -338,7 +348,6 @@ static int erofs_read_superblock(struct super_block *sb)
338348
if (ret < 0)
339349
goto out;
340350

341-
/* handle multiple devices */
342351
ret = erofs_scan_devices(sb, dsb);
343352

344353
if (erofs_sb_has_48bit(sbi))
@@ -671,14 +680,9 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
671680
return invalfc(fc, "cannot use fsoffset in fscache mode");
672681
}
673682

674-
if (test_opt(&sbi->opt, DAX_ALWAYS)) {
675-
if (!sbi->dif0.dax_dev) {
676-
errorfc(fc, "DAX unsupported by block device. Turning off DAX.");
677-
clear_opt(&sbi->opt, DAX_ALWAYS);
678-
} else if (sbi->blkszbits != PAGE_SHIFT) {
679-
errorfc(fc, "unsupported blocksize for DAX");
680-
clear_opt(&sbi->opt, DAX_ALWAYS);
681-
}
683+
if (test_opt(&sbi->opt, DAX_ALWAYS) && sbi->blkszbits != PAGE_SHIFT) {
684+
erofs_info(sb, "unsupported blocksize for DAX");
685+
clear_opt(&sbi->opt, DAX_ALWAYS);
682686
}
683687

684688
sb->s_time_gran = 1;

fs/erofs/zdata.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,16 @@ static void z_erofs_decompressqueue_kthread_work(struct kthread_work *work)
14321432
}
14331433
#endif
14341434

1435+
/* Use (kthread_)work in atomic contexts to minimize scheduling overhead */
1436+
static inline bool z_erofs_in_atomic(void)
1437+
{
1438+
if (IS_ENABLED(CONFIG_PREEMPTION) && rcu_preempt_depth())
1439+
return true;
1440+
if (!IS_ENABLED(CONFIG_PREEMPT_COUNT))
1441+
return true;
1442+
return !preemptible();
1443+
}
1444+
14351445
static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
14361446
int bios)
14371447
{
@@ -1446,8 +1456,7 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
14461456

14471457
if (atomic_add_return(bios, &io->pending_bios))
14481458
return;
1449-
/* Use (kthread_)work and sync decompression for atomic contexts only */
1450-
if (!in_task() || irqs_disabled() || rcu_read_lock_any_held()) {
1459+
if (z_erofs_in_atomic()) {
14511460
#ifdef CONFIG_EROFS_FS_PCPU_KTHREAD
14521461
struct kthread_worker *worker;
14531462

0 commit comments

Comments
 (0)