Skip to content

Commit a4db59a

Browse files
author
Jaegeuk Kim
committed
f2fs: expose main_blkaddr in sysfs
Expose in /sys/fs/f2fs/<blockdev>/main_blkaddr the block address where the main area starts. This allows user mode programs to determine: - That pinned files that are made exclusively of fully allocated 2MB segments will never be unpinned by the file system. - Where the main area starts. This is required by programs that want to verify if a file is made exclusively of 2MB f2fs segments, the alignment boundary for segments starts at this address. Testing for 2MB alignment relative to the start of the device is incorrect, because for some filesystems main_blkaddr is not at a 2MB boundary relative to the start of the device. The entry will be used when validating reliable pinning file feature proposed by "f2fs: support aligned pinned file". Signed-off-by: Ramon Pantin <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 909110c commit a4db59a

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Contact: "Jaegeuk Kim" <[email protected]>
3131
Description:
3232
Controls the issue rate of segment discard commands.
3333

34+
What: /sys/fs/f2fs/<disk>/max_blkaddr
35+
Date: November 2019
36+
Contact: "Ramon Pantin" <[email protected]>
37+
Description:
38+
Shows first block address of MAIN area.
39+
3440
What: /sys/fs/f2fs/<disk>/ipu_policy
3541
Date: November 2013
3642
Contact: "Jaegeuk Kim" <[email protected]>

Documentation/filesystems/f2fs.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ Files in /sys/fs/f2fs/<devname>
297297
reclaim the prefree segments to free segments.
298298
By default, 5% over total # of segments.
299299

300+
main_blkaddr This value gives the first block address of
301+
MAIN area in the partition.
302+
300303
max_small_discards This parameter controls the number of discard
301304
commands that consist small blocks less than 2MB.
302305
The candidates to be discarded are cached until

fs/f2fs/sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_no_gc_sleep_time, no_gc_sleep_time);
445445
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_idle, gc_mode);
446446
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_urgent, gc_mode);
447447
F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, reclaim_segments, rec_prefree_segments);
448+
F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, main_blkaddr, main_blkaddr);
448449
F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, max_small_discards, max_discards);
449450
F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, discard_granularity, discard_granularity);
450451
F2FS_RW_ATTR(RESERVED_BLOCKS, f2fs_sb_info, reserved_blocks, reserved_blocks);
@@ -512,6 +513,7 @@ static struct attribute *f2fs_attrs[] = {
512513
ATTR_LIST(gc_idle),
513514
ATTR_LIST(gc_urgent),
514515
ATTR_LIST(reclaim_segments),
516+
ATTR_LIST(main_blkaddr),
515517
ATTR_LIST(max_small_discards),
516518
ATTR_LIST(discard_granularity),
517519
ATTR_LIST(batched_trim_sections),

0 commit comments

Comments
 (0)