From patchwork Tue Jun 25 01:05:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2774071 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D47D59F245 for ; Tue, 25 Jun 2013 01:05:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC2F2201CC for ; Tue, 25 Jun 2013 01:05:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB25C201C4 for ; Tue, 25 Jun 2013 01:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752547Ab3FYBFv (ORCPT ); Mon, 24 Jun 2013 21:05:51 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:51443 "EHLO mail-gh0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752452Ab3FYBFt (ORCPT ); Mon, 24 Jun 2013 21:05:49 -0400 Received: by mail-gh0-f173.google.com with SMTP id g16so3706164ghb.4 for ; Mon, 24 Jun 2013 18:05:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=T5AyrN9FL0NY3Zwhs0ogEm7ONu3sEcTbMjWviH0qKfU=; b=oMaXH6k+ouGTOXED7dRnp5PGgHbbJ8SmMN0M74Mx4ot/Gxo9MNOecuh6ZWenZXTYvD NQohm27g9v7WzfxfwaP4NeI75cw/xRsrQL1BQUNBCOnV24NlV4kj45XM/tIgGbTOnZE3 IlAF7SNg/F9i/knIC0LncVnWjBOlyth5qcOxWPxFDubghLMa9F0nRQWYUilBPGGEbwMO pOgNH13+6BbR747/nkQHcyoGX0d7ZJ2bw/EFZm17uHpPQz4V+Sh/DVnGnLOo0MkEohHQ EbAP5/evJMejAjtBYsPP4Wga98cVOALAeMq3YsSFLVFk8R8jrGA0PxF4bNhwkzqy9KaN 9lEw== X-Received: by 10.236.123.112 with SMTP id u76mr14195920yhh.59.1372122348410; Mon, 24 Jun 2013 18:05:48 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id d68sm508057yhk.7.2013.06.24.18.05.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 24 Jun 2013 18:05:47 -0700 (PDT) From: Jeff Layton To: Trond Myklebust Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, "J. Bruce Fields" Subject: [PATCH 1/2] rpc_pipe: export simple_dentry_operations and have rpc_pipefs use it Date: Mon, 24 Jun 2013 21:05:39 -0400 Message-Id: <1372122340-28982-2-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372122340-28982-1-git-send-email-jlayton@redhat.com> References: <1372122340-28982-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQmEup8nJodNGYwiVa/dccKs0Vnww2Bc8B3O6ia+uRIL342dk5fhBBbH6/EaSMxHUG4KMIlo Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.0 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 ...instead of replicating a copy of them. Signed-off-by: Jeff Layton --- fs/libfs.c | 9 +++++---- include/linux/fs.h | 1 + net/sunrpc/rpc_pipe.c | 11 +---------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 916da8c..69793f7 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -49,16 +49,16 @@ static int simple_delete_dentry(const struct dentry *dentry) return 1; } +const struct dentry_operations simple_dentry_operations = { + .d_delete = simple_delete_dentry, +}; + /* * Lookup the data. This is trivial - if the dentry didn't already * exist, we know it is negative. Set d_op to delete negative dentries. */ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { - static const struct dentry_operations simple_dentry_operations = { - .d_delete = simple_delete_dentry, - }; - if (dentry->d_name.len > NAME_MAX) return ERR_PTR(-ENAMETOOLONG); d_set_d_op(dentry, &simple_dentry_operations); @@ -987,6 +987,7 @@ EXPORT_SYMBOL(simple_write_begin); EXPORT_SYMBOL(simple_write_end); EXPORT_SYMBOL(simple_dir_inode_operations); EXPORT_SYMBOL(simple_dir_operations); +EXPORT_SYMBOL(simple_dentry_operations); EXPORT_SYMBOL(simple_empty); EXPORT_SYMBOL(simple_fill_super); EXPORT_SYMBOL(simple_getattr); diff --git a/include/linux/fs.h b/include/linux/fs.h index 65c2be2..1d21364 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2546,6 +2546,7 @@ extern int simple_write_end(struct file *file, struct address_space *mapping, extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); extern const struct file_operations simple_dir_operations; +extern const struct dentry_operations simple_dentry_operations; extern const struct inode_operations simple_dir_inode_operations; struct tree_descr { char *name; const struct file_operations *ops; int mode; }; struct dentry *d_alloc_name(struct dentry *, const char *); diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index a816b3a..99cd7db 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -471,15 +471,6 @@ struct rpc_filelist { umode_t mode; }; -static int rpc_delete_dentry(const struct dentry *dentry) -{ - return 1; -} - -static const struct dentry_operations rpc_dentry_operations = { - .d_delete = rpc_delete_dentry, -}; - static struct inode * rpc_get_inode(struct super_block *sb, umode_t mode) { @@ -668,7 +659,7 @@ static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent, } if (dentry->d_inode == NULL) { if (!dentry->d_op) - d_set_d_op(dentry, &rpc_dentry_operations); + d_set_d_op(dentry, &simple_dentry_operations); return dentry; } dput(dentry);