From patchwork Fri Sep 28 15:42:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10620135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E71FA15A6 for ; Fri, 28 Sep 2018 15:43:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E01F32BD83 for ; Fri, 28 Sep 2018 15:43:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE3D72BF35; Fri, 28 Sep 2018 15:43:42 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 884052BF32 for ; Fri, 28 Sep 2018 15:43:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729568AbeI1WHE (ORCPT ); Fri, 28 Sep 2018 18:07:04 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35782 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729563AbeI1WHD (ORCPT ); Fri, 28 Sep 2018 18:07:03 -0400 Received: by mail-wr1-f66.google.com with SMTP id o16so6900237wrx.2 for ; Fri, 28 Sep 2018 08:42:43 -0700 (PDT) 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=6kSjpHgzA6z91vgrja6vThHugEbFBwVE8go3dvJ9CMo=; b=lP9Q1wq3y838dIUTlo8ZSAKNeyRuAhuEVK/+sDJUZ9FAl1HtsnVRUSacM4z0JfqMwd 2GAQFAelBfboCu1G80IwB/ZP/OFd5OD+lWauIKnsT+qZazvq0qeETmKQORqchXjm8j7R I71T4LAuYjPCLwK0TCWs3vu25gAnSnArVHSKZf5ZVv28ssB3Yk5rI51n5DXLr5qj0a/R 8v+ybd/PoemvwXgk9+93+/MvYOEEFV5N0cHufWreJweyHAfny+G5YYToD6TK1JSMXiBl Lk9bGG9NSLrpiODMwO2grpKqwzyHgZEjX7GzlZzCDPrJaSi7Pij59VcDiroEhYHKNqcM uS+Q== X-Gm-Message-State: ABuFfojPKRNfnLabPhjcTRFNqQAV5xHHlPOG8QqLjFrfQL9787qRKZUa 6P40ngi/TX/XpgWvwf9gCbCWmHhn5H4= X-Google-Smtp-Source: ACcGV62zcmzrb/L2JPTd4xySn71M1T4AFK6sv3jGr8QWT4H1goIFKnem59UWHBItHF7z+TqY9Xhr2w== X-Received: by 2002:adf:e2c5:: with SMTP id d5-v6mr12855022wrj.139.1538149362815; Fri, 28 Sep 2018 08:42:42 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id v2-v6sm2009877wme.36.2018.09.28.08.42.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Sep 2018 08:42:41 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/9] fuse: add FOPEN_CACHE_DIR Date: Fri, 28 Sep 2018 17:42:27 +0200 Message-Id: <20180928154234.19270-3-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180928154234.19270-1-mszeredi@redhat.com> References: <20180928154234.19270-1-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 Add flag returned by OPENDIR request to allow kernel to cache directory contents in page cache. The effect of FOPEN_CACHE_DIR is twofold: a) if not already cached, it writes entries into the cache b) if already cached, it allows reading entries from the cache The FOPEN_KEEP_CACHE has the same effect as on regular files: unless this flag is given the cache is cleared upon completion of open. So FOPEN_KEEP_CACHE and FOPEN_KEEP_CACHE flags should be used together to make use of the directory caching facility introduced in the following patches. The FUSE_AUTO_INVAL_DATA flag returned in INIT reply also has the same affect on the directory cache as it has on data cache for regular files. Signed-off-by: Miklos Szeredi --- include/uapi/linux/fuse.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 92fa24c24c92..e30e3a6868cd 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -116,6 +116,9 @@ * * 7.27 * - add FUSE_ABORT_ERROR + * + * 7.28 + * - add FOPEN_CACHE_DIR */ #ifndef _LINUX_FUSE_H @@ -151,7 +154,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 27 +#define FUSE_KERNEL_MINOR_VERSION 28 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -219,10 +222,12 @@ struct fuse_file_lock { * FOPEN_DIRECT_IO: bypass page cache for this open file * FOPEN_KEEP_CACHE: don't invalidate the data cache on open * FOPEN_NONSEEKABLE: the file is not seekable + * FOPEN_CACHE_DIR: allow caching this directory */ #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) #define FOPEN_NONSEEKABLE (1 << 2) +#define FOPEN_CACHE_DIR (1 << 3) /** * INIT request/reply flags