Received: by 10.223.185.111 with SMTP id b44csp1646556wrg; Sat, 10 Mar 2018 10:30:45 -0800 (PST) X-Google-Smtp-Source: AG47ELszxQg80+IwRraZzgjFRLPNXmkxgd/mDprhTnMfTlkvYmAT6hTsrYFUUccuyFKQcFMhB8wx X-Received: by 2002:a17:902:8a94:: with SMTP id p20-v6mr2808223plo.74.1520706645782; Sat, 10 Mar 2018 10:30:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520706645; cv=none; d=google.com; s=arc-20160816; b=iVaTeqI2e78JwIg6wX962Dya5mq4Qb78ofCDTpwtGURW+z43OtHI8V6/KYEA1NL6FP 9SRTd0S6ktIOxazQZ+cIZp185KPz8emJr3SgkzxyU/d1hzmDp68mPfrjPCnkKD3HyUM6 bmDi4JMzxys4E5LeaOwR37wFllsFvLNRs0MMbQJHnq9u7rL7Cqt6dRHvpHazuWn1474K M6KTidnWCNysyGluMJJ12tw9Zg1u/dHkbJXKf/iLettpWMK9Cb136vJvbOZ3uIMRrzG4 sT3u4vAA+7LyjTS4aY3NbAz1qOlqbb6Yi6HR1ZvzOm3RBk8cb2Z1UImdxB4a7Mc8T7nl rKgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=G9ZBcBjFAWczdZyrpAg1M/J+xWQNIR+loegDsVKUyzg=; b=ZaBhFjVV4DpoA4fBWDmS4JmUCVDevRLcRWqcHJ3qSCZRhPahI1QjXmEeIzBXi3J/4Z whFumH0H2/JqEtEp15Us/PqRbNaCRm0YHYm1uiyqGfIfJW2SBE3WiWogUaAyz/0V+6ph dUjB0y6NSIIDBf8cLdacCe9wguz8TIVNb1NhMRxBeevH1n6Be+P3W8j4zKvcHOVJFQSY RNCresRbVmQ91E2N2BnZlTogZK2ztT89vKsGM7rWwvT4J75TYbKH/UxnhjNyo492h3QW XhlfaXHZxPFoq/QZbLHRoJP9IZy8WyTaI98t7c7IZkmkOLdQruBnilXnhL16Her3O3kw NeDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=iVC3rPJK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s10-v6si3206992plj.626.2018.03.10.10.30.31; Sat, 10 Mar 2018 10:30:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=iVC3rPJK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751866AbeCJS3o (ORCPT + 99 others); Sat, 10 Mar 2018 13:29:44 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34790 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932741AbeCJSVa (ORCPT ); Sat, 10 Mar 2018 13:21:30 -0500 Received: by mail-pf0-f195.google.com with SMTP id j20so2625468pfi.1 for ; Sat, 10 Mar 2018 10:21:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eng.ucsd.edu; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G9ZBcBjFAWczdZyrpAg1M/J+xWQNIR+loegDsVKUyzg=; b=iVC3rPJKLS+mh/Yf+EQlYi9RlB6eX1VPHk6Wgvcay1dAFtGoQ8y5yN0/TvKOwv1QNi 2X6dfAUQFrJOCXISBx3ZxyIjyU1XLD1S2GX9LSF0dALBRGx4f2awDPy1QnLfwFBHNrcQ 5+Xl81FjG21tf6xu/hU+c2wodWb9QD6JefXAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G9ZBcBjFAWczdZyrpAg1M/J+xWQNIR+loegDsVKUyzg=; b=N7xhPDhuLrrc4KoDvce0+ECVS9sNkm5dxCL0f1BTwYbS6wkRt21t5uKnvciaf4bP1G +1hg2UFbkfc4Bfh0V8zsCQz2qoQY23Nh1aKmt0YpywbVAyXGkOctIVElVOY7QcY/IyRa OgO2Z5N2pKoJpLtuWsWRzAc/XXPnUoCKXqeDPfKqjUzpFXwFM7XF7uc+73CMuRIsm+Rh EDes9wsEZrv7dU/mMaSFvQiHLGiuLMT97dWTwNpYvoWKZ960kYXJKOxWXkRuNr0Nj67L Zmx/ervzkfov/enTqWBGFgb1TN7Bjrw3yqY6PJZvbbEK7SPC/t7D0BfkVZBPuzWJqvOY Znvw== X-Gm-Message-State: AElRT7HIrQR1DfR8Lh1kQ3xq/Y7I6aTO1t6lw6rwkQxdsU2ech2y5KvS V3gMBtwosr4lfzMEovY+sNObkg== X-Received: by 10.99.109.72 with SMTP id i69mr1605068pgc.417.1520706089801; Sat, 10 Mar 2018 10:21:29 -0800 (PST) Received: from brienza-desktop.8.8.4.4 (andxu.ucsd.edu. [132.239.17.134]) by smtp.gmail.com with ESMTPSA id h80sm9210167pfj.181.2018.03.10.10.21.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 10:21:29 -0800 (PST) From: Andiry Xu To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Cc: dan.j.williams@intel.com, andy.rudoff@intel.com, coughlan@redhat.com, swanson@cs.ucsd.edu, david@fromorbit.com, jack@suse.com, swhiteho@redhat.com, miklos@szeredi.hu, andiry.xu@gmail.com, Andiry Xu Subject: [RFC v2 61/83] Super: Add nova_export_ops. Date: Sat, 10 Mar 2018 10:18:42 -0800 Message-Id: <1520705944-6723-62-git-send-email-jix024@eng.ucsd.edu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> References: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andiry Xu Signed-off-by: Andiry Xu --- fs/nova/super.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/fs/nova/super.c b/fs/nova/super.c index daf3270..0847e57 100644 --- a/fs/nova/super.c +++ b/fs/nova/super.c @@ -51,6 +51,7 @@ module_param(nova_dbgmask, int, 0444); MODULE_PARM_DESC(nova_dbgmask, "Control debugging output"); static struct super_operations nova_sops; +static const struct export_operations nova_export_ops; static struct kmem_cache *nova_inode_cachep; static struct kmem_cache *nova_range_node_cachep; @@ -631,6 +632,7 @@ static int nova_fill_super(struct super_block *sb, void *data, int silent) sb->s_op = &nova_sops; sb->s_maxbytes = nova_max_size(sb->s_blocksize_bits); sb->s_time_gran = 1000000000; // 1 second. + sb->s_export_op = &nova_export_ops; sb->s_xattr = NULL; sb->s_flags |= MS_NOSEC; @@ -904,6 +906,52 @@ static struct file_system_type nova_fs_type = { .kill_sb = kill_block_super, }; +static struct inode *nova_nfs_get_inode(struct super_block *sb, + u64 ino, u32 generation) +{ + struct inode *inode; + + if (ino < NOVA_ROOT_INO) + return ERR_PTR(-ESTALE); + + if (ino > LONG_MAX) + return ERR_PTR(-ESTALE); + + inode = nova_iget(sb, ino); + if (IS_ERR(inode)) + return ERR_CAST(inode); + + if (generation && inode->i_generation != generation) { + /* we didn't find the right inode.. */ + iput(inode); + return ERR_PTR(-ESTALE); + } + + return inode; +} + +static struct dentry *nova_fh_to_dentry(struct super_block *sb, + struct fid *fid, int fh_len, + int fh_type) +{ + return generic_fh_to_dentry(sb, fid, fh_len, fh_type, + nova_nfs_get_inode); +} + +static struct dentry *nova_fh_to_parent(struct super_block *sb, + struct fid *fid, int fh_len, + int fh_type) +{ + return generic_fh_to_parent(sb, fid, fh_len, fh_type, + nova_nfs_get_inode); +} + +static const struct export_operations nova_export_ops = { + .fh_to_dentry = nova_fh_to_dentry, + .fh_to_parent = nova_fh_to_parent, + .get_parent = nova_get_parent, +}; + static int __init init_nova_fs(void) { int rc = 0; -- 2.7.4