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: 9788001 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 4105960231 for ; Thu, 15 Jun 2017 03:45:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3731323F88 for ; Thu, 15 Jun 2017 03:45:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BD9F27C2D; Thu, 15 Jun 2017 03:45:29 +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 D88E823F88 for ; Thu, 15 Jun 2017 03:45:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751711AbdFODp0 (ORCPT ); Wed, 14 Jun 2017 23:45:26 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:35591 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752033AbdFODpY (ORCPT ); Wed, 14 Jun 2017 23:45:24 -0400 Received: by mail-pg0-f51.google.com with SMTP id k71so1640472pgd.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=V3u2QNWw3KpD56wwYq8PjfrXcU7PUzhK2VYhHtKWIj1wGCLztC2rW6TBNX+JeccnNK HHJBpD+aJEzvEnk4w7KKmp8v6jEg6KUYw2JvG+BSqE+QLJTzRI7bdjrbxpoyS6FULbeg ee6w0uDm9+9GzV7n3s/ZKCW4bUqOWAtPe6d0wkJJYcahmD0wYXeeVPuldrRFvarDgUcH rGEG9aeZ9PsuCj4bJLBNlFybO1UvJfwlQNFbIbXlyrY+4cjlE8Ew251pK+jA2g1YL5uO Y+dBKqmTHbkxtaII5USOVh9dfv6p000N04HqY3svGi0fD0PGgVFTg78dPcnLvoK1jaq9 ttVg== X-Gm-Message-State: AKS2vOxa/hjbtWvPnpHzD8bbdTW0X2tEA6NBMxQTfmegyhgH/ZAQck9v msbdUvKJzTDqcrluRltWqg== 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-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_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);