History

f2fs: fix to check inline_xattr_size boundary correctly

We use below condition to check inline_xattr_size boundary: if (!F2FS_OPTION(sbi).inline_xattr_size || F2FS_OPTION(sbi).inline_xattr_size >= DEF_ADDRS_PER_INODE - F2FS_TOTAL_EXTRA_ATTR_SIZE - DEF_INLINE_RESERVED_SIZE - DEF_MIN_INLINE_SIZE) There is there problems in that check: - we should allow inline_xattr_size equaling to min size of inline {data,dentry} area. - F2FS_TOTAL_EXTRA_ATTR_SIZE and inline_xattr_size are based on different size unit, previous one is 4 bytes, latter one is 1 bytes. - DEF_MIN_INLINE_SIZE only indicate min size of inline data area, however, we need to consider min size of inline dentry area as well, minimal inline dentry should at least contain two entries: '.' and '..', so that min inline_dentry size is 40 bytes. .bitmap 1 * 1 = 1 .reserved 1 * 1 = 1 .dentry 11 * 2 = 22 .filename 8 * 2 = 16 total 40

Chao Yu committed 7 years ago

Commit 500e0b21 parent 90839773 files · +14 −13Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/f2fs_fs.h+7−6
@@ -490,12 +490,12 @@ typedef __le32 f2fs_hash_t; · 489 unmodified lines
490 490
491/*491/*
492 * space utilization of regular dentry and inline dentry (w/o extra reservation)492 * space utilization of regular dentry and inline dentry (w/o extra reservation)
493 * regular dentry inline dentry493 * regular dentry inline dentry (def) inline dentry (min)
494 * bitmap 1 * 27 = 27 1 * 23 = 23494 * bitmap 1 * 27 = 27 1 * 23 = 23 1 * 1 = 1
495 * reserved 1 * 3 = 3 1 * 7 = 7495 * reserved 1 * 3 = 3 1 * 7 = 7 1 * 1 = 1
496 * dentry 11 * 214 = 2354 11 * 182 = 2002496 * dentry 11 * 214 = 2354 11 * 182 = 2002 11 * 2 = 22
497 * filename 8 * 214 = 1712 8 * 182 = 1456497 * filename 8 * 214 = 1712 8 * 182 = 1456 8 * 2 = 16
498 * total 4096 3488498 * total 4096 3488 40
499 *499 *
500 * Note: there are more reserved space in inline dentry than in regular500 * Note: there are more reserved space in inline dentry than in regular
501 * dentry, when converting inline dentry we should handle this carefully.501 * dentry, when converting inline dentry we should handle this carefully.
@@ -507,6 +507,7 @@ typedef __le32 f2fs_hash_t; · 5 unmodified lines
507#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \507#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \
508 F2FS_SLOT_LEN) * \508 F2FS_SLOT_LEN) * \
509 NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))509 NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
510#define MIN_INLINE_DENTRY_SIZE 40 /* just include '.' and '..' entries */
510 511
511/* One directory entry slot representing F2FS_SLOT_LEN-sized file name */512/* One directory entry slot representing F2FS_SLOT_LEN-sized file name */
512struct f2fs_dir_entry {513struct f2fs_dir_entry {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t