From patchwork Wed Apr 8 05:34:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 6177441 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 523EA9F1C4 for ; Wed, 8 Apr 2015 05:35:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D001202B4 for ; Wed, 8 Apr 2015 05:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 991F1202A1 for ; Wed, 8 Apr 2015 05:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751904AbbDHFfA (ORCPT ); Wed, 8 Apr 2015 01:35:00 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:32862 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751571AbbDHFeo (ORCPT ); Wed, 8 Apr 2015 01:34:44 -0400 Received: by paboj16 with SMTP id oj16so103454627pab.0 for ; Tue, 07 Apr 2015 22:34:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=/kV2RwkddVKf92NgenEBxfQxAOGGhB5QtqIfr1Kxg98=; b=jY+oQKjT6IsHt4twA4WpZw1tBBAtmme1PaUk6g/EJXsmVFu/wfbn43F20EeqZuFcKN ixJ5BSNTLSRymLJpXEXmstjecrbR0/7+BmNglnDK8vkAsv2fFJQVAXsR0ZW1j6p+j5Es Xv3G62ePvDE83wf73S0iRIL2qqEMNhuo5MCqHA8YfrCNJpYj/86G80NBYcsDyeBwC6di IHAOKgoyQ80GchJvZDK0N5l36Upr4AXG8Jcemy6seVTeKZeb8RWPm8ghmis1tWGhk6sA 6kDzgC5Xh8YX5Ktj898cUp4pUZ34w7VWaUWJBl0QDDVkCCyAUnNJ/kY2/S4tNkHgdiMF j5zA== X-Gm-Message-State: ALoCoQnFdbZc5HE0+YXaTgTSOP2FcsMCSctDc8A8dpax6/IUuNx4grzCxTijAyywdpa3Rlvcy/LE X-Received: by 10.70.38.225 with SMTP id j1mr17314732pdk.14.1428471283932; Tue, 07 Apr 2015 22:34:43 -0700 (PDT) Received: from mew.localdomain (c-76-104-211-44.hsd1.wa.comcast.net. [76.104.211.44]) by mx.google.com with ESMTPSA id r4sm9898338pdg.11.2015.04.07.22.34.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Apr 2015 22:34:43 -0700 (PDT) From: Omar Sandoval To: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Omar Sandoval Subject: [PATCH 3/3] Btrfs: show subvol= and subvolid= in /proc/mounts Date: Tue, 7 Apr 2015 22:34:02 -0700 Message-Id: <213f0b6a4cffcc82688894b4edbaeb51f8e71137.1428471096.git.osandov@osandov.com> X-Mailer: git-send-email 2.3.5 In-Reply-To: References: In-Reply-To: References: 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Currently, userspace has no way to know which subvolume is mounted. But, now that we're guaranteed to have a meaningful root dentry, we can just export and use seq_dentry() in btrfs_show_options(). The subvolume ID is easy to get, so put that in there, too. Signed-off-by: Omar Sandoval --- fs/btrfs/super.c | 4 ++++ fs/seq_file.c | 1 + 2 files changed, 5 insertions(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 5ab9801..5e14bb6 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1193,6 +1193,10 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) seq_puts(seq, ",fatal_errors=panic"); if (info->commit_interval != BTRFS_DEFAULT_COMMIT_INTERVAL) seq_printf(seq, ",commit=%d", info->commit_interval); + seq_puts(seq, ",subvol="); + seq_dentry(seq, dentry, " \t\n\\"); + seq_printf(seq, ",subvolid=%llu", + BTRFS_I(d_inode(dentry))->root->root_key.objectid); return 0; } diff --git a/fs/seq_file.c b/fs/seq_file.c index 555f821..52b4927 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -538,6 +538,7 @@ int seq_dentry(struct seq_file *m, struct dentry *dentry, const char *esc) return res; } +EXPORT_SYMBOL(seq_dentry); static void *single_start(struct seq_file *p, loff_t *pos) {