• Anand Jain's avatar
    btrfs: sysfs: show temp_fsid feature · f3623740
    Anand Jain authored
    This adds sysfs objects to indicate temp_fsid feature support and
    its status.
    
      /sys/fs/btrfs/features/temp_fsid
      /sys/fs/btrfs/<UUID>/temp_fsid
    
    For example:
    
       Consider two cloned and mounted devices.
    
          $ blkid /dev/sdc[1-2]
          /dev/sdc1: UUID="509ad44b-ad2a-4a8a-bc8d-fe69db7220d5" ..
          /dev/sdc2: UUID="509ad44b-ad2a-4a8a-bc8d-fe69db7220d5" ..
    
       One gets actual fsid, and the other gets the temp_fsid when
       mounted.
    
          $ btrfs filesystem show -m
          Label: none  uuid: 509ad44b-ad2a-4a8a-bc8d-fe69db7220d5
    	      Total devices 1 FS bytes used 54.14MiB
    	      devid    1 size 300.00MiB used 144.00MiB path /dev/sdc1
    
          Label: none  uuid: 33bad74e-c91b-43a5-aef8-b3cab97ae63a
    	      Total devices 1 FS bytes used 54.14MiB
    	      devid    1 size 300.00MiB used 144.00MiB path /dev/sdc2
    
       Their sysfs as below.
    
          $ cat /sys/fs/btrfs/features/temp_fsid
          0
    
          $ cat /sys/fs/btrfs/509ad44b-ad2a-4a8a-bc8d-fe69db7220d5/temp_fsid
          0
    
          $ cat /sys/fs/btrfs/33bad74e-c91b-43a5-aef8-b3cab97ae63a/temp_fsid
          1
    Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    f3623740
sysfs.c 64.7 KB