From patchwork Wed Jun 14 19:05:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9787263 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 8CAE360325 for ; Wed, 14 Jun 2017 19:05:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EFDF24B44 for ; Wed, 14 Jun 2017 19:05:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 729642625B; Wed, 14 Jun 2017 19:05:48 +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 16AB724B44 for ; Wed, 14 Jun 2017 19:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbdFNTFq (ORCPT ); Wed, 14 Jun 2017 15:05:46 -0400 Received: from mail-it0-f41.google.com ([209.85.214.41]:36332 "EHLO mail-it0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751621AbdFNTFm (ORCPT ); Wed, 14 Jun 2017 15:05:42 -0400 Received: by mail-it0-f41.google.com with SMTP id m47so5827132iti.1 for ; Wed, 14 Jun 2017 12:05:42 -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=m/xzn4xnBQY40sqZ3aE+wGy8TaxawesS9N9rSeVXXaQ=; b=Ts0xvirPMgLAwhIbB53Fz0uoRRTQX5tirTQXwSIZ1mKyewdPP/jN0R4ZKiSfgiErQ7 Zfl+rzqyjJGK7E4963CscvjrveFnEeAy36pwCQqYlOgFBPXBT6eZXJhPCve0bfdKZ6aV wboNsr+vIRMeM0/QM7KiXzNii/RdOB2Q7ChmjHfiBmW8Q/nhPjuZmTWDrC5dyC85IECc GB0am3j9VfJaHTKWuhNDntd8zuOOO3hi44F4WWOIQ0+77dDXfJc/YEnEAM35vbB+HjK6 ainvwKuwKVilf2Rv5Df43xpGiPiCiwNu2c2pcsmh/tv6KW2LkOSmpZVGl9sCv0aBkgV/ ysvQ== 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=m/xzn4xnBQY40sqZ3aE+wGy8TaxawesS9N9rSeVXXaQ=; b=GpOWmmXL9YMSfuUvNM5BG6xVEJx5YzQgNSFzRuXa3snQz6MnCIW1UlYAvMmQHO7wUx iOYv0s9htaKKpqPtF03i+7qLbRG6V4Ad/S+FWC1QlZLIKQxVL8CRepDXX5k6xdDT4z9o 27cfpF9ORNuAai3inMPH4ZTphOg12CI616XB8i8ICR79yE1YrtQz9qX9dgK5Sac+Vff0 wG6sUz5un9vyRbyNzUjzUFn8iL5py8o0g54BEeofHyKS4u2UgSWhyfQRizTan852W0Qr F67bBxD+Uo3nkN4/rhv6PEqMCvrCibzc1EqBAczWmPkUnBlGwbxJoS5HDf+ve6jtyRRp Bz/g== X-Gm-Message-State: AKS2vOwnLVJWdVbl5HB2IcDPpqgCNkRRmsqVWnmZlXvqqgFAK0/LX/uI xeiPyW8ayv++/KPM X-Received: by 10.36.76.214 with SMTP id a205mr1633722itb.35.1497467141740; Wed, 14 Jun 2017 12:05:41 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id h67sm380361itb.19.2017.06.14.12.05.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Jun 2017 12:05:41 -0700 (PDT) From: Jens Axboe To: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: adilger@dilger.ca, hch@infradead.org, martin.petersen@oracle.com, Jens Axboe Subject: [PATCH 03/11] fs: add support for an inode to carry stream related data Date: Wed, 14 Jun 2017 13:05:26 -0600 Message-Id: <1497467134-6323-4-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497467134-6323-1-git-send-email-axboe@kernel.dk> References: <1497467134-6323-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. Pack the i_stream field into a 2-byte hole, so we don't grow the size of the inode. Reviewed-by: Andreas Dilger Signed-off-by: Jens Axboe --- fs/inode.c | 1 + include/linux/fs.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index db5914783a71..5717cb378fda 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 = 0; 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..771e172d23d7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -591,6 +591,7 @@ struct inode { struct timespec i_ctime; spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ unsigned short i_bytes; + unsigned short i_stream; unsigned int i_blkbits; blkcnt_t i_blocks; @@ -655,6 +656,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);