From patchwork Tue Jun 13 17:15:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9784395 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 3181160212 for ; Tue, 13 Jun 2017 17:15:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16EC02853F for ; Tue, 13 Jun 2017 17:15:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BEED28676; Tue, 13 Jun 2017 17:15:40 +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,DKIM_SIGNED, DKIM_VALID,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 ADF472853F for ; Tue, 13 Jun 2017 17:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753571AbdFMRPg (ORCPT ); Tue, 13 Jun 2017 13:15:36 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:33382 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753103AbdFMRPc (ORCPT ); Tue, 13 Jun 2017 13:15:32 -0400 Received: by mail-io0-f172.google.com with SMTP id t87so57863052ioe.0 for ; Tue, 13 Jun 2017 10:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S6NM5M27BE3+Masy4S78P/1BJikHqz+1OV9dpiMYaLY=; b=fEWjMX0lHfy3KLrmzM4Ayh+rkk/qIxiyzzc1QcgcjahT69Mh5Cb8gcDGKS/3tTwkAf 9ByS5j7M1DMQrpvDpYoBL3s17oxBrwHkL9i80E/VWvut0BYuIKYyDky/XtMLfXLhojRv W9vfu16p9DWk2IFVAJTFCllXqynBgkJnKik8BAmYljTF0yey0f8T+21YDhVtSab8jmeY ORnJu28D6NlvlJyv28L9VXDgc5dvn6U7khLyxIzMrr6m3XtLjTXTMeaMIzHgNZvfzz99 ZqKUAMAVUlOOOD1cDtSG8NgGackS44q3TzBSm0BwGF5JQhjKiAw16OgPJSnRp/Il/zdZ OLkw== 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=S6NM5M27BE3+Masy4S78P/1BJikHqz+1OV9dpiMYaLY=; b=SgU/kNMFxHMn7FvVTdw0fjBSwMBtiEqQW+zqQsd0jOTNHROlVcRWa6dWNRsPSvcUdE TY/fsurZ+IoLtggaU6NzwtMjMc2qUGi1ucTjE29CoIEcvBQvmVRtUqZvEJ0l0jkF1sCz BFu3+D/wCdJ6enAwq8YGxfuHVdzdNsZudWERe+NQSHBamvjYuEdpj2w/l0cucVGKxcJk ZhNRapUQhqjNaBru5eZqqsN2Mwcev2dXVbNgDugw4+w09RgnwLuNKbrJgjW5BeVZy5VR 2OVjMEMYCR+uPUZZBHLQzsg7Avox9qlM83plmZcnTyQ8hRW/A3qLTle5MU2buf7srV8D 27Lg== X-Gm-Message-State: AKS2vOxw+jO22NAQMIyzX457IB8i3+VUI48YntS5IN4Bxy0n/Y9yJfMq ebuRCNT5ZyO8hfzGppaYFg== X-Received: by 10.107.159.196 with SMTP id i187mr1158354ioe.55.1497374131165; Tue, 13 Jun 2017 10:15:31 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id y188sm6217526ity.9.2017.06.13.10.15.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jun 2017 10:15:30 -0700 (PDT) From: Jens Axboe To: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 04/11] fs: add support for an inode to carry stream related data Date: Tue, 13 Jun 2017 11:15:16 -0600 Message-Id: <1497374123-15286-5-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497374123-15286-1-git-send-email-axboe@kernel.dk> References: <1497374123-15286-1-git-send-email-axboe@kernel.dk> 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 No functional changes in this patch, just in preparation for allowing applications to pass in hints about data life times for writes. Signed-off-by: Jens Axboe Reviewed-by: Andreas Dilger --- fs/inode.c | 1 + include/linux/fs.h | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index db5914783a71..c911a2b9b5a4 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -149,6 +149,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode) inode->i_blocks = 0; inode->i_bytes = 0; inode->i_generation = 0; + inode->i_stream = WRITE_LIFE_UNKNOWN; inode->i_pipe = NULL; inode->i_bdev = NULL; inode->i_cdev = NULL; diff --git a/include/linux/fs.h b/include/linux/fs.h index 803e5a9b2654..bb8c246eeda8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -629,6 +630,7 @@ struct inode { #ifdef CONFIG_IMA atomic_t i_readcount; /* struct files open RO */ #endif + unsigned int i_stream; const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ struct file_lock_context *i_flctx; struct address_space i_data; @@ -655,6 +657,14 @@ struct inode { void *i_private; /* fs or device private pointer */ }; +static inline unsigned int inode_streamid(struct inode *inode) +{ + if (inode) + return inode->i_stream; + + return 0; +} + static inline unsigned int i_blocksize(const struct inode *node) { return (1 << node->i_blkbits);