From patchwork Wed Dec 17 20:14:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 5509181 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A8159BEEA8 for ; Wed, 17 Dec 2014 20:13:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD7AB208BC for ; Wed, 17 Dec 2014 20:13:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC6B8209DE for ; Wed, 17 Dec 2014 20:13:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751376AbaLQUNW (ORCPT ); Wed, 17 Dec 2014 15:13:22 -0500 Received: from mail-wg0-f43.google.com ([74.125.82.43]:47359 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751057AbaLQUM7 (ORCPT ); Wed, 17 Dec 2014 15:12:59 -0500 Received: by mail-wg0-f43.google.com with SMTP id l18so21220007wgh.30 for ; Wed, 17 Dec 2014 12:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JmlcKQN1hmlQ1pHcB6FWWpYAvuzFwo+Eqs8XxMSDbfM=; b=or3bmIqjHk+Z4egbdes3fmIVwDGABhADdVO2Goknjyl9OwORtAmalcNtkwJhitFE78 LLozjev3yOMecqBqONVwrHSAiHotRz1EQ88fvYmz/klTM1D+m/EQG/k5ZUmgZPV5r/BQ gZvyazvKMGkehXNFBV/0vRKf/yq5zX0bZS/N4ROigpRN618fyzYFXeiX0IP49MgvBl8l uRiSNFbKQGhYE4KX4jL0jxUrfYDRcdMDmAT2JGSZ3B+Wyes/hYnRsW3VOHWJDboRAQwq AsGrmP9DFfRfWwXnj6TBL/AdWe8R4t1kB693mU+LkopZxg/szAo3eMaYdC5Zu4vtvipv /igw== X-Received: by 10.181.8.193 with SMTP id dm1mr17465515wid.55.1418847177987; Wed, 17 Dec 2014 12:12:57 -0800 (PST) Received: from venice.bhome (ppp-133-85.24-151.libero.it. [151.24.85.133]) by mx.google.com with ESMTPSA id pu3sm6360357wjc.14.2014.12.17.12.12.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Dec 2014 12:12:57 -0800 (PST) From: Goffredo Baroncelli X-Google-Original-From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: Goffredo Baroncelli Subject: [PATCH 3/8] Add verbose option to btrfs_add_to_fsid() Date: Wed, 17 Dec 2014 21:14:07 +0100 Message-Id: <1418847252-14184-4-git-send-email-kreijack@inwind.it> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418847252-14184-1-git-send-email-kreijack@inwind.it> References: <1418847252-14184-1-git-send-email-kreijack@inwind.it> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add verbose option to btrfs_add_to_fsid() in order to avoid to print the information to console when not needed. The same information is print in the summary of the mkfs.btrfs command. Signed-off-by: Goffredo Baroncelli Reviewed-by: Satoru Takeuchi --- mkfs.c | 3 ++- utils.c | 7 ++++--- utils.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mkfs.c b/mkfs.c index a5f19cc..042d12e 100644 --- a/mkfs.c +++ b/mkfs.c @@ -1638,7 +1638,8 @@ int main(int ac, char **av) mixed = old_mixed; ret = btrfs_add_to_fsid(trans, root, fd, file, dev_block_count, - sectorsize, sectorsize, sectorsize); + sectorsize, sectorsize, sectorsize, + verbose); BUG_ON(ret); btrfs_register_one_device(file); } diff --git a/utils.c b/utils.c index 19049bb..dcb4f74 100644 --- a/utils.c +++ b/utils.c @@ -610,7 +610,7 @@ static int zero_dev_clamped(int fd, off_t start, ssize_t len, u64 dev_size) int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, struct btrfs_root *root, int fd, char *path, u64 block_count, u32 io_width, u32 io_align, - u32 sectorsize) + u32 sectorsize, int verbose) { struct btrfs_super_block *disk_super; struct btrfs_super_block *super = root->fs_info->super_copy; @@ -659,8 +659,9 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, memcpy(disk_super, super, sizeof(*disk_super)); - printf("adding device %s id %llu\n", path, - (unsigned long long)device->devid); + if (verbose) + printf("adding device %s id %llu\n", path, + (unsigned long long)device->devid); btrfs_set_super_bytenr(disk_super, BTRFS_SUPER_INFO_OFFSET); btrfs_set_stack_device_id(dev_item, device->devid); diff --git a/utils.h b/utils.h index bb8a449..9218199 100644 --- a/utils.h +++ b/utils.h @@ -79,7 +79,7 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret, int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, struct btrfs_root *root, int fd, char *path, u64 block_count, u32 io_width, u32 io_align, - u32 sectorsize); + u32 sectorsize, int verbose); int btrfs_scan_for_fsid(int run_ioctls); int btrfs_register_one_device(const char *fname); int btrfs_register_all_devices(void);