Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

f2fs: expand scalability of f2fs mount option

opt field in structure f2fs_mount_info and opt_mask field in structure
f2fs_fs_context is 32-bits variable, now we're running out of available
bits in them, let's expand them to 64-bits for better scalability.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Chao Yu and committed by
Jaegeuk Kim
1627a303 d31e0de8

+63 -58
+45 -40
fs/f2fs/f2fs.h
··· 96 96 /* 97 97 * For mount options 98 98 */ 99 - #define F2FS_MOUNT_DISABLE_ROLL_FORWARD 0x00000001 100 - #define F2FS_MOUNT_DISCARD 0x00000002 101 - #define F2FS_MOUNT_NOHEAP 0x00000004 102 - #define F2FS_MOUNT_XATTR_USER 0x00000008 103 - #define F2FS_MOUNT_POSIX_ACL 0x00000010 104 - #define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000020 105 - #define F2FS_MOUNT_INLINE_XATTR 0x00000040 106 - #define F2FS_MOUNT_INLINE_DATA 0x00000080 107 - #define F2FS_MOUNT_INLINE_DENTRY 0x00000100 108 - #define F2FS_MOUNT_FLUSH_MERGE 0x00000200 109 - #define F2FS_MOUNT_NOBARRIER 0x00000400 110 - #define F2FS_MOUNT_FASTBOOT 0x00000800 111 - #define F2FS_MOUNT_READ_EXTENT_CACHE 0x00001000 112 - #define F2FS_MOUNT_DATA_FLUSH 0x00002000 113 - #define F2FS_MOUNT_FAULT_INJECTION 0x00004000 114 - #define F2FS_MOUNT_USRQUOTA 0x00008000 115 - #define F2FS_MOUNT_GRPQUOTA 0x00010000 116 - #define F2FS_MOUNT_PRJQUOTA 0x00020000 117 - #define F2FS_MOUNT_QUOTA 0x00040000 118 - #define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00080000 119 - #define F2FS_MOUNT_RESERVE_ROOT 0x00100000 120 - #define F2FS_MOUNT_DISABLE_CHECKPOINT 0x00200000 121 - #define F2FS_MOUNT_NORECOVERY 0x00400000 122 - #define F2FS_MOUNT_ATGC 0x00800000 123 - #define F2FS_MOUNT_MERGE_CHECKPOINT 0x01000000 124 - #define F2FS_MOUNT_GC_MERGE 0x02000000 125 - #define F2FS_MOUNT_COMPRESS_CACHE 0x04000000 126 - #define F2FS_MOUNT_AGE_EXTENT_CACHE 0x08000000 127 - #define F2FS_MOUNT_NAT_BITS 0x10000000 128 - #define F2FS_MOUNT_INLINECRYPT 0x20000000 129 - /* 130 - * Some f2fs environments expect to be able to pass the "lazytime" option 131 - * string rather than using the MS_LAZYTIME flag, so this must remain. 132 - */ 133 - #define F2FS_MOUNT_LAZYTIME 0x40000000 134 - #define F2FS_MOUNT_RESERVE_NODE 0x80000000 99 + enum f2fs_mount_opt { 100 + F2FS_MOUNT_DISABLE_ROLL_FORWARD, 101 + F2FS_MOUNT_DISCARD, 102 + F2FS_MOUNT_NOHEAP, 103 + F2FS_MOUNT_XATTR_USER, 104 + F2FS_MOUNT_POSIX_ACL, 105 + F2FS_MOUNT_DISABLE_EXT_IDENTIFY, 106 + F2FS_MOUNT_INLINE_XATTR, 107 + F2FS_MOUNT_INLINE_DATA, 108 + F2FS_MOUNT_INLINE_DENTRY, 109 + F2FS_MOUNT_FLUSH_MERGE, 110 + F2FS_MOUNT_NOBARRIER, 111 + F2FS_MOUNT_FASTBOOT, 112 + F2FS_MOUNT_READ_EXTENT_CACHE, 113 + F2FS_MOUNT_DATA_FLUSH, 114 + F2FS_MOUNT_FAULT_INJECTION, 115 + F2FS_MOUNT_USRQUOTA, 116 + F2FS_MOUNT_GRPQUOTA, 117 + F2FS_MOUNT_PRJQUOTA, 118 + F2FS_MOUNT_QUOTA, 119 + F2FS_MOUNT_INLINE_XATTR_SIZE, 120 + F2FS_MOUNT_RESERVE_ROOT, 121 + F2FS_MOUNT_DISABLE_CHECKPOINT, 122 + F2FS_MOUNT_NORECOVERY, 123 + F2FS_MOUNT_ATGC, 124 + F2FS_MOUNT_MERGE_CHECKPOINT, 125 + F2FS_MOUNT_GC_MERGE, 126 + F2FS_MOUNT_COMPRESS_CACHE, 127 + F2FS_MOUNT_AGE_EXTENT_CACHE, 128 + F2FS_MOUNT_NAT_BITS, 129 + F2FS_MOUNT_INLINECRYPT, 130 + /* 131 + * Some f2fs environments expect to be able to pass the "lazytime" option 132 + * string rather than using the MS_LAZYTIME flag, so this must remain. 133 + */ 134 + F2FS_MOUNT_LAZYTIME, 135 + F2FS_MOUNT_RESERVE_NODE, 136 + }; 135 137 136 138 #define F2FS_OPTION(sbi) ((sbi)->mount_opt) 137 - #define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) 138 - #define set_opt(sbi, option) (F2FS_OPTION(sbi).opt |= F2FS_MOUNT_##option) 139 - #define test_opt(sbi, option) (F2FS_OPTION(sbi).opt & F2FS_MOUNT_##option) 139 + #define clear_opt(sbi, option) \ 140 + (F2FS_OPTION(sbi).opt &= ~BIT(F2FS_MOUNT_##option)) 141 + #define set_opt(sbi, option) \ 142 + (F2FS_OPTION(sbi).opt |= BIT(F2FS_MOUNT_##option)) 143 + #define test_opt(sbi, option) \ 144 + (F2FS_OPTION(sbi).opt & BIT(F2FS_MOUNT_##option)) 140 145 141 146 #define ver_after(a, b) (typecheck(unsigned long long, a) && \ 142 147 typecheck(unsigned long long, b) && \ ··· 188 183 }; 189 184 190 185 struct f2fs_mount_info { 191 - unsigned int opt; 186 + unsigned long long opt; 192 187 block_t root_reserved_blocks; /* root reserved blocks */ 193 188 block_t root_reserved_nodes; /* root reserved nodes */ 194 189 kuid_t s_resuid; /* reserved blocks for uid */
+18 -18
fs/f2fs/super.c
··· 352 352 353 353 struct f2fs_fs_context { 354 354 struct f2fs_mount_info info; 355 - unsigned int opt_mask; /* Bits changed */ 355 + unsigned long long opt_mask; /* Bits changed */ 356 356 unsigned int spec_mask; 357 357 unsigned short qname_mask; 358 358 }; ··· 360 360 #define F2FS_CTX_INFO(ctx) ((ctx)->info) 361 361 362 362 static inline void ctx_set_opt(struct f2fs_fs_context *ctx, 363 - unsigned int flag) 363 + enum f2fs_mount_opt flag) 364 364 { 365 - ctx->info.opt |= flag; 366 - ctx->opt_mask |= flag; 365 + ctx->info.opt |= BIT(flag); 366 + ctx->opt_mask |= BIT(flag); 367 367 } 368 368 369 369 static inline void ctx_clear_opt(struct f2fs_fs_context *ctx, 370 - unsigned int flag) 370 + enum f2fs_mount_opt flag) 371 371 { 372 - ctx->info.opt &= ~flag; 373 - ctx->opt_mask |= flag; 372 + ctx->info.opt &= ~BIT(flag); 373 + ctx->opt_mask |= BIT(flag); 374 374 } 375 375 376 376 static inline bool ctx_test_opt(struct f2fs_fs_context *ctx, 377 - unsigned int flag) 377 + enum f2fs_mount_opt flag) 378 378 { 379 - return ctx->info.opt & flag; 379 + return ctx->info.opt & BIT(flag); 380 380 } 381 381 382 382 void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate, ··· 1371 1371 ctx_test_opt(ctx, F2FS_MOUNT_COMPRESS_CACHE)) 1372 1372 f2fs_info(sbi, "Image doesn't support compression"); 1373 1373 clear_compression_spec(ctx); 1374 - ctx->opt_mask &= ~F2FS_MOUNT_COMPRESS_CACHE; 1374 + ctx->opt_mask &= ~BIT(F2FS_MOUNT_COMPRESS_CACHE); 1375 1375 return 0; 1376 1376 } 1377 1377 if (ctx->spec_mask & F2FS_SPEC_compress_extension) { ··· 1439 1439 return -EINVAL; 1440 1440 1441 1441 if (f2fs_hw_should_discard(sbi) && 1442 - (ctx->opt_mask & F2FS_MOUNT_DISCARD) && 1442 + (ctx->opt_mask & BIT(F2FS_MOUNT_DISCARD)) && 1443 1443 !ctx_test_opt(ctx, F2FS_MOUNT_DISCARD)) { 1444 1444 f2fs_warn(sbi, "discard is required for zoned block devices"); 1445 1445 return -EINVAL; 1446 1446 } 1447 1447 1448 1448 if (!f2fs_hw_support_discard(sbi) && 1449 - (ctx->opt_mask & F2FS_MOUNT_DISCARD) && 1449 + (ctx->opt_mask & BIT(F2FS_MOUNT_DISCARD)) && 1450 1450 ctx_test_opt(ctx, F2FS_MOUNT_DISCARD)) { 1451 1451 f2fs_warn(sbi, "device does not support discard"); 1452 1452 ctx_clear_opt(ctx, F2FS_MOUNT_DISCARD); 1453 - ctx->opt_mask &= ~F2FS_MOUNT_DISCARD; 1453 + ctx->opt_mask &= ~BIT(F2FS_MOUNT_DISCARD); 1454 1454 } 1455 1455 1456 1456 if (f2fs_sb_has_device_alias(sbi) && 1457 - (ctx->opt_mask & F2FS_MOUNT_READ_EXTENT_CACHE) && 1457 + (ctx->opt_mask & BIT(F2FS_MOUNT_READ_EXTENT_CACHE)) && 1458 1458 !ctx_test_opt(ctx, F2FS_MOUNT_READ_EXTENT_CACHE)) { 1459 1459 f2fs_err(sbi, "device aliasing requires extent cache"); 1460 1460 return -EINVAL; 1461 1461 } 1462 1462 1463 1463 if (test_opt(sbi, RESERVE_ROOT) && 1464 - (ctx->opt_mask & F2FS_MOUNT_RESERVE_ROOT) && 1464 + (ctx->opt_mask & BIT(F2FS_MOUNT_RESERVE_ROOT)) && 1465 1465 ctx_test_opt(ctx, F2FS_MOUNT_RESERVE_ROOT)) { 1466 1466 f2fs_info(sbi, "Preserve previous reserve_root=%u", 1467 1467 F2FS_OPTION(sbi).root_reserved_blocks); 1468 1468 ctx_clear_opt(ctx, F2FS_MOUNT_RESERVE_ROOT); 1469 - ctx->opt_mask &= ~F2FS_MOUNT_RESERVE_ROOT; 1469 + ctx->opt_mask &= ~BIT(F2FS_MOUNT_RESERVE_ROOT); 1470 1470 } 1471 1471 if (test_opt(sbi, RESERVE_NODE) && 1472 - (ctx->opt_mask & F2FS_MOUNT_RESERVE_NODE) && 1472 + (ctx->opt_mask & BIT(F2FS_MOUNT_RESERVE_NODE)) && 1473 1473 ctx_test_opt(ctx, F2FS_MOUNT_RESERVE_NODE)) { 1474 1474 f2fs_info(sbi, "Preserve previous reserve_node=%u", 1475 1475 F2FS_OPTION(sbi).root_reserved_nodes); 1476 1476 ctx_clear_opt(ctx, F2FS_MOUNT_RESERVE_NODE); 1477 - ctx->opt_mask &= ~F2FS_MOUNT_RESERVE_NODE; 1477 + ctx->opt_mask &= ~BIT(F2FS_MOUNT_RESERVE_NODE); 1478 1478 } 1479 1479 1480 1480 err = f2fs_check_test_dummy_encryption(fc, sb);