From patchwork Wed Jun 22 14:35:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9193091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9354160756 for ; Wed, 22 Jun 2016 14:35:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85BFF28400 for ; Wed, 22 Jun 2016 14:35:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AAB52840F; Wed, 22 Jun 2016 14:35:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A8AB28400 for ; Wed, 22 Jun 2016 14:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752821AbcFVOf2 (ORCPT ); Wed, 22 Jun 2016 10:35:28 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:36843 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752778AbcFVOfV (ORCPT ); Wed, 22 Jun 2016 10:35:21 -0400 Received: by mail-wm0-f51.google.com with SMTP id f126so90500033wma.1 for ; Wed, 22 Jun 2016 07:35:20 -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; bh=NJZ8Xrj7xJsMcSDaXTJZg3Ebp1BB/wM6/7oH6425SS4=; b=chu5vZQUc4nLslvGVoGU+lxIeYOp+q+s1D4UNLoj6SwUBylFBvQzaJdCoDJkK5olB2 BOw780Xkow3DHpE8nvHkEZ01sJ8g2guf82XjdjAhjFAkKY5B0S7PKHYWt/yEynVsKjjx qgWVPZ2GsC+DzpkYe6r3IBe4T8u9h62607CjYNJeHET3voV5fMJ8UL81mNxrs28NqE2i GCTkL4+oZtkEzZmpwEZeMCKaYIrX6dmhV1lJEmVdsrGMyjpglgRtfk9IhwTslTSP0XSr /TSbQEB5/k3/+ISYb5HmfS9MrMzEF1W0kPCm0FpVuq60UHU1/9N09DRY+MZMQh31+deK rK+A== X-Gm-Message-State: ALyK8tLhanMBPzmtNrbOTTNIEIwrXZFPVVl6fOc220XBYYPTA/QF3ejj5YAYgD55jQK5oAdg X-Received: by 10.194.82.161 with SMTP id j1mr26745145wjy.65.1466606119946; Wed, 22 Jun 2016 07:35:19 -0700 (PDT) Received: from veci.piliscsaba.szeredi.hu (pool-dsl-2c-0018.externet.hu. [217.173.44.24]) by smtp.gmail.com with ESMTPSA id u71sm930666wmu.13.2016.06.22.07.35.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jun 2016 07:35:18 -0700 (PDT) From: Miklos Szeredi To: Al Viro Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 5/8] fuse: don't use ->d_time Date: Wed, 22 Jun 2016 16:35:07 +0200 Message-Id: <1466606110-24297-6-git-send-email-mszeredi@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466606110-24297-1-git-send-email-mszeredi@redhat.com> References: <1466606110-24297-1-git-send-email-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Store in memory pointed to by ->d_fsdata. Use ->d_allocate() to allocate the storage. We could cast ->d_fsdata directly on 64bit archs, but I don't think this is worth the extra complexity. Signed-off-by: Miklos Szeredi --- fs/fuse/dir.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index ccd4971cc6c1..1a1dabb72036 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -37,37 +37,20 @@ static void fuse_advise_use_readdirplus(struct inode *dir) set_bit(FUSE_I_ADVISE_RDPLUS, &fi->state); } -#if BITS_PER_LONG >= 64 static inline void fuse_dentry_settime(struct dentry *entry, u64 time) { - entry->d_time = time; + *(u64 *) entry->d_fsdata = time; } static inline u64 fuse_dentry_time(struct dentry *entry) { - return entry->d_time; + return *(u64 *) entry->d_fsdata; } -#else -/* - * On 32 bit archs store the high 32 bits of time in d_fsdata - */ -static void fuse_dentry_settime(struct dentry *entry, u64 time) -{ - entry->d_time = time; - entry->d_fsdata = (void *) (unsigned long) (time >> 32); -} - -static u64 fuse_dentry_time(struct dentry *entry) -{ - return (u64) entry->d_time + - ((u64) (unsigned long) entry->d_fsdata << 32); -} -#endif /* * FUSE caches dentries and attributes with separate timeout. The * time in jiffies until the dentry/attributes are valid is stored in - * dentry->d_time and fuse_inode->i_time respectively. + * dentry->d_fsdata and fuse_inode->i_time respectively. */ /* @@ -272,8 +255,21 @@ static int invalid_nodeid(u64 nodeid) return !nodeid || nodeid == FUSE_ROOT_ID; } +static int fuse_dentry_allocate(struct dentry *dentry) +{ + dentry->d_fsdata = kzalloc(sizeof(u64), GFP_KERNEL); + + return dentry->d_fsdata ? 0 : -ENOMEM; +} +static void fuse_dentry_release(struct dentry *dentry) +{ + kfree(dentry->d_fsdata); +} + const struct dentry_operations fuse_dentry_operations = { .d_revalidate = fuse_dentry_revalidate, + .d_allocate = fuse_dentry_allocate, + .d_release = fuse_dentry_release, }; int fuse_valid_type(int m)