From patchwork Tue May 6 06:33:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 4118971 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 60257C0ACC for ; Tue, 6 May 2014 06:32:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 945FF20204 for ; Tue, 6 May 2014 06:32:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1CE6201EF for ; Tue, 6 May 2014 06:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933995AbaEFGcQ (ORCPT ); Tue, 6 May 2014 02:32:16 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:48208 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S933956AbaEFGcN (ORCPT ); Tue, 6 May 2014 02:32:13 -0400 X-IronPort-AV: E=Sophos;i="4.97,994,1389715200"; d="scan'208";a="30122608" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 06 May 2014 14:29:40 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s466WA38025156; Tue, 6 May 2014 14:32:10 +0800 Received: from adam-work.lan (10.167.226.24) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.146.2; Tue, 6 May 2014 14:32:16 +0800 From: Qu Wenruo To: CC: Anand Jain Subject: [RFC PATCH 2/2] btrfs: Add new member of btrfs_ioctl_dev_info_args. Date: Tue, 6 May 2014 14:33:13 +0800 Message-ID: <1399357993-9254-3-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1399357993-9254-1-git-send-email-quwenruo@cn.fujitsu.com> References: <1399357993-9254-1-git-send-email-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.24] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 flags member for btrfs_ioctl_dev_info_args to preset missing btrfs devices. The new member is added in the original padding area so the ioctl API is not affected but user headers needs to be updated. Cc: Anand Jain Signed-off-by: Qu Wenruo --- fs/btrfs/ioctl.c | 3 +++ include/uapi/linux/btrfs.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7680a40..1920f24 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2610,6 +2610,9 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg) di_args->devid = dev->devid; di_args->bytes_used = dev->bytes_used; di_args->total_bytes = dev->total_bytes; + di_args->flags = BTRFS_IOCTL_DEV_INFO_FLAG_SET; + if (dev->missing) + di_args->flags |= BTRFS_IOCTL_DEV_INFO_MISSING; memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid)); if (dev->name) { struct rcu_string *name; diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index b4d6909..5eb1f03 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h @@ -168,12 +168,15 @@ struct btrfs_ioctl_dev_replace_args { __u64 spare[64]; }; +#define BTRFS_IOCTL_DEV_INFO_MISSING (1ULL<<0) +#define BTRFS_IOCTL_DEV_INFO_FLAG_SET (1ULL<<63) struct btrfs_ioctl_dev_info_args { __u64 devid; /* in/out */ __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */ __u64 bytes_used; /* out */ __u64 total_bytes; /* out */ - __u64 unused[379]; /* pad to 4k */ + __u64 flags; /* out */ + __u64 unused[378]; /* pad to 4k */ __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ };