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: 9784401 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 7A65160212 for ; Tue, 13 Jun 2017 17:15:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 603B02853F for ; Tue, 13 Jun 2017 17:15:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5538C2858F; Tue, 13 Jun 2017 17:15: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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable 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 E66502853F for ; Tue, 13 Jun 2017 17:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753549AbdFMRPg (ORCPT ); Tue, 13 Jun 2017 13:15:36 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:33381 "EHLO mail-io0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752109AbdFMRPc (ORCPT ); Tue, 13 Jun 2017 13:15:32 -0400 Received: by mail-io0-f174.google.com with SMTP id t87so57862993ioe.0 for ; Tue, 13 Jun 2017 10:15:31 -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=IQ1V4S/L2uu0FZscNQfiZ31PhjqXC27JLDqP+hav/ToHEytV9k36XJRTmYQ84NKOrR BFJ4IeRR/187BT8u8L/Iwx2etCAong+y7f32DNz4ljn1IaGAiSLWWL3pA9Z31/2bTuW5 3QPTh1yWS5Zwph/vkUnWPEL1nADvMwjY4HB49tcXPQtpkjJol3tN8XifVG5XNVe60WDI eXF1HTv32ZWzBDd2i0lRLHO/9xl7YF98n1+8WabVishwRHKSeWAJJhqTKeWTsiWJOtj9 WyXjAapWSpdfOoTILMX/UlE9+2tkFc7m5wu6LXCI7n91ZiWsV5rGMuidf4LuRhHgpRm9 eYew== X-Gm-Message-State: AKS2vOxxa2Vu1ALZHN52BEL7SX7GSlUsd7HsWsiLvYrVA6eMfL7jsz0n 8be/1fw/Aqg4MatE/u02qw== 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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@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);