From patchwork Fri May 18 16:48: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: 10411249 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 97EEB601F9 for ; Fri, 18 May 2018 16:49:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88D6728619 for ; Fri, 18 May 2018 16:49:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D8CC288E6; Fri, 18 May 2018 16:49:07 +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=ham 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 ED23328619 for ; Fri, 18 May 2018 16:49:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC5B56B0608; Fri, 18 May 2018 12:49:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CAC866B0609; Fri, 18 May 2018 12:49:00 -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 B4E6D6B060A; Fri, 18 May 2018 12:49:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id 6AF256B0608 for ; Fri, 18 May 2018 12:49:00 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id z1-v6so5062890pfh.3 for ; Fri, 18 May 2018 09:49:00 -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=rfeByg3HcTDFQ8JjAYydmp9sv1pTYONlu7vUeWTfATQ=; b=hu6zfnqcrVv1s8H69LpAu/mkPYXhVjwMqPgI6Its4GI9Aijc/rwIl7KtGmLxIZyuXS MnZ4cIDOscZnc7Dmmc5ixj4b8bV00eEjw/5CNjrCnBLKqAFAiFUsPih89ziAjOC9i6X2 7lJRN/p4NUt6W52AORH6W7P2MErwNZr2EL9bKvJZO+fX2rNaG9Yfj8IVL0ms9e9Qj8YN Ss3gfxCJKEfKgVJ4z62M3LS5a2D3TXPB3zNib2GZaNU5XU+LdecHN3MY2iWkVEuw7nwH fz4kXw5WA0HurwmK/encoS3pDup2wkdz25SnAzudPQTvvFf3lnkfFoRCfBSL9qs8W4Id 9yxQ== X-Gm-Message-State: ALKqPwdubhHQ1rgUDV9UJ57n/5OyJvhyD358+UpArfvUYOwMe7y4LrRX Afw3NzbXeu9BbEGJon0s/5memX4XzzEqxrWTWx6kvZ15uD6oJodvREdpCS3TaGYPof69oRySMTt Bvacj+p/fNNRZsKoc4SgwD4LM02oWZ4Xesua4VxfxccbTjM5eYRHFLipISMZiYvc= X-Received: by 2002:a63:798f:: with SMTP id u137-v6mr13636pgc.202.1526662140099; Fri, 18 May 2018 09:49:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq61spwP2i0MZi5m9imrAH5qyTQPTfqOVgGnXeLSdtLV0eE2YIelDNAYU3lP5e9mZHjo9YR X-Received: by 2002:a63:798f:: with SMTP id u137-v6mr13612pgc.202.1526662139380; Fri, 18 May 2018 09:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526662139; cv=none; d=google.com; s=arc-20160816; b=py7ePq5q8aWnCBBk2vvXBx1hW7BrjUsB5H73fxOaiIWCmCl5hk/uroO8AVQZRfATWY dPmHUWrpX/F0EnDWRLsMkVR7pOEUnZyTkc4ANXhlfCkqC5VHQRLO1sDOJv8erBjshoDW BkvS2v67BSHdnhMxkPGwUSIIthz5QODYQDBECYv8Vc8VgAi32DUTI7XRPEDK4MhuCJxq KnFHo3UL4CuRLuu66TVVAzsHV2n/4lHnNbCStwGgn3+cIi7vTzD2YhQiKUHyzkH9cgcv DxcOvAu6t6YOYKP5TUHaVtQrxOBKxgXvJ9sVtcau9oLOyhIsc4PYPZMSoMSw8eCt0bIX BNkw== 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=rfeByg3HcTDFQ8JjAYydmp9sv1pTYONlu7vUeWTfATQ=; b=nr6PVR47ivmlOFIynBdlWQJ2Cs54+eSLSrik3+C8oj6RVUGtHv7zDw6KZVOuRMAD4s KIvwmqlgSdGNkr+eAnuDbb2yZctLtg41EtiS7rDVk188jpNL17+jzjtGPXmkRmxI7GjP dMThoaE2bWt79ioI8ZL9TKuX8QiRDeX+U/fa1vItzBhndTh6i15DNqe5xlFONQ1dbSym Q5y0soxaLQlKcnMJ5AFRhK8LZNioiFD7dnxG+gIIz32BeLFImu9DWH/UDeQNQHPPmO7o hjg9RsWtczt32GSisfsNjQ13VbjzP3npg5RxDqOsF2IPF/Q8jui2viO3nNvrDge3blsF a/3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=rnqEcpNO; spf=pass (google.com: best guess record for domain of batv+77ddf8e9b1b344f28472+5381+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+77ddf8e9b1b344f28472+5381+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 q12-v6si3060225pgs.293.2018.05.18.09.48.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 09:48:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+77ddf8e9b1b344f28472+5381+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=rnqEcpNO; spf=pass (google.com: best guess record for domain of batv+77ddf8e9b1b344f28472+5381+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+77ddf8e9b1b344f28472+5381+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=rfeByg3HcTDFQ8JjAYydmp9sv1pTYONlu7vUeWTfATQ=; b=rnqEcpNOC58LCIDrN4XkVp+AQ fUH/9YkqsHDX/wxfVo74TGgt8+k0arjG1MxGjuWfX74rGZgYrA5mV0hAdlXrisOX/MubkiiQfTmSQ Ijf+bMxd+ADPgCy/vUwUTgEl9jsafLJPSlew2E3ZfcNKK4YTr1N7FYNZdqOB74nf4nhR566tYwS/x M5cX7hn+QFxvW3w1KgwGdFzJ4faNSoofwqquZVV5gEk/5ukz44NGBoGsx1/M2uPCKJYhztui5l2I2 fzJEMIoeAPw1Kw7UXe3juscC7YxzwyNLzAsBtkTx7Gu+x32SLitMBarbt8pGefX74lkllFPJEadpx AnE/O4zKw==; Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJiYs-0006Vy-GS; Fri, 18 May 2018 16:48:58 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 09/34] iomap: inline data should be an iomap type, not a flag Date: Fri, 18 May 2018 18:48:05 +0200 Message-Id: <20180518164830.1552-10-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518164830.1552-1-hch@lst.de> References: <20180518164830.1552-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 --- 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 0fecd5789d7b..a859e15d7bec 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -503,10 +503,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; } @@ -514,8 +517,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, @@ -1326,14 +1327,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: