On 2/6/20 8:59 PM, Qu Wenruo wrote:
Current _btrfs_get_subvolid() can't handle the following case at all: # btrfs subvol list $SCRATCH_MNT ID 256 gen 9 top level 5 path subv1 ID 257 gen 7 top level 256 path subv1/subv2 ID 258 gen 8 top level 256 path subv1/subv3 ID 259 gen 9 top level 256 path subv1/subv4 If we call "_btrfs_get_subvolid $SCRATCH_MNT subv1" we will get a list of all subvolumes, not the subvolid of subv1. To address this problem, we go egrep to match $name which starts with a space, and at the end of a line. So that all other subvolumes won't hit. Suggested-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Thanks, Josef