Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btrfs-progs: add --default-subvol option to mkfs.btrfs #872

Closed
wants to merge 1 commit into from

Conversation

maharmstone
Copy link
Contributor

Adds a --default-subvol option to mkfs.btrfs, which works the same way as --subvol but also marks the subvolume as the default.

@maharmstone
Copy link
Contributor Author

Fixed minor inelegance in btrfs_set_default_subvolume (no need to check return value at end of function)

@DaanDeMeyer
Copy link

mkfs.btrfs: unrecognized option '--default-subvol'
usage: mkfs.btrfs [options] <dev> [<dev...>]

    Create a BTRFS filesystem on a device or multiple devices

    Allocation profiles:
    -d|--data PROFILE         data profile, raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10, dup or single
    -m|--metadata PROFILE     metadata profile, values like for data profile 
    -M|--mixed                mix metadata and data together 
    Features:
    --csum TYPE               
    --checksum TYPE           checksum algorithm to use, crc32c (default), xxhash, sha256, blake2 
    -n|--nodesize SIZE        size of btree nodes 
    -s|--sectorsize SIZE      data block size (may not be mountable by current kernel) 
    -O|--features LIST        comma separated list of filesystem features (use '-O list-all' to list features) 
    -L|--label LABEL          set the filesystem label 
    -U|--uuid UUID            specify the filesystem UUID (must be unique for a filesystem with multiple devices)
    --device-uuid UUID        Specify the filesystem device UUID (a.k.a sub-uuid) (for single device filesystem
                              only) 
    Creation:
    -b|--byte-count SIZE      set size of each device to SIZE (filesystem size is sum of all device sizes) 
    -r|--rootdir DIR          copy files from DIR to the image root directory 
    -u|--subvol SUBDIR        create SUBDIR as subvolume rather than normal directory 
    -D|--default-subvol SUBDIR
                              create SUBDIR as subvolume rather than normal directory, and set it as the default 

@maharmstone
Copy link
Contributor Author

mkfs.btrfs: unrecognized option '--default-subvol'
usage: mkfs.btrfs [options] <dev> [<dev...>]

    Create a BTRFS filesystem on a device or multiple devices

    Allocation profiles:
    -d|--data PROFILE         data profile, raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10, dup or single
    -m|--metadata PROFILE     metadata profile, values like for data profile 
    -M|--mixed                mix metadata and data together 
    Features:
    --csum TYPE               
    --checksum TYPE           checksum algorithm to use, crc32c (default), xxhash, sha256, blake2 
    -n|--nodesize SIZE        size of btree nodes 
    -s|--sectorsize SIZE      data block size (may not be mountable by current kernel) 
    -O|--features LIST        comma separated list of filesystem features (use '-O list-all' to list features) 
    -L|--label LABEL          set the filesystem label 
    -U|--uuid UUID            specify the filesystem UUID (must be unique for a filesystem with multiple devices)
    --device-uuid UUID        Specify the filesystem device UUID (a.k.a sub-uuid) (for single device filesystem
                              only) 
    Creation:
    -b|--byte-count SIZE      set size of each device to SIZE (filesystem size is sum of all device sizes) 
    -r|--rootdir DIR          copy files from DIR to the image root directory 
    -u|--subvol SUBDIR        create SUBDIR as subvolume rather than normal directory 
    -D|--default-subvol SUBDIR
                              create SUBDIR as subvolume rather than normal directory, and set it as the default 

Oops, I forgot to add the long form to the list. Sorry Daan, try it now

@DaanDeMeyer
Copy link

@adam900710 I am getting swarmed with hardlink warnings since your refactoring: https://paste.centos.org/view/a3a9b543. Any chance we can log this warning only for the first file instead of for every file?

@kdave
Copy link
Owner

kdave commented Aug 14, 2024

I'll update so the warning is printed first time and after the whole directory is processed so it's not lost.

kdave added a commit that referenced this pull request Aug 14, 2024
…rdlink

There's a report that newly added --rootdir print too many warnings for
hardlinks, which is maybe not that uncommon. We still want to let the
user know about that so print it just once and count how many were
found:

  $ mkfs.btrfs --rootdir ...
  WARNING: '/tmp/btrfs-progs-mkfs-rootdir-hardlinks.7RcdfR/rootdir/inside_link' has extra hardlinks, they will be converted into new inodes
  WARNING: 12 hardlinks were detected in /tmp/btrfs-progs-mkfs-rootdir-hardlinks.7RcdfR/rootdir, all converted to new inodes

Link: #872 (comment)
Signed-off-by: David Sterba <[email protected]>
kdave added a commit that referenced this pull request Aug 14, 2024
…rdlink

There's a report that newly added --rootdir print too many warnings for
hardlinks, which is maybe not that uncommon. We still want to let the
user know about that so print it just once and count how many were
found:

  $ mkfs.btrfs --rootdir ...
  WARNING: '/tmp/btrfs-progs-mkfs-rootdir-hardlinks.7RcdfR/rootdir/inside_link' has extra hardlinks, they will be converted into new inodes
  WARNING: 12 hardlinks were detected in /tmp/btrfs-progs-mkfs-rootdir-hardlinks.7RcdfR/rootdir, all converted to new inodes

Link: #872 (comment)
Signed-off-by: David Sterba <[email protected]>
@adam900710
Copy link
Collaborator

@adam900710 I am getting swarmed with hardlink warnings since your refactoring: https://paste.centos.org/view/a3a9b543. Any chance we can log this warning only for the first file instead of for every file?

Unfortunately if it's only warned once, it will mask all the other files.

Another thing is, although the timezone ones are indeed hardlinks, the python ones in my system doesn't has any hardlink.
Not 100% sure if the split time zone files will cause anything wrong.

I'm afraid we may need to implement hard link support sooner than later.

Copy link
Collaborator

@adam900710 adam900710 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me.

Just some small nitpicks.

@maharmstone maharmstone force-pushed the mkfs-default-subvol branch 2 times, most recently from b3258a3 to a82022b Compare August 15, 2024 14:27
@maharmstone
Copy link
Contributor Author

Thanks Qu. I've force-pushed a version with your changes, and rebased it against 6.10.1.

@adam900710 adam900710 requested review from adam900710 and kdave August 15, 2024 22:14
Copy link
Collaborator

@adam900710 adam900710 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@kdave kdave force-pushed the devel branch 2 times, most recently from 48be42f to 082ce75 Compare August 19, 2024 22:30
Adds a --default-subvol option to mkfs.btrfs, which works the same way
as --subvol but also marks the subvolume as the default.

Signed-off-by: Mark Harmstone <[email protected]>
kdave pushed a commit that referenced this pull request Aug 21, 2024
Add new option --default-subvol to mkfs.btrfs, which works the same way
as --subvol but also marks the subvolume as the default.

Pull-request: #872
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
@kdave kdave added this to the v6.11 milestone Aug 21, 2024
@kdave
Copy link
Owner

kdave commented Aug 21, 2024

Merged to devel, thanks.

@kdave kdave closed this Aug 21, 2024
@maharmstone
Copy link
Contributor Author

Thanks both

@maharmstone maharmstone deleted the mkfs-default-subvol branch September 4, 2024 10:22
@kdave kdave modified the milestones: v6.11, v6.12 Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants