From patchwork Thu Apr 19 19:20:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 153853 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 02E76B7000 for ; Fri, 20 Apr 2012 05:20:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756400Ab2DSTUP (ORCPT ); Thu, 19 Apr 2012 15:20:15 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:59399 "EHLO test.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756398Ab2DSTUO (ORCPT ); Thu, 19 Apr 2012 15:20:14 -0400 Received: from root (helo=tytso-glaptop.cam.corp.google.com) by test.thunk.org with local-esmtp (Exim 4.69) (envelope-from ) id 1SKwtp-0006iE-3r; Thu, 19 Apr 2012 19:20:13 +0000 Received: from tytso by tytso-glaptop.cam.corp.google.com with local (Exim 4.71) (envelope-from ) id 1SKwtn-00055A-Qy; Thu, 19 Apr 2012 15:20:11 -0400 From: Theodore Ts'o To: linux-fsdevel@vger.kernel.org Cc: Ext4 Developers List , Theodore Ts'o Subject: [PATCH, RFC 1/3] fs: add new open flags O_HOT and O_COLD Date: Thu, 19 Apr 2012 15:20:09 -0400 Message-Id: <1334863211-19504-2-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.7.10.rc3 In-Reply-To: <1334863211-19504-1-git-send-email-tytso@mit.edu> References: <1334863211-19504-1-git-send-email-tytso@mit.edu> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on test.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The O_HOT and O_COLD flag are hints to the file system that the file is going to be frequently accessed (a "hot" file) and or very infrequently accessed (a "cold" file). It is up the file system to decide how these flags should be interpreted; in some cases, such as O_HOT, the file system may require appropriate privileges or implement check some kind of per-user quota before deciding to honor the flag. Signed-off-by: "Theodore Ts'o" --- fs/fcntl.c | 5 +++-- include/asm-generic/fcntl.h | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/fcntl.c b/fs/fcntl.c index 75e7c1f..463352d 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -835,14 +835,15 @@ static int __init fcntl_init(void) * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY * is defined as O_NONBLOCK on some platforms and not on others. */ - BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( + BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ __O_SYNC | O_DSYNC | FASYNC | O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | - __FMODE_EXEC | O_PATH + __FMODE_EXEC | O_PATH | O_HOT | + O_COLD )); fasync_cache = kmem_cache_create("fasync_cache", diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h index 9e5b035..1fdcbb1 100644 --- a/include/asm-generic/fcntl.h +++ b/include/asm-generic/fcntl.h @@ -84,6 +84,13 @@ #define O_PATH 010000000 #endif +#ifndef O_HOT +#define O_HOT 020000000 +#endif +#ifndef O_COLD +#define O_COLD 040000000 +#endif + #ifndef O_NDELAY #define O_NDELAY O_NONBLOCK #endif