From patchwork Tue Sep 19 07:41:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 9958403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B1EE16038F for ; Tue, 19 Sep 2017 07:42:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C03F3289F5 for ; Tue, 19 Sep 2017 07:42:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B404D28A01; Tue, 19 Sep 2017 07:42:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12608289F5 for ; Tue, 19 Sep 2017 07:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbdISHmG (ORCPT ); Tue, 19 Sep 2017 03:42:06 -0400 Received: from mgwym04.jp.fujitsu.com ([211.128.242.43]:39448 "EHLO mgwym04.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918AbdISHmF (ORCPT ); Tue, 19 Sep 2017 03:42:05 -0400 Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym04.jp.fujitsu.com with smtp id 7d78_3193_9153cca4_7aa1_4a79_8580_7f04cbeed56c; Tue, 19 Sep 2017 16:41:57 +0900 Received: from g01jpfmpwyt03.exch.g01.fujitsu.local (g01jpfmpwyt03.exch.g01.fujitsu.local [10.128.193.57]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 71902AC009E for ; Tue, 19 Sep 2017 16:41:56 +0900 (JST) Received: from G01JPEXCHYT18.g01.fujitsu.local (G01JPEXCHYT18.g01.fujitsu.local [10.128.194.57]) by g01jpfmpwyt03.exch.g01.fujitsu.local (Postfix) with ESMTP id C4E0D46E474 for ; Tue, 19 Sep 2017 16:41:55 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: c2b25cb12e6a446ebd4ee0113958e369 To: From: "Misono, Tomohiro" Subject: [PATCH] btrfs-progs: subvolume: outputs message only when operation succeeds Message-ID: Date: Tue, 19 Sep 2017 16:41:52 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "btrfs subvolume create/delete" outputs the message of "Create/Delete subvolume ..." even when an operation fails. Since it is confusing, let's outputs the message only when an operation succeeds. Signed-off-by: Tomohiro Misono Reviewed-by: Satoru Takeuchi Tested-by: Satoru Takeuchi --- cmds-subvolume.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 666f6e0..6d4b0fe 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -189,7 +189,6 @@ static int cmd_subvol_create(int argc, char **argv) if (fddst < 0) goto out; - printf("Create subvolume '%s/%s'\n", dstdir, newname); if (inherit) { struct btrfs_ioctl_vol_args_v2 args; @@ -213,6 +212,7 @@ static int cmd_subvol_create(int argc, char **argv) error("cannot create subvolume: %s", strerror(errno)); goto out; } + printf("Create subvolume '%s/%s'\n", dstdir, newname); retval = 0; /* success */ out: @@ -337,9 +337,6 @@ again: goto out; } - printf("Delete subvolume (%s): '%s/%s'\n", - commit_mode == 2 || (commit_mode == 1 && cnt + 1 == argc) - ? "commit" : "no-commit", dname, vname); memset(&args, 0, sizeof(args)); strncpy_null(args.name, vname); res = ioctl(fd, BTRFS_IOC_SNAP_DESTROY, &args); @@ -349,6 +346,9 @@ again: ret = 1; goto out; } + printf("Delete subvolume (%s): '%s/%s'\n", + commit_mode == 2 || (commit_mode == 1 && cnt + 1 == argc) + ? "commit" : "no-commit", dname, vname); if (commit_mode == 1) { res = wait_for_commit(fd);