From patchwork Wed May 30 09:58:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10438143 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 98920602CC for ; Wed, 30 May 2018 09:58:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89198281D2 for ; Wed, 30 May 2018 09:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D98B284C4; Wed, 30 May 2018 09:58:43 +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 B5CBE283CB for ; Wed, 30 May 2018 09:58:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73A766B026A; Wed, 30 May 2018 05:58:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6E7846B026B; Wed, 30 May 2018 05:58:40 -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 5D8806B026C; Wed, 30 May 2018 05:58:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id 1D5EE6B026A for ; Wed, 30 May 2018 05:58:40 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id b36-v6so11098306pli.2 for ; Wed, 30 May 2018 02:58:40 -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=AEBpKjSIULVPVqPzP2jzTgZZvWF8tYXGHeh0y6OuOT4=; b=C6QeKpcWgvpTX+AVfWuaJrrf6slIjCNi5SWwg7WiSczfawVaadcOPOSo1oZtUApjmF 2U0WNOnYMM0LVUWL2qyPG3MoPucGim+crstVbBUjmtIDS7aRbp9d1m435O8n/itJaA5m c3/nTAt35gSBln6tK2ohJ5IwxZTlN3CH3te0wauy4sU77Iw+zhgbp9FY6Z1ICTDwKwQm ZIZDPV8uoZi7w6q9InStaDVWTxSqu7uY6yynAdsFpi4mNuXXQ2xW3eyC/VvcHBNbDGBi Q6W3P31kFqheAnkkKhdyFu0BCNZS3qNKDS3z1Lxu9CaV4uEWfL65k7frmvPTwx8jKDGB sFng== X-Gm-Message-State: ALKqPwfGD5BcKFScsJOnX2Z/H/2KSvQYdyJuus6FzqdZtiAZ1Gvp6ibm OBOyvKVmIl0+6zGBoTSNCdtWbsVRtQCFIQt4V9IAPCiNMeGWZG6R/O/tO/79irYRGOc9l/IdQZu OHBveCEWevo3LLP4Npce79G2QlBUvFZr6odoNQzj/YNFpFY3e0RM8K5PTipgeYYQ= X-Received: by 2002:a63:a05d:: with SMTP id u29-v6mr1702381pgn.80.1527674319788; Wed, 30 May 2018 02:58:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKVosoEAoYPsLDHrVpCnB5gNFUTu2s1erkLCyBpD5h+Kb22W1GGFfeFscxwx4Jf8pYUxqQG X-Received: by 2002:a63:a05d:: with SMTP id u29-v6mr1702353pgn.80.1527674318965; Wed, 30 May 2018 02:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527674318; cv=none; d=google.com; s=arc-20160816; b=jLg6g7Zr9m6ydcIafEngx+VVoc9wFp61g5jdKcztTon9BarR4wX726DYQ8TM5gdj36 pbzt+jq6s0cssVjixy1VhgU9xNwfBvD9U3MakCY/MUQRHMvCYYWed7MkJg/7uZMX73I+ VGpKwe7GIhHSdLma4V7RRlH9qoKlPBQFScHvGJGC6i2iMOFSwIKD+AUc1ZGiF7/OVRqT ih38toQ+Gy3n6Wq/h2K0Ifxh99/hXoCZoDJQfBiAXnkllYwK2jolnGS5R+svYANJ66Q8 RXKDvBISZ2oLnF8MM7ITkUnjqWo3J4JAL3kJhRcSnLpaSOJrhJY1OzzzXTjNldtghtDn P6ow== 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=AEBpKjSIULVPVqPzP2jzTgZZvWF8tYXGHeh0y6OuOT4=; b=wOuEppWUt/nFKzlpy2jM3w376B8R/cX4+TKw9t67YMNoJYrODGhBxLF4+iOnIExRRg HgkKUTUweeFJtmGXuyfn9Zh/yY/djt66VoCZbimVE3Zcs0fO6owoW6TegXsrp8yzunMM VCcbrp3EH48HwVErdF2jQ+ewkgqU7PMdLy/JO5nNxXooPLn/O8Oq73kVGg2cILd6LE1X 3jVeIvNorA7G6OmCjp29ynrtnS1h96iPagUYgnSnoLsskRWX5DlwdnPJ66oL5ZfGbVBz E87NLES/CJpZt/Wrz7jbYZ8TulgPxIQTmAuqWkFFG5KQTAFGgZGLAHOl4tDU6Y/3HH3H aDIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=GtfZ7X25; spf=pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+1f4557cc97fec8e307c5+5393+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 v80-v6si35311829pfa.173.2018.05.30.02.58.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 02:58:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+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=GtfZ7X25; spf=pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+1f4557cc97fec8e307c5+5393+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=AEBpKjSIULVPVqPzP2jzTgZZvWF8tYXGHeh0y6OuOT4=; b=GtfZ7X25lqsUar1hiHAiBl6/O dRk593JvFUNSWR8/ogLAVjNdq63TAtkdwyNZoGpIolabsG4lAXC2cWlhEoSMPCaFWtwaadC1JEhwm qZVtFKMJFQzmzdnZTiMuY49//DWGxHxxgoA3vf4p1kJj6g1pZqshQojMCsJdDKtWzbDj7jJDfxSr+ Bs+PzHCkKj4GD5GoGiTwmkjei+d+WFIjKgx7a10I9WJfKbZSE74Y4xyVKgl9KH/p0DhCFow8o5kY8 WnDLXLVDXhTtbzjcNvY4QKkGinlsgJjRUxYTFKFfvdEN2g/7xz75EXanlrqWochLOIeEA/gQHLxH4 VIszzAdBw==; 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 1fNxsL-0006Uh-Q2; Wed, 30 May 2018 09:58:38 +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: Wed, 30 May 2018 11:58:05 +0200 Message-Id: <20180530095813.31245-6-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530095813.31245-1-hch@lst.de> References: <20180530095813.31245-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: Darrick J. Wong Reviewed-by: Dave Chinner --- 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: