From patchwork Sat Sep 13 01:21:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 4899481 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 CFE96BEEA5 for ; Sat, 13 Sep 2014 09:11:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12E8720200 for ; Sat, 13 Sep 2014 09:11:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F26C201F7 for ; Sat, 13 Sep 2014 09:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751908AbaIMJLv (ORCPT ); Sat, 13 Sep 2014 05:11:51 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:30450 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861AbaIMJLt (ORCPT ); Sat, 13 Sep 2014 05:11:49 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s8D9BluH031264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 13 Sep 2014 09:11:48 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s8D9BlTs002356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 13 Sep 2014 09:11:47 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s8D9Blu8002347 for ; Sat, 13 Sep 2014 09:11:47 GMT Received: from OL.sg.oracle.com (/10.186.101.34) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Sep 2014 02:11:46 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/5] btrfs-progs: don't fall back to recursive /dev scan Date: Sat, 13 Sep 2014 09:21:19 +0800 Message-Id: <1410571282-3482-2-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.0.0.153.g79dcccc In-Reply-To: <1410571282-3482-1-git-send-email-anand.jain@oracle.com> References: <1410571282-3482-1-git-send-email-anand.jain@oracle.com> X-Source-IP: acsinet21.oracle.com [141.146.126.237] 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.9 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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 From: Eric Sandeen If we didn't find what we are looking for in /proc/partitions, we're not going to find it by scanning every node under /dev, either. But that's just what btrfs_scan_for_fsid() does. Remove that fallback; at that point btrfs_scan_for_fsid() just calls scan_for_btrfs(), so remove the wrapper & call it directly. Side note: so, these paths always use /proc/partitions, not libblkid. Userspace-intiated scans default to libblkid. I presume this is part of the design, and intentional? Anyway, not changing it now! Signed-off-by: Eric Sandeen Reviewed-by: Anand Jain --- disk-io.c | 2 +- utils.c | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/disk-io.c b/disk-io.c index f71f5ca..2a1f6d4 100644 --- a/disk-io.c +++ b/disk-io.c @@ -1007,7 +1007,7 @@ int btrfs_scan_fs_devices(int fd, const char *path, } if (total_devs != 1) { - ret = btrfs_scan_for_fsid(run_ioctl); + ret = scan_for_btrfs(BTRFS_SCAN_PROC, run_ioctl); if (ret) return ret; } diff --git a/utils.c b/utils.c index 0064587..cf7635c 100644 --- a/utils.c +++ b/utils.c @@ -1148,7 +1148,7 @@ int check_mounted_where(int fd, const char *file, char *where, int size, /* scan other devices */ if (is_btrfs && total_devs > 1) { - if ((ret = btrfs_scan_for_fsid(!BTRFS_UPDATE_KERNEL))) + if ((ret = scan_for_btrfs(BTRFS_SCAN_PROC, !BTRFS_UPDATE_KERNEL))) return ret; } @@ -1336,16 +1336,6 @@ fail: return ret; } -int btrfs_scan_for_fsid(int run_ioctls) -{ - int ret; - - ret = scan_for_btrfs(BTRFS_SCAN_PROC, run_ioctls); - if (ret) - ret = scan_for_btrfs(BTRFS_SCAN_DEV, run_ioctls); - return ret; -} - int btrfs_device_already_in_root(struct btrfs_root *root, int fd, int super_offset) {