Skip to content

Commit 684b290

Browse files
hsiaoh2hsiangkao
authored andcommitted
erofs: add support for FS_IOC_GETFSSYSFSPATH
FS_IOC_GETFSSYSFSPATH ioctl exposes /sys/fs path of a given filesystem, potentially standarizing sysfs reporting. This patch add support for FS_IOC_GETFSSYSFSPATH for erofs, "erofs/<dev>" will be outputted for bdev cases, "erofs/[domain_id,]<fs_id>" will be outputted for fscache cases. Signed-off-by: Huang Xiaojia <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Gao Xiang <[email protected]>
1 parent 7dc5537 commit 684b290

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

fs/erofs/super.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,21 @@ static const struct export_operations erofs_export_ops = {
576576
.get_parent = erofs_get_parent,
577577
};
578578

579+
static void erofs_set_sysfs_name(struct super_block *sb)
580+
{
581+
struct erofs_sb_info *sbi = EROFS_SB(sb);
582+
583+
if (erofs_is_fscache_mode(sb)) {
584+
if (sbi->domain_id)
585+
super_set_sysfs_name_generic(sb, "%s,%s",sbi->domain_id,
586+
sbi->fsid);
587+
else
588+
super_set_sysfs_name_generic(sb, "%s", sbi->fsid);
589+
return;
590+
}
591+
super_set_sysfs_name_id(sb);
592+
}
593+
579594
static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
580595
{
581596
struct inode *inode;
@@ -643,6 +658,7 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
643658
sb->s_flags |= SB_POSIXACL;
644659
else
645660
sb->s_flags &= ~SB_POSIXACL;
661+
erofs_set_sysfs_name(sb);
646662

647663
#ifdef CONFIG_EROFS_FS_ZIP
648664
xa_init(&sbi->managed_pslots);

0 commit comments

Comments
 (0)