From patchwork Wed May 23 14:43:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10421515 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 DBC2360545 for ; Wed, 23 May 2018 14:44:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBEF326E82 for ; Wed, 23 May 2018 14:44:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C05C928802; Wed, 23 May 2018 14:44: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 4B7C3287E9 for ; Wed, 23 May 2018 14:44:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D85FB6B026C; Wed, 23 May 2018 10:44:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CC2CF6B026D; Wed, 23 May 2018 10:44:31 -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 B0E216B026E; Wed, 23 May 2018 10:44:31 -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 670B26B026C for ; Wed, 23 May 2018 10:44:31 -0400 (EDT) Received: by mail-pg0-f71.google.com with SMTP id h15-v6so2448645pgv.7 for ; Wed, 23 May 2018 07:44:31 -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=JZ0K/FtBZCBQt+q9RE5ouAqk4RqELbY2cIBnCxzOsjQ=; b=DMGH/W9VdQys/UCqEaviDdVMRToGUM1PAbUoEXWVMIDsdYMJqaN2Qk3pBH0ROcuGmy hBKUUewVjYmSAU1h06FxX1IDs9NCq92wDQnCb2Fq7inEP1nkeyJXYukkbj44mqZqQ/Aq oAAjJYOexMhJ5o2S4jJjufJMHcMfI9glNvZAtMBtt+p/7klzNoxR/8b2SxcUDg4E0r/a qSY2mmsGl8yPRh8/bEvUpfY4lA2HvtpEibeAs1DGVk45mh745oOVxI7KHJscsCsfmOMF 9LYwFAayBun25hO1CRRSud2WSEtBCqBPzCerDJTCGs8gnVdcC/74Yq1+1gLSXeFIUycz f9pw== X-Gm-Message-State: ALKqPwcrnCkwx/lVAEH2ibUJrM9Aw0DrDi9iCZKdujtAQSPqTUdQtAHC 9FQSfsDtZGNRseqW3/2xrdDMANZpmYgnWfNY+nAzVU+Pc81yRlwvdBbHDnTkNRTKBp4wd+sCd8N 3mk5S/K/UYA0GRNTZnUF+sQOtxk986Zb5OEPl09uN0YSoHG2RzKzE4Db6olhqi5U= X-Received: by 2002:a63:2b46:: with SMTP id r67-v6mr2536342pgr.89.1527086671084; Wed, 23 May 2018 07:44:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq6G/+VrEZlpVp3Q0Sk/kvrw9WMLgYPH7uEt06mg+nWEN1Vy3m0Jfixgn5GFdC+xvArQfWT X-Received: by 2002:a63:2b46:: with SMTP id r67-v6mr2536307pgr.89.1527086670169; Wed, 23 May 2018 07:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527086670; cv=none; d=google.com; s=arc-20160816; b=gi7xw9/fw7ami9KMlqgn63Nx6PxFpF/mGjt6zLjI2ZSvOfnQ70B63nbuXkPrP1+uzv jDaBW/HoMUpq2UeOM7O5G7EpxF9938bDP1TJwmywqNXK29o6BFCv4QCwuNLKLxe/KJni baUyVGMDC2f6MSsw1kkGgCLbgfZfGHCp8ALPzOdVl7rR0LgPRr29QVdQvzTZPyMmMjwf gTH1R1OfE+6kHPoi3vIDbKa/nKOG61+bCoPRQhul16D3FbW092iqQlg0d8Wnj9wmDX+6 3GRmbAwxNDHVdq8QSG17aGLx5IIprr5oKZ92sQTwbUDwubuAXU6RiBKGquULTiHVy3YD O88Q== 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=JZ0K/FtBZCBQt+q9RE5ouAqk4RqELbY2cIBnCxzOsjQ=; b=0A0egm+2PNdbDCPDk0zVXqWc8WMNH97PRo0S0WrR6D+8ajOwhGOVvZoZVBTt8zkpGS I3iyUhwZaw5bLRLyYLjd7996/drNjG6a48RAUJHSdY4uhREyAMkL/y1ax43Vont2FQYf r2KYYlhzAK3Foapd2hFe+oFNJE8UzfiX9nLVJcLLDuV0s2mFx/BajiQIDGpuPwQpCqTq 4QelaHLI1XglWwkO9OtXCpLfE2Vz6d06KakcyXsYExu3rrPQd/GIfHSXCs1VGq9g5kzd 1vNAQmeaY9+M+UQG6W7QdK5mZWuOXaIPNg6dCwmAuTZtFKhLbFjTSnQ7hqNd0YQhU1PK bMsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=UFlsBhA0; spf=pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+df5a2477ff0fa86e9985+5386+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 k33-v6si18813136pld.100.2018.05.23.07.44.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 07:44:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+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=UFlsBhA0; spf=pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+df5a2477ff0fa86e9985+5386+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=JZ0K/FtBZCBQt+q9RE5ouAqk4RqELbY2cIBnCxzOsjQ=; b=UFlsBhA0L/32Eu88fXYm4Tvp2 QSRGSn6yhSh9ou8qnZvHAXqkUWJs8C10mvQE3Rgbpe30n9UQxeYw1JFc2ChfsdkwSR08iIJw1WbhP FcJzUyOYuM+zX56E+hyE+m9z38HzL9+k1wJ8DZ73Y2K10Cj/egElE4hggyMXdCmjOJbE7d01fsrVD YC41rlNjkG0wmOByWC+CS4MvQfevO+BsbJl98Umk1X4Hzilb7tBEzhN0H4LVohJGSowaBbJf59Fa+ dof1BKgzHxJ3mHDtLhuq34ufnLU8OTGm5xjNhbOoWnZAnoGZeDAC7huqKHpH+GWTV1nHGlG3WZgXT M8ODfksbg==; Received: from 089144199016.atnat0008.highway.a1.net ([89.144.199.16] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLV08-0000Ki-KB; Wed, 23 May 2018 14:44:29 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 09/34] iomap: inline data should be an iomap type, not a flag Date: Wed, 23 May 2018 16:43:32 +0200 Message-Id: <20180523144357.18985-10-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180523144357.18985-1-hch@lst.de> References: <20180523144357.18985-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 --- 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 0900da23172c..f52209a2c270 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, @@ -1318,14 +1319,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: