From patchwork Thu Jun 15 03:45:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9787999 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 511FC60231 for ; Thu, 15 Jun 2017 03:45:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46D9723F88 for ; Thu, 15 Jun 2017 03:45:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B70027C2D; Thu, 15 Jun 2017 03:45:28 +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 DAE8E23F88 for ; Thu, 15 Jun 2017 03:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751739AbdFODp0 (ORCPT ); Wed, 14 Jun 2017 23:45:26 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:35592 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbdFODpY (ORCPT ); Wed, 14 Jun 2017 23:45:24 -0400 Received: by mail-pg0-f53.google.com with SMTP id k71so1640524pgd.2 for ; Wed, 14 Jun 2017 20:45:24 -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=wx53/Sn/l+hE/B9CXJe9Ju6IXSGhY+9oxH5VWn3A5n8=; b=C3naYS/uxCZRBzsZ2wDhmz5ehVi9pGc3slIHYSrNAWJUH3vLN8409P/Z4a2eYYntNT PhO3yJtcNCzCHjuN1YEW4ZbD+WLje482Z4WAOA7AMwa5jAhTZDKxHw13+y3uqrPLPrse 7Bn6b4LsVcCQu+WApX/7DnWtDIjfcWZ9+NGeWxUm/8E/zG+gvdftaUf3cqPkb5zUT+oJ fVFpky+TggVmRiMEr66xtT4QMiqa8GYcNriWqthRJ0YZFgjhUYd3rFhccsDrVFPWwWIS BKtHi0mq6usp0IdJqrybcvMIKQM9y8/ugFMqVOGY8I5R6SLMa8JRhKPCNTh5hgV723zr IW0A== 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=wx53/Sn/l+hE/B9CXJe9Ju6IXSGhY+9oxH5VWn3A5n8=; b=DxG1lWjK62wEqTnWpSiUpXrxkmX2qyIwC8utXUM6m2gXlZDHyZclJ2a44JVpz9g2Gh +5Wc1a8IcjJUyYBKhJ1hQGUHEoUAxrbfqbVYSP4LiGTPZt65VETEOjaV0/sQfkFSU5L3 9BzFv/ANKNs2ocTccmr7O91tuxgcEbk8PVUzYtZbeHY7s4YQ12DYBxhF1Ixi6FhbPCkk Itl4n8OwKAlYOXYpb2yzSWiA2r3usKjFZetTZlvdvi/IFvFhNO2OcVdhVct25yuGJEtO 2rK5rs5uxhncVuWx1CjoXxUAGjniHo7ePiyhotPfiSygKppNH8N3eJv8mVFPASd24NqM ePVw== X-Gm-Message-State: AKS2vOzZxP/JR7Exi+OuBnmvkeNutJpxa21sABmQU++39pIy/H9za2zX dm2aPgJ3i4An9/YyfoOyVQ== X-Received: by 10.84.224.135 with SMTP id s7mr3821601plj.1.1497498323983; Wed, 14 Jun 2017 20:45:23 -0700 (PDT) Received: from localhost.localdomain (66.29.164.166.static.utbb.net. [66.29.164.166]) by smtp.gmail.com with ESMTPSA id f71sm2532627pfd.98.2017.06.14.20.45.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Jun 2017 20:45:23 -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 21:45:04 -0600 Message-Id: <1497498312-17704-4-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497498312-17704-1-git-send-email-axboe@kernel.dk> References: <1497498312-17704-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. Pack the i_write_hint 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..bd8bf44f3f31 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_write_hint = 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..f4f9df8ed059 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_write_hint; 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_write_hint(struct inode *inode) +{ + if (inode) + return inode->i_write_hint; + + return 0; +} + static inline unsigned int i_blocksize(const struct inode *node) { return (1 << node->i_blkbits);