From patchwork Wed Jun 14 04:01:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9785283 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 6393760325 for ; Wed, 14 Jun 2017 04:02:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CF02283BD for ; Wed, 14 Jun 2017 04:02:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61D3A28589; Wed, 14 Jun 2017 04:02:16 +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 16364283BD for ; Wed, 14 Jun 2017 04:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750749AbdFNECL (ORCPT ); Wed, 14 Jun 2017 00:02:11 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:36285 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbdFNECI (ORCPT ); Wed, 14 Jun 2017 00:02:08 -0400 Received: by mail-pf0-f177.google.com with SMTP id x63so77508684pff.3 for ; Tue, 13 Jun 2017 21:02:08 -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=yKgbFwlHh+oWcLz/DcWNHvnLNr25XaA7ckvuyFV3YslO0E7Ro416ygD/+ExqNS4P5s sOoM/ov/p1p5zn1F0UrBOJemLPL/5Mgptv6aTBAZodiEBhR+uGHCTSEk/3FJctZxP9cA nL9XDJlVL3aNeKddEOB0C10+/GRO1xTjFa7sVMdK5JrOLWH5eXBAu8ilwTDzOCCBFo7h Q2DHqdgzbIsnLObaRjHNQpOVesCbItz2w44sTR/QlsyNw4pfnOl0OHZ91jzTh9cr/9v9 Yybfb2sSwl9Pug35+alTNuDL3KXS4tdmIdrQF3oEUIEWkEXgKporqcD1kCR0XhBPGqCj jK0Q== 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=dwSevg5lcO8YDNu7pGVQ0l4x+H7GkoVh2v8G2gCa9dmQSuM/PAx1GIW0I9shj8gN7N WyTAQ0XQ0IyYYIyrh7ikCpz2UQFUHPyqVkSNr6kVzYH15UhV5pcbq2CRLtsMDZqFt8yx 8tUeZrQ37eBgg3wo1p9KWlztlK8nsNKcez/XdtYdC8dbK3oqO0xAdnhEcNGxqEi39erS OcHKTGGks7Co9fdXX6wOsptRekQrdsfaJjnXaKC9ukdYwLOJdha21aBrIqYSkhiUYCYm ZZEXMixE7YuDRbI0KsDSqf5oZ8ynqRyUss2fEpmi/PveC84WBD2QsNRW0xf46gnftoDq 9W2A== X-Gm-Message-State: AKS2vOw57e0gL2OhiU8IXJNiAIv79Baae08CB+QWrxRFNxsnQx8uzf/r W58gChrlU9TegHIJ X-Received: by 10.99.112.86 with SMTP id a22mr2536164pgn.158.1497412928263; Tue, 13 Jun 2017 21:02:08 -0700 (PDT) Received: from localhost.localdomain (66.29.164.166.static.utbb.net. [66.29.164.166]) by smtp.gmail.com with ESMTPSA id f8sm30914083pfc.14.2017.06.13.21.02.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jun 2017 21:02:07 -0700 (PDT) From: Jens Axboe To: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: adilger@dilger.ca, Jens Axboe Subject: [PATCH 03/10] fs: add support for an inode to carry stream related data Date: Tue, 13 Jun 2017 22:01:52 -0600 Message-Id: <1497412919-19400-4-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497412919-19400-1-git-send-email-axboe@kernel.dk> References: <1497412919-19400-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);