Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-30 Thread David Sterba
On Mon, Sep 24, 2012 at 08:36:47AM -0600, cwillu wrote:
 For what it's worth, rmdir's behaviour is to continue after errors
 (i.e., mkdir 1; mkdir 3; rmdir 1 2 3 deletes 1 and 3, and exits with
 a non-zero exit code); unless there's a good reason to do otherwise,
 matching that behaviour is probably best.

Thanks for your input. I have tried it and agree with the proposed
implementation (ie. to process all arguments and skip non-subvols).

david
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 10:59:34AM +0800, Anand Jain wrote:
  Yes, this is useful, thanks. I'm thinking if it's ok to stop on
  first error, ie. when the subvolume does not exist or is a directory.
 
  I am fine with either ways. I shall just keep it as it is as of now.

Yes, I'm ok with that. The usecase I had in mind was something like

  btrfs subvol del *

but I should know the dir I'm in and what I'm doing there, errors are
to be expected.


david
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-24 Thread cwillu
On Mon, Sep 24, 2012 at 6:02 AM, David Sterba d...@jikos.cz wrote:
 On Mon, Sep 24, 2012 at 10:59:34AM +0800, Anand Jain wrote:
  Yes, this is useful, thanks. I'm thinking if it's ok to stop on
  first error, ie. when the subvolume does not exist or is a directory.

  I am fine with either ways. I shall just keep it as it is as of now.

 Yes, I'm ok with that. The usecase I had in mind was something like

   btrfs subvol del *

 but I should know the dir I'm in and what I'm doing there, errors are
 to be expected.

For what it's worth, rmdir's behaviour is to continue after errors
(i.e., mkdir 1; mkdir 3; rmdir 1 2 3 deletes 1 and 3, and exits with
a non-zero exit code); unless there's a good reason to do otherwise,
matching that behaviour is probably best.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-23 Thread Anand Jain


David,

 Thanks for the comments.

 Yes, this is useful, thanks. I'm thinking if it's ok to stop on
 first error, ie. when the subvolume does not exist or is a directory.

 I am fine with either ways. I shall just keep it as it is as of now.

-Anand
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-21 Thread Ilya Dryomov
On Fri, Sep 21, 2012 at 02:54:08PM +0800, Anand jain wrote:
 From: Anand Jain anand.j...@oracle.com
 
 With this user will be able to provide more than one subvolume
 to delete.
 eg: btrfs subvolume delete subvol1 subvol2
 
 Signed-off-by: Anand Jain anand.j...@oracle.com
 ---
  cmds-subvolume.c |   36 
  man/btrfs.8.in   |4 ++--
  2 files changed, 26 insertions(+), 14 deletions(-)
 
 diff --git a/cmds-subvolume.c b/cmds-subvolume.c
 index f4aa80f..cfeaa8d 100644
 --- a/cmds-subvolume.c
 +++ b/cmds-subvolume.c
 @@ -188,31 +188,34 @@ int test_issubvolume(char *path)
  }
  
  static const char * const cmd_subvol_delete_usage[] = {
 - btrfs subvolume delete name,
 - Delete a subvolume,
 + btrfs subvolume delete subvolume [subvolume...],
 + Delete subvolume(s),
   NULL
  };
  
  static int cmd_subvol_delete(int argc, char **argv)
  {
 - int res, fd, len, e;
 + int res, fd, len, e, cnt = 1, ret = 0;
   struct btrfs_ioctl_vol_args args;
   char*dname, *vname, *cpath;
   char*path;
  
 - if (check_argc_exact(argc, 2))
 + if (argc  2)
   usage(cmd_subvol_delete_usage);

check_argc_min(argc, 2)

Haven't looked at the rest.

Thanks,

Ilya
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-21 Thread David Sterba
On Fri, Sep 21, 2012 at 02:54:08PM +0800, Anand jain wrote:
 From: Anand Jain anand.j...@oracle.com
 
 With this user will be able to provide more than one subvolume
 to delete.
 eg: btrfs subvolume delete subvol1 subvol2

Yes, this is useful, thanks. I'm thinking if it's ok to stop on
first error, ie. when the subvolume does not exist or is a directory.

david
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html