From patchwork Thu May 31 18:06:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10441671 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 2FE86604D4 for ; Thu, 31 May 2018 18:06:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DA4628F25 for ; Thu, 31 May 2018 18:06:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11D4B28FAB; Thu, 31 May 2018 18:06:45 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E19728F92 for ; Thu, 31 May 2018 18:06:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 032B86B0266; Thu, 31 May 2018 14:06:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F259F6B0269; Thu, 31 May 2018 14:06:39 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC4516B026A; Thu, 31 May 2018 14:06:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f71.google.com (mail-pg0-f71.google.com [74.125.83.71]) by kanga.kvack.org (Postfix) with ESMTP id 92A366B0266 for ; Thu, 31 May 2018 14:06:39 -0400 (EDT) Received: by mail-pg0-f71.google.com with SMTP id z20-v6so2130341pgv.17 for ; Thu, 31 May 2018 11:06:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=hotfG4tHc0LLH7SNZ1e2SfKD0zSBAyBWIaoweS4oib0=; b=d1L8yQ3DjCtEGKMA2RQS/Ye/SFBryEHZ+E+PK4d4cvuhM0HhK9KeLSEgWnO0jRzNbg /iuhwO5JNiBM8hIjFOofzyIpSdZdArB3Q+xwjqerIFuhFn2qPzt0DURmoLZZo2eMV4Z4 ndUCD/L8RGVG3H5wUuoh6hDpXlfZnH3YvLUqTtufRUJeP3vq5Uuz6ze61F7vNM5VY7Or r0zb9z2U8aPLZmLK0wqy30NBNICUInonN/UI9hp3DGduVZ3P9OEFKc9staCmJa0pKiGh hKW1to0e/diAmCM4gdSLrB/n9wNkFJWXb5E7gOBPCIEG3evBNi8MCX1NYnDShoCi/CmP ZeIg== X-Gm-Message-State: ALKqPwfjtkeJC6uqTW6mbAxyyvt27KXlrQmzC1J125pcQr0Le2AaGNhu O2nny+3viYAnHVQmXCezMfpqE/7SPdYzoYLZlEeyMiz9iXO0kafBp/zL+We1JGzkvYfa9wBj5Zd P3mYXsAiffK1NWJkd15ZVaYXHg25jYNe6g667DH2yIC9aSIP5fXn2UAaSrMP4XYc= X-Received: by 2002:a63:6fcd:: with SMTP id k196-v6mr2386710pgc.267.1527789999238; Thu, 31 May 2018 11:06:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLINfLuxx6IAMe5mjhkaTQY9pbn2CVgWuJB0xYsW5oZ0a+EXseHD4DRMbzpvncQF7xDh6mS X-Received: by 2002:a63:6fcd:: with SMTP id k196-v6mr2386675pgc.267.1527789998143; Thu, 31 May 2018 11:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527789998; cv=none; d=google.com; s=arc-20160816; b=mONxsQW58GfLLB63E0Sh3gdLQX2rveHx3qIpK7Y1VNkwjLjF73h/i63uqHH1dMlkQK 2veAsQ68I3AcxjBkl4/iOf2+DINPglZGMjoGtwV52d20zzoGLNw0yk/qjyRsp+j9T3mq lKz08qcVJn8k/MnFPy9bdNbGEZCVlWdg2dFzDK79m2VUbVU0IAqXdL6227G7Fso9aC35 T0rI93hklyP9ULhD3pNO7FF9H2VRRwRx4/d0qH0DTpfl2i0jovjT8tyTH3ed+dK68Cya YTVm2trcG/bxNuoKbXgIPunXVWOuE8170nZDBFqwweO5yrjhC4YkzLM+jGo4lXmGdjMb RuYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=hotfG4tHc0LLH7SNZ1e2SfKD0zSBAyBWIaoweS4oib0=; b=IY34Hqo17Ve9OVVe7pm6pq7ZKtEvozdGjlsz5jQlbquMCigWlIcD7tRecJyNSf3B81 bnlR3pebpF6QkuG7GN7zOXw4uMbmrS0yVvS8IlBnX1lqvzsuG9ghcEOwURCfX7bzLsHX ZjqMw1DBOj3Ffaopj4y1mDT6a0ju7C50fAghcfI6BWD1BG8sthmGkK0ApjgwfLt9GT02 UHLTXtHHr0cOUcbc1jC1WmYpwPzTd7D7B1Y9AsajYtwkV1xfZLOoScrM1lYmrTRV8hdD wo5qlgqCc8jLtyNFAyb0E5XyktbwLYleFxZ1gnFgYHtWS22WPzCzjP52Owj3ofmUM1QA FYnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=bu5ZbFm+; spf=pass (google.com: best guess record for domain of batv+67dfbb8f664e29ec4bbc+5394+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+67dfbb8f664e29ec4bbc+5394+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id h127-v6si41307028pfb.111.2018.05.31.11.06.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 11:06:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+67dfbb8f664e29ec4bbc+5394+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=bu5ZbFm+; spf=pass (google.com: best guess record for domain of batv+67dfbb8f664e29ec4bbc+5394+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+67dfbb8f664e29ec4bbc+5394+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hotfG4tHc0LLH7SNZ1e2SfKD0zSBAyBWIaoweS4oib0=; b=bu5ZbFm+0XDfpwoZzENMLViBo OrGWANnBrobIl0xCaimKW9tDzZr+/gK+Hvv5IkMeQs+J1hsJuQGxiGnmOWeVNlfXwZy5GWXSK+JGi WXoO2LgPvoeJn74k7fYmbK1ycux2BtymBvzfYKZ5DFNHAVXzmhvSyD91sv8318urr6HcW03c/mnmA r6pMQiUd974PMxl3d6qPIqTBslxYmGp+tENhAkuQlT8XdXC55ZE+nsUyrLZ/woJKtRyRRP3zXRSI5 vjuLIoFbSC4Ywf5ky4vdgh/+jh8milGm5eyeVXF7TFOnhJRFryckaDQThmg3BbVDNfs13PrQQppS0 wwPrNKXhg==; Received: from 213-225-38-123.nat.highway.a1.net ([213.225.38.123] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fORy6-0003Il-MK; Thu, 31 May 2018 18:06:35 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/13] iomap: inline data should be an iomap type, not a flag Date: Thu, 31 May 2018 20:06:06 +0200 Message-Id: <20180531180614.21506-6-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531180614.21506-1-hch@lst.de> References: <20180531180614.21506-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Inline data is fundamentally different from our normal mapped case in that it doesn't even have a block address. So instead of having a flag for it it should be an entirely separate iomap range type. Signed-off-by: Christoph Hellwig Reviewed-by: Dave Chinner Reviewed-by: Darrick J. Wong --- fs/ext4/inline.c | 4 ++-- fs/gfs2/bmap.c | 3 +-- fs/iomap.c | 21 ++++++++++++--------- include/linux/iomap.h | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 70cf4c7b268a..e1f00891ef95 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -1835,8 +1835,8 @@ int ext4_inline_data_iomap(struct inode *inode, struct iomap *iomap) iomap->offset = 0; iomap->length = min_t(loff_t, ext4_get_inline_size(inode), i_size_read(inode)); - iomap->type = 0; - iomap->flags = IOMAP_F_DATA_INLINE; + iomap->type = IOMAP_INLINE; + iomap->flags = 0; out: up_read(&EXT4_I(inode)->xattr_sem); diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 278ed0869c3c..cbeedd3cfb36 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -680,8 +680,7 @@ static void gfs2_stuffed_iomap(struct inode *inode, struct iomap *iomap) sizeof(struct gfs2_dinode); iomap->offset = 0; iomap->length = i_size_read(inode); - iomap->type = IOMAP_MAPPED; - iomap->flags = IOMAP_F_DATA_INLINE; + iomap->type = IOMAP_INLINE; } /** diff --git a/fs/iomap.c b/fs/iomap.c index f2456d0d8ddd..df2652b0d85d 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -502,10 +502,13 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi, case IOMAP_DELALLOC: flags |= FIEMAP_EXTENT_DELALLOC | FIEMAP_EXTENT_UNKNOWN; break; + case IOMAP_MAPPED: + break; case IOMAP_UNWRITTEN: flags |= FIEMAP_EXTENT_UNWRITTEN; break; - case IOMAP_MAPPED: + case IOMAP_INLINE: + flags |= FIEMAP_EXTENT_DATA_INLINE; break; } @@ -513,8 +516,6 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi, flags |= FIEMAP_EXTENT_MERGED; if (iomap->flags & IOMAP_F_SHARED) flags |= FIEMAP_EXTENT_SHARED; - if (iomap->flags & IOMAP_F_DATA_INLINE) - flags |= FIEMAP_EXTENT_DATA_INLINE; return fiemap_fill_next_extent(fi, iomap->offset, iomap->addr != IOMAP_NULL_ADDR ? iomap->addr : 0, @@ -1214,14 +1215,16 @@ static loff_t iomap_swapfile_activate_actor(struct inode *inode, loff_t pos, struct iomap_swapfile_info *isi = data; int error; - /* No inline data. */ - if (iomap->flags & IOMAP_F_DATA_INLINE) { + switch (iomap->type) { + case IOMAP_MAPPED: + case IOMAP_UNWRITTEN: + /* Only real or unwritten extents. */ + break; + case IOMAP_INLINE: + /* No inline data. */ pr_err("swapon: file is inline\n"); return -EINVAL; - } - - /* Only real or unwritten extents. */ - if (iomap->type != IOMAP_MAPPED && iomap->type != IOMAP_UNWRITTEN) { + default: pr_err("swapon: file has unallocated extents\n"); return -EINVAL; } diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 4bd87294219a..8f7095fc514e 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -18,6 +18,7 @@ struct vm_fault; #define IOMAP_DELALLOC 0x02 /* delayed allocation blocks */ #define IOMAP_MAPPED 0x03 /* blocks allocated at @addr */ #define IOMAP_UNWRITTEN 0x04 /* blocks allocated at @addr in unwritten state */ +#define IOMAP_INLINE 0x05 /* data inline in the inode */ /* * Flags for all iomap mappings: @@ -34,7 +35,6 @@ struct vm_fault; */ #define IOMAP_F_MERGED 0x10 /* contains multiple blocks/extents */ #define IOMAP_F_SHARED 0x20 /* block shared with another file */ -#define IOMAP_F_DATA_INLINE 0x40 /* data inline in the inode */ /* * Magic value for addr: