{"id":813756,"url":"http://patchwork.ozlabs.org/api/patches/813756/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20170914095047.23935-4-agruenba@redhat.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170914095047.23935-4-agruenba@redhat.com>","list_archive_url":null,"date":"2017-09-14T09:50:46","name":"[v2,3/4] ext4: Add iomap support for inline data","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b1204f297deda372c25bcfaf30bd4eee71eba355","submitter":{"id":67290,"url":"http://patchwork.ozlabs.org/api/people/67290/?format=json","name":"Andreas Gruenbacher","email":"agruenba@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20170914095047.23935-4-agruenba@redhat.com/mbox/","series":[{"id":3057,"url":"http://patchwork.ozlabs.org/api/series/3057/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=3057","date":"2017-09-14T09:50:43","name":"ext4: SEEK_HOLE / SEEK_DATA via iomap","version":2,"mbox":"http://patchwork.ozlabs.org/series/3057/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813756/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813756/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-ext4-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ext4-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=agruenba@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xtDLX6L8fz9t1G\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 14 Sep 2017 19:51:00 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751832AbdINJu7 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 14 Sep 2017 05:50:59 -0400","from mx1.redhat.com ([209.132.183.28]:26497 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751793AbdINJu5 (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tThu, 14 Sep 2017 05:50:57 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id EA508C04B946;\n\tThu, 14 Sep 2017 09:50:56 +0000 (UTC)","from max.home.com (ovpn-116-23.ams2.redhat.com [10.36.116.23])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 6EC5317A84;\n\tThu, 14 Sep 2017 09:50:55 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com EA508C04B946","From":"Andreas Gruenbacher <agruenba@redhat.com>","To":"linux-fsdevel@vger.kernel.org","Cc":"linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,\n\tJan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>,\n\tAndreas Gruenbacher <agruenba@redhat.com>","Subject":"[PATCH v2 3/4] ext4: Add iomap support for inline data","Date":"Thu, 14 Sep 2017 11:50:46 +0200","Message-Id":"<20170914095047.23935-4-agruenba@redhat.com>","In-Reply-To":"<20170914095047.23935-1-agruenba@redhat.com>","References":"<20170914095047.23935-1-agruenba@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tThu, 14 Sep 2017 09:50:57 +0000 (UTC)","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"},"content":"Report inline data as a IOMAP_F_DATA_INLINE mapping.  This allows to use\niomap_seek_hole and iomap_seek_data in ext4_llseek and makes switching\nto iomap_fiemap in ext4_fiemap easier.\n\nSigned-off-by: Andreas Gruenbacher <agruenba@redhat.com>\nReviewed-by: Jan Kara <jack@suse.cz>\n---\n fs/ext4/ext4.h   |  4 ++++\n fs/ext4/inline.c | 33 +++++++++++++++++++++++++++++++++\n fs/ext4/inode.c  | 16 ++++++++++++++--\n 3 files changed, 51 insertions(+), 2 deletions(-)","diff":"diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex e2abe01c8c6b..ae3e4a25821a 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -3048,6 +3048,10 @@ extern struct buffer_head *ext4_get_first_inline_block(struct inode *inode,\n extern int ext4_inline_data_fiemap(struct inode *inode,\n \t\t\t\t   struct fiemap_extent_info *fieinfo,\n \t\t\t\t   int *has_inline, __u64 start, __u64 len);\n+\n+struct iomap;\n+extern int ext4_inline_data_iomap(struct inode *inode, struct iomap *iomap);\n+\n extern int ext4_try_to_evict_inline_data(handle_t *handle,\n \t\t\t\t\t struct inode *inode,\n \t\t\t\t\t int needed);\ndiff --git a/fs/ext4/inline.c b/fs/ext4/inline.c\nindex 28c5c3abddb3..f0bbc8cb6555 100644\n--- a/fs/ext4/inline.c\n+++ b/fs/ext4/inline.c\n@@ -12,6 +12,7 @@\n  * GNU General Public License for more details.\n  */\n \n+#include <linux/iomap.h>\n #include <linux/fiemap.h>\n \n #include \"ext4_jbd2.h\"\n@@ -1827,6 +1828,38 @@ int ext4_destroy_inline_data(handle_t *handle, struct inode *inode)\n \treturn ret;\n }\n \n+int ext4_inline_data_iomap(struct inode *inode, struct iomap *iomap)\n+{\n+\t__u64 addr;\n+\tint error = -EAGAIN;\n+\tstruct ext4_iloc iloc;\n+\n+\tdown_read(&EXT4_I(inode)->xattr_sem);\n+\tif (!ext4_has_inline_data(inode))\n+\t\tgoto out;\n+\n+\terror = ext4_get_inode_loc(inode, &iloc);\n+\tif (error)\n+\t\tgoto out;\n+\n+\taddr = (__u64)iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits;\n+\taddr += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;\n+\taddr += offsetof(struct ext4_inode, i_block);\n+\n+\tbrelse(iloc.bh);\n+\n+\tiomap->addr = addr;\n+\tiomap->offset = 0;\n+\tiomap->length = min_t(loff_t, ext4_get_inline_size(inode),\n+\t\t\t      i_size_read(inode));\n+\tiomap->type = 0;\n+\tiomap->flags = IOMAP_F_DATA_INLINE;\n+\n+out:\n+\tup_read(&EXT4_I(inode)->xattr_sem);\n+\treturn error;\n+}\n+\n int ext4_inline_data_fiemap(struct inode *inode,\n \t\t\t    struct fiemap_extent_info *fieinfo,\n \t\t\t    int *has_inline, __u64 start, __u64 len)\ndiff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\nindex d9e633c12aae..7755f41bdfc3 100644\n--- a/fs/ext4/inode.c\n+++ b/fs/ext4/inode.c\n@@ -3404,8 +3404,20 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n \tstruct ext4_map_blocks map;\n \tint ret;\n \n-\tif (WARN_ON_ONCE(ext4_has_inline_data(inode)))\n-\t\treturn -ERANGE;\n+\n+\tif (flags & IOMAP_REPORT) {\n+\t\tif (ext4_has_inline_data(inode)) {\n+\t\t\tret = ext4_inline_data_iomap(inode, iomap);\n+\t\t\tif (ret != -EAGAIN) {\n+\t\t\t\tif (ret == 0 && offset >= iomap->length)\n+\t\t\t\t\tret = -ENOENT;\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t}\n+\t} else {\n+\t\tif (WARN_ON_ONCE(ext4_has_inline_data(inode)))\n+\t\t\treturn -ERANGE;\n+\t}\n \n \tmap.m_lblk = first_block;\n \tmap.m_len = last_block - first_block + 1;\n","prefixes":["v2","3/4"]}