History

ext4: implement support for get/set fs label

Implement support for FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL ioctls for online reading and setting of file system label. ext4_ioctl_getlabel() is simple, just get the label from the primary superblock. This might not be the first sb on the file system if 'sb=' mount option is used. In ext4_ioctl_setlabel() we update what ext4 currently views as a primary superblock and then proceed to update backup superblocks. There are two caveats: - the primary superblock might not be the first superblock and so it might not be the one used by userspace tools if read directly off the disk. - because the primary superblock might not be the first superblock we potentialy have to update it as part of backup superblock update. However the first sb location is a bit more complicated than the rest so we have to account for that. The superblock modification is created generic enough so the infrastructure can be used for other potential superblock modification operations, such as chaning UUID. Tested with generic/492 with various configurations. I also checked the behavior with 'sb=' mount options, including very large file systems with and without sparse_super/sparse_super2.

Lukas Czerner committed 4 years ago

Commit bbc605c1 parent 4c1bd5a5 files · +357 −7Browse files

Showing the changes to include (1 of 5 files). Show all

Unified · Split

include/trace/events/ext4.h+23−0
@@ -2837,6 +2837,29 @@ TRACE_EVENT(ext4_fc_track_range, · 2836 unmodified lines
2837 __entry->end)2837 __entry->end)
2838 );2838 );
2839 2839
2840TRACE_EVENT(ext4_update_sb,
2841 TP_PROTO(struct super_block *sb, ext4_fsblk_t fsblk,
2842 unsigned int flags),
2843
2844 TP_ARGS(sb, fsblk, flags),
2845
2846 TP_STRUCT__entry(
2847 __field(dev_t, dev)
2848 __field(ext4_fsblk_t, fsblk)
2849 __field(unsigned int, flags)
2850 ),
2851
2852 TP_fast_assign(
2853 __entry->dev = sb->s_dev;
2854 __entry->fsblk = fsblk;
2855 __entry->flags = flags;
2856 ),
2857
2858 TP_printk("dev %d,%d fsblk %llu flags %u",
2859 MAJOR(__entry->dev), MINOR(__entry->dev),
2860 __entry->fsblk, __entry->flags)
2861);
2862
2840#endif /* _TRACE_EXT4_H */2863#endif /* _TRACE_EXT4_H */
2841 2864
2842/* This part must be outside protection */2865/* This part must be outside protection */

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