On 2016/11/02 21:22, David Sterba wrote:
> On Wed, Oct 19, 2016 at 11:35:40AM +0900, Tsutomu Itoh wrote:
>> When two or more -c options are specified, cannot find a suitable
>> parent. So, output stream is bigger than correct one.
>>
>> [before]
>> # btrfs send -f /tmp/data1 -c Snap0 -c ../SnapX Snap[12] ../SnapY
>> At subvol Snap1
>> At subvol Snap2
>> At subvol ../SnapY
>> # ls -l /tmp/data1
>> -rw------- 1 root root 3153 Oct 19 10:37 /tmp/data1
>> #
>>
>> [after]
>> # btrfs send -f /tmp/data1 -c Snap0 -c ../SnapX Snap[12] ../SnapY
>> At subvol Snap1
>> At subvol Snap2
>> At subvol ../SnapY
>> # ls -l /tmp/data1
>> -rw------- 1 root root 1492 Oct 19 10:39 /tmp/data1
>> #
>
> Can you please create a test for that?
OK, I'll try to create a test case.
>
>> Signed-off-by: Tsutomu Itoh <t-itoh@xxxxxxxxxxxxxx>
>> ---
>> cmds-send.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/cmds-send.c b/cmds-send.c
>> index 2a8a697..b93a667 100644
>> --- a/cmds-send.c
>> +++ b/cmds-send.c
>> @@ -651,6 +651,18 @@ int cmd_send(int argc, char **argv)
>> }
>>
>> if (!full_send && root_id) {
>> + ret = init_root_path(&send, subvol);
>> + if (ret < 0)
>> + goto out;
>> +
>> + ret = get_root_id(&send,
>> + subvol_strip_mountpoint(send.root_path, subvol),
>> + &root_id);
>> + if (ret < 0) {
>> + error("cannot resolve rootid for %s", subvol);
>> + goto out;
>> + }
>
> This duplicates the code that handles the '-c' option, please factori it
> toa helper function.
I will update the patch.
Thanks,
Tsutomu
>
>> +
>> ret = find_good_parent(&send, root_id, &parent_root_id);
>> if (ret < 0) {
>> error("parent determination failed for %lld",
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html