[{"id":1759501,"web_url":"http://patchwork.ozlabs.org/comment/1759501/","msgid":"<20170829161115.GS4757@magnolia>","list_archive_url":null,"date":"2017-08-29T16:11:15","subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","submitter":{"id":18086,"url":"http://patchwork.ozlabs.org/api/people/18086/","name":"Darrick Wong","email":"darrick.wong@oracle.com"},"content":"On Tue, Aug 29, 2017 at 04:29:39PM +0200, Andreas Gruenbacher wrote:\n> Replace iomap->blkno, the sector number, with iomap->addr, the disk\n> offset in bytes.  For invalid disk offsets, use the special value\n> IOMAP_NULL_ADDR instead of IOMAP_NULL_BLOCK.  This allows to use iomap\n> for mappings which are not block aligned, such as inline data on ext4\n> and stuffed inodes on gfs2.\n> \n> Tested on xfs and ext4 with xfstests; seems to be working correctly.\n> \n> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>\n> ---\n>  fs/buffer.c           |  4 ++--\n>  fs/dax.c              |  2 +-\n>  fs/ext2/inode.c       |  4 ++--\n>  fs/ext4/inode.c       |  4 ++--\n>  fs/iomap.c            | 11 +++++------\n>  fs/nfsd/blocklayout.c |  4 ++--\n>  fs/xfs/xfs_iomap.c    |  6 +++---\n>  include/linux/iomap.h | 10 +++++-----\n>  8 files changed, 22 insertions(+), 23 deletions(-)\n> \n> diff --git a/fs/buffer.c b/fs/buffer.c\n> index 5715dac7821f..b9d20076bb8f 100644\n> --- a/fs/buffer.c\n> +++ b/fs/buffer.c\n> @@ -1979,8 +1979,8 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,\n>  \tcase IOMAP_MAPPED:\n>  \t\tif (offset >= i_size_read(inode))\n>  \t\t\tset_buffer_new(bh);\n> -\t\tbh->b_blocknr = (iomap->blkno >> (inode->i_blkbits - 9)) +\n> -\t\t\t\t((offset - iomap->offset) >> inode->i_blkbits);\n> +\t\tbh->b_blocknr = (iomap->addr + offset - iomap->offset) >>\n> +\t\t\t\tinode->i_blkbits;\n>  \t\tset_buffer_mapped(bh);\n>  \t\tbreak;\n>  \t}\n> diff --git a/fs/dax.c b/fs/dax.c\n> index 865d42c63e23..539aaa0b9c45 100644\n> --- a/fs/dax.c\n> +++ b/fs/dax.c\n> @@ -987,7 +987,7 @@ EXPORT_SYMBOL_GPL(__dax_zero_page_range);\n>  \n>  static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos)\n>  {\n> -\treturn iomap->blkno + (((pos & PAGE_MASK) - iomap->offset) >> 9);\n> +\treturn (iomap->addr + (pos & PAGE_MASK) - iomap->offset) >> 9;\n>  }\n>  \n>  static loff_t\n> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c\n> index 30163d007b2f..e7d8925d0140 100644\n> --- a/fs/ext2/inode.c\n> +++ b/fs/ext2/inode.c\n> @@ -824,11 +824,11 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n>  \n>  \tif (ret == 0) {\n>  \t\tiomap->type = IOMAP_HOLE;\n> -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> +\t\tiomap->addr = IOMAP_NULL_ADDR;\n>  \t\tiomap->length = 1 << blkbits;\n>  \t} else {\n>  \t\tiomap->type = IOMAP_MAPPED;\n> -\t\tiomap->blkno = (sector_t)bno << (blkbits - 9);\n> +\t\tiomap->addr = (u64)bno << blkbits;\n>  \t\tiomap->length = (u64)ret << blkbits;\n>  \t\tiomap->flags |= IOMAP_F_MERGED;\n>  \t}\n> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\n> index c774bdc22759..429f0afde9f2 100644\n> --- a/fs/ext4/inode.c\n> +++ b/fs/ext4/inode.c\n> @@ -3483,7 +3483,7 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n>  \n>  \tif (ret == 0) {\n>  \t\tiomap->type = IOMAP_HOLE;\n> -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> +\t\tiomap->addr = IOMAP_NULL_ADDR;\n>  \t\tiomap->length = (u64)map.m_len << blkbits;\n>  \t} else {\n>  \t\tif (map.m_flags & EXT4_MAP_MAPPED) {\n> @@ -3494,7 +3494,7 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n>  \t\t\tWARN_ON_ONCE(1);\n>  \t\t\treturn -EIO;\n>  \t\t}\n> -\t\tiomap->blkno = (sector_t)map.m_pblk << (blkbits - 9);\n> +\t\tiomap->addr = (u64)map.m_pblk << blkbits;\n>  \t\tiomap->length = (u64)map.m_len << blkbits;\n>  \t}\n>  \n> diff --git a/fs/iomap.c b/fs/iomap.c\n> index 59cc98ad7577..7bc1797c2292 100644\n> --- a/fs/iomap.c\n> +++ b/fs/iomap.c\n> @@ -350,8 +350,8 @@ static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset,\n>  static int iomap_dax_zero(loff_t pos, unsigned offset, unsigned bytes,\n>  \t\tstruct iomap *iomap)\n>  {\n> -\tsector_t sector = iomap->blkno +\n> -\t\t(((pos & ~(PAGE_SIZE - 1)) - iomap->offset) >> 9);\n> +\tsector_t sector = (iomap->addr +\n> +\t\t\t   (pos & PAGE_MASK) - iomap->offset) >> 9;\n>  \n>  \treturn __dax_zero_page_range(iomap->bdev, iomap->dax_dev, sector,\n>  \t\t\toffset, bytes);\n> @@ -512,9 +512,8 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi,\n>  \t\tflags |= FIEMAP_EXTENT_SHARED;\n>  \n>  \treturn fiemap_fill_next_extent(fi, iomap->offset,\n> -\t\t\tiomap->blkno != IOMAP_NULL_BLOCK ? iomap->blkno << 9: 0,\n> +\t\t\tiomap->addr != IOMAP_NULL_ADDR ? iomap->addr : 0,\n>  \t\t\tiomap->length, flags);\n> -\n>  }\n>  \n>  static loff_t\n> @@ -807,7 +806,7 @@ iomap_dio_zero(struct iomap_dio *dio, struct iomap *iomap, loff_t pos,\n>  \tbio = bio_alloc(GFP_KERNEL, 1);\n>  \tbio->bi_bdev = iomap->bdev;\n>  \tbio->bi_iter.bi_sector =\n> -\t\tiomap->blkno + ((pos - iomap->offset) >> 9);\n> +\t\t(iomap->addr + pos - iomap->offset) >> 9;\n>  \tbio->bi_private = dio;\n>  \tbio->bi_end_io = iomap_dio_bio_end_io;\n>  \n> @@ -886,7 +885,7 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length,\n>  \t\tbio = bio_alloc(GFP_KERNEL, nr_pages);\n>  \t\tbio->bi_bdev = iomap->bdev;\n>  \t\tbio->bi_iter.bi_sector =\n> -\t\t\tiomap->blkno + ((pos - iomap->offset) >> 9);\n> +\t\t\t(iomap->addr + pos - iomap->offset) >> 9;\n>  \t\tbio->bi_write_hint = dio->iocb->ki_hint;\n>  \t\tbio->bi_private = dio;\n>  \t\tbio->bi_end_io = iomap_dio_bio_end_io;\n> diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c\n> index c862c2489df0..2d1d37b27dc7 100644\n> --- a/fs/nfsd/blocklayout.c\n> +++ b/fs/nfsd/blocklayout.c\n> @@ -65,7 +65,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,\n>  \t\t\tbex->es = PNFS_BLOCK_READ_DATA;\n>  \t\telse\n>  \t\t\tbex->es = PNFS_BLOCK_READWRITE_DATA;\n> -\t\tbex->soff = (iomap.blkno << 9);\n> +\t\tbex->soff = iomap.addr;\n>  \t\tbreak;\n>  \tcase IOMAP_UNWRITTEN:\n>  \t\tif (seg->iomode & IOMODE_RW) {\n> @@ -78,7 +78,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,\n>  \t\t\t}\n>  \n>  \t\t\tbex->es = PNFS_BLOCK_INVALID_DATA;\n> -\t\t\tbex->soff = (iomap.blkno << 9);\n> +\t\t\tbex->soff = iomap.addr;\n>  \t\t\tbreak;\n>  \t\t}\n>  \t\t/*FALLTHRU*/\n> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c\n> index 813394c62849..1bcc5d0373a5 100644\n> --- a/fs/xfs/xfs_iomap.c\n> +++ b/fs/xfs/xfs_iomap.c\n> @@ -54,13 +54,13 @@ xfs_bmbt_to_iomap(\n>  \tstruct xfs_mount\t*mp = ip->i_mount;\n>  \n>  \tif (imap->br_startblock == HOLESTARTBLOCK) {\n> -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> +\t\tiomap->addr = IOMAP_NULL_ADDR;\n>  \t\tiomap->type = IOMAP_HOLE;\n>  \t} else if (imap->br_startblock == DELAYSTARTBLOCK) {\n> -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> +\t\tiomap->addr = IOMAP_NULL_ADDR;\n>  \t\tiomap->type = IOMAP_DELALLOC;\n>  \t} else {\n> -\t\tiomap->blkno = xfs_fsb_to_db(ip, imap->br_startblock);\n> +\t\tiomap->addr = (u64)xfs_fsb_to_db(ip, imap->br_startblock) << 9;\n\niomap->addr = BBTOB(xfs_fsb_to_db(...));\n\nSame machine-level transformation, but please help us maintain\nconsistent unit conversion code; the 'BBTOB' name makes the units\nanalysis of a given piece of code more straightforward.\n\nWith that fixed,\nReviewed-by: Darrick J. Wong <darrick.wong@oracle.com>\n\nfor the iomap and XFS parts.\n\n--D\n\n>  \t\tif (imap->br_state == XFS_EXT_UNWRITTEN)\n>  \t\t\tiomap->type = IOMAP_UNWRITTEN;\n>  \t\telse\n> diff --git a/include/linux/iomap.h b/include/linux/iomap.h\n> index f64dc6ce5161..7b8a615fa021 100644\n> --- a/include/linux/iomap.h\n> +++ b/include/linux/iomap.h\n> @@ -15,8 +15,8 @@ struct vm_fault;\n>   */\n>  #define IOMAP_HOLE\t0x01\t/* no blocks allocated, need allocation */\n>  #define IOMAP_DELALLOC\t0x02\t/* delayed allocation blocks */\n> -#define IOMAP_MAPPED\t0x03\t/* blocks allocated @blkno */\n> -#define IOMAP_UNWRITTEN\t0x04\t/* blocks allocated @blkno in unwritten state */\n> +#define IOMAP_MAPPED\t0x03\t/* blocks allocated at @addr */\n> +#define IOMAP_UNWRITTEN\t0x04\t/* blocks allocated at @addr in unwritten state */\n>  \n>  /*\n>   * Flags for all iomap mappings:\n> @@ -30,12 +30,12 @@ struct vm_fault;\n>  #define IOMAP_F_SHARED\t0x20\t/* block shared with another file */\n>  \n>  /*\n> - * Magic value for blkno:\n> + * Magic value for addr:\n>   */\n> -#define IOMAP_NULL_BLOCK -1LL\t/* blkno is not valid */\n> +#define IOMAP_NULL_ADDR -1ULL\t/* addr is not valid */\n>  \n>  struct iomap {\n> -\tsector_t\t\tblkno;\t/* 1st sector of mapping, 512b units */\n> +\tu64\t\t\taddr; /* disk offset of mapping, bytes */\n>  \tloff_t\t\t\toffset;\t/* file offset of mapping, bytes */\n>  \tu64\t\t\tlength;\t/* length of mapping, bytes */\n>  \tu16\t\t\ttype;\t/* type of mapping */\n> -- \n> 2.13.3\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe linux-xfs\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html","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>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xhYXx41slz9sQl\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 02:11:29 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753886AbdH2QL0 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 29 Aug 2017 12:11:26 -0400","from aserp1040.oracle.com ([141.146.126.69]:28183 \"EHLO\n\taserp1040.oracle.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753044AbdH2QLZ (ORCPT\n\t<rfc822; linux-ext4@vger.kernel.org>); Tue, 29 Aug 2017 12:11:25 -0400","from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233])\n\tby aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2)\n\twith ESMTP id v7TGBHKp011699\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Tue, 29 Aug 2017 16:11:17 GMT","from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])\n\tby aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id\n\tv7TGBGFZ031319\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Tue, 29 Aug 2017 16:11:17 GMT","from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17])\n\tby aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id\n\tv7TGBGGj029582; Tue, 29 Aug 2017 16:11:16 GMT","from localhost (/73.25.142.12)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Tue, 29 Aug 2017 09:11:16 -0700"],"Date":"Tue, 29 Aug 2017 09:11:15 -0700","From":"\"Darrick J. Wong\" <darrick.wong@oracle.com>","To":"Andreas Gruenbacher <agruenba@redhat.com>","Cc":"linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,\n\tlinux-xfs@vger.kernel.org, Jan Kara <jack@suse.cz>,\n\tChristoph Hellwig <hch@lst.de>","Subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","Message-ID":"<20170829161115.GS4757@magnolia>","References":"<20170829142942.21594-1-agruenba@redhat.com>\n\t<20170829142942.21594-2-agruenba@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170829142942.21594-2-agruenba@redhat.com>","User-Agent":"Mutt/1.5.24 (2015-08-30)","X-Source-IP":"aserv0021.oracle.com [141.146.126.233]","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"}},{"id":1760253,"web_url":"http://patchwork.ozlabs.org/comment/1760253/","msgid":"<20170830150000.GC5920@quack2.suse.cz>","list_archive_url":null,"date":"2017-08-30T15:00:00","subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","submitter":{"id":363,"url":"http://patchwork.ozlabs.org/api/people/363/","name":"Jan Kara","email":"jack@suse.cz"},"content":"On Tue 29-08-17 16:29:39, Andreas Gruenbacher wrote:\n> Replace iomap->blkno, the sector number, with iomap->addr, the disk\n> offset in bytes.  For invalid disk offsets, use the special value\n> IOMAP_NULL_ADDR instead of IOMAP_NULL_BLOCK.  This allows to use iomap\n> for mappings which are not block aligned, such as inline data on ext4\n> and stuffed inodes on gfs2.\n> \n> Tested on xfs and ext4 with xfstests; seems to be working correctly.\n> \n> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>\n\nThe patch looks good to me. You can add:\n\nReviewed-by: Jan Kara <jack@suse.cz>\n\n\t\t\t\t\t\t\t\tHonza","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>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xj7w60Sx0z9sN7\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 31 Aug 2017 01:00:06 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751504AbdH3PAE (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 30 Aug 2017 11:00:04 -0400","from mx2.suse.de ([195.135.220.15]:37661 \"EHLO mx1.suse.de\"\n\trhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP\n\tid S1751382AbdH3PAD (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tWed, 30 Aug 2017 11:00:03 -0400","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\n\tby mx1.suse.de (Postfix) with ESMTP id 43FD5AE7E;\n\tWed, 30 Aug 2017 15:00:02 +0000 (UTC)","by quack2.suse.cz (Postfix, from userid 1000)\n\tid CAFAA1E3414; Wed, 30 Aug 2017 17:00:00 +0200 (CEST)"],"X-Virus-Scanned":"by amavisd-new at test-mx.suse.de","Date":"Wed, 30 Aug 2017 17:00:00 +0200","From":"Jan Kara <jack@suse.cz>","To":"Andreas Gruenbacher <agruenba@redhat.com>","Cc":"linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,\n\tlinux-xfs@vger.kernel.org, Jan Kara <jack@suse.cz>,\n\tChristoph Hellwig <hch@lst.de>","Subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","Message-ID":"<20170830150000.GC5920@quack2.suse.cz>","References":"<20170829142942.21594-1-agruenba@redhat.com>\n\t<20170829142942.21594-2-agruenba@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170829142942.21594-2-agruenba@redhat.com>","User-Agent":"Mutt/1.5.24 (2015-08-30)","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"}},{"id":1761325,"web_url":"http://patchwork.ozlabs.org/comment/1761325/","msgid":"<20170831213219.GC4750@magnolia>","list_archive_url":null,"date":"2017-08-31T21:32:19","subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","submitter":{"id":18086,"url":"http://patchwork.ozlabs.org/api/people/18086/","name":"Darrick Wong","email":"darrick.wong@oracle.com"},"content":"On Tue, Aug 29, 2017 at 09:11:15AM -0700, Darrick J. Wong wrote:\n> On Tue, Aug 29, 2017 at 04:29:39PM +0200, Andreas Gruenbacher wrote:\n> > Replace iomap->blkno, the sector number, with iomap->addr, the disk\n> > offset in bytes.  For invalid disk offsets, use the special value\n> > IOMAP_NULL_ADDR instead of IOMAP_NULL_BLOCK.  This allows to use iomap\n> > for mappings which are not block aligned, such as inline data on ext4\n> > and stuffed inodes on gfs2.\n> > \n> > Tested on xfs and ext4 with xfstests; seems to be working correctly.\n> > \n> > Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>\n> > ---\n> >  fs/buffer.c           |  4 ++--\n> >  fs/dax.c              |  2 +-\n> >  fs/ext2/inode.c       |  4 ++--\n> >  fs/ext4/inode.c       |  4 ++--\n> >  fs/iomap.c            | 11 +++++------\n> >  fs/nfsd/blocklayout.c |  4 ++--\n> >  fs/xfs/xfs_iomap.c    |  6 +++---\n> >  include/linux/iomap.h | 10 +++++-----\n> >  8 files changed, 22 insertions(+), 23 deletions(-)\n> > \n> > diff --git a/fs/buffer.c b/fs/buffer.c\n> > index 5715dac7821f..b9d20076bb8f 100644\n> > --- a/fs/buffer.c\n> > +++ b/fs/buffer.c\n> > @@ -1979,8 +1979,8 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,\n> >  \tcase IOMAP_MAPPED:\n> >  \t\tif (offset >= i_size_read(inode))\n> >  \t\t\tset_buffer_new(bh);\n> > -\t\tbh->b_blocknr = (iomap->blkno >> (inode->i_blkbits - 9)) +\n> > -\t\t\t\t((offset - iomap->offset) >> inode->i_blkbits);\n> > +\t\tbh->b_blocknr = (iomap->addr + offset - iomap->offset) >>\n> > +\t\t\t\tinode->i_blkbits;\n> >  \t\tset_buffer_mapped(bh);\n> >  \t\tbreak;\n> >  \t}\n> > diff --git a/fs/dax.c b/fs/dax.c\n> > index 865d42c63e23..539aaa0b9c45 100644\n> > --- a/fs/dax.c\n> > +++ b/fs/dax.c\n> > @@ -987,7 +987,7 @@ EXPORT_SYMBOL_GPL(__dax_zero_page_range);\n> >  \n> >  static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos)\n> >  {\n> > -\treturn iomap->blkno + (((pos & PAGE_MASK) - iomap->offset) >> 9);\n> > +\treturn (iomap->addr + (pos & PAGE_MASK) - iomap->offset) >> 9;\n> >  }\n> >  \n> >  static loff_t\n> > diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c\n> > index 30163d007b2f..e7d8925d0140 100644\n> > --- a/fs/ext2/inode.c\n> > +++ b/fs/ext2/inode.c\n> > @@ -824,11 +824,11 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n> >  \n> >  \tif (ret == 0) {\n> >  \t\tiomap->type = IOMAP_HOLE;\n> > -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> > +\t\tiomap->addr = IOMAP_NULL_ADDR;\n> >  \t\tiomap->length = 1 << blkbits;\n> >  \t} else {\n> >  \t\tiomap->type = IOMAP_MAPPED;\n> > -\t\tiomap->blkno = (sector_t)bno << (blkbits - 9);\n> > +\t\tiomap->addr = (u64)bno << blkbits;\n> >  \t\tiomap->length = (u64)ret << blkbits;\n> >  \t\tiomap->flags |= IOMAP_F_MERGED;\n> >  \t}\n> > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\n> > index c774bdc22759..429f0afde9f2 100644\n> > --- a/fs/ext4/inode.c\n> > +++ b/fs/ext4/inode.c\n> > @@ -3483,7 +3483,7 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n> >  \n> >  \tif (ret == 0) {\n> >  \t\tiomap->type = IOMAP_HOLE;\n> > -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> > +\t\tiomap->addr = IOMAP_NULL_ADDR;\n> >  \t\tiomap->length = (u64)map.m_len << blkbits;\n> >  \t} else {\n> >  \t\tif (map.m_flags & EXT4_MAP_MAPPED) {\n> > @@ -3494,7 +3494,7 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n> >  \t\t\tWARN_ON_ONCE(1);\n> >  \t\t\treturn -EIO;\n> >  \t\t}\n> > -\t\tiomap->blkno = (sector_t)map.m_pblk << (blkbits - 9);\n> > +\t\tiomap->addr = (u64)map.m_pblk << blkbits;\n> >  \t\tiomap->length = (u64)map.m_len << blkbits;\n> >  \t}\n> >  \n> > diff --git a/fs/iomap.c b/fs/iomap.c\n> > index 59cc98ad7577..7bc1797c2292 100644\n> > --- a/fs/iomap.c\n> > +++ b/fs/iomap.c\n> > @@ -350,8 +350,8 @@ static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset,\n> >  static int iomap_dax_zero(loff_t pos, unsigned offset, unsigned bytes,\n> >  \t\tstruct iomap *iomap)\n> >  {\n> > -\tsector_t sector = iomap->blkno +\n> > -\t\t(((pos & ~(PAGE_SIZE - 1)) - iomap->offset) >> 9);\n> > +\tsector_t sector = (iomap->addr +\n> > +\t\t\t   (pos & PAGE_MASK) - iomap->offset) >> 9;\n> >  \n> >  \treturn __dax_zero_page_range(iomap->bdev, iomap->dax_dev, sector,\n> >  \t\t\toffset, bytes);\n> > @@ -512,9 +512,8 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi,\n> >  \t\tflags |= FIEMAP_EXTENT_SHARED;\n> >  \n> >  \treturn fiemap_fill_next_extent(fi, iomap->offset,\n> > -\t\t\tiomap->blkno != IOMAP_NULL_BLOCK ? iomap->blkno << 9: 0,\n> > +\t\t\tiomap->addr != IOMAP_NULL_ADDR ? iomap->addr : 0,\n> >  \t\t\tiomap->length, flags);\n> > -\n> >  }\n> >  \n> >  static loff_t\n> > @@ -807,7 +806,7 @@ iomap_dio_zero(struct iomap_dio *dio, struct iomap *iomap, loff_t pos,\n> >  \tbio = bio_alloc(GFP_KERNEL, 1);\n> >  \tbio->bi_bdev = iomap->bdev;\n> >  \tbio->bi_iter.bi_sector =\n> > -\t\tiomap->blkno + ((pos - iomap->offset) >> 9);\n> > +\t\t(iomap->addr + pos - iomap->offset) >> 9;\n> >  \tbio->bi_private = dio;\n> >  \tbio->bi_end_io = iomap_dio_bio_end_io;\n> >  \n> > @@ -886,7 +885,7 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length,\n> >  \t\tbio = bio_alloc(GFP_KERNEL, nr_pages);\n> >  \t\tbio->bi_bdev = iomap->bdev;\n> >  \t\tbio->bi_iter.bi_sector =\n> > -\t\t\tiomap->blkno + ((pos - iomap->offset) >> 9);\n> > +\t\t\t(iomap->addr + pos - iomap->offset) >> 9;\n> >  \t\tbio->bi_write_hint = dio->iocb->ki_hint;\n> >  \t\tbio->bi_private = dio;\n> >  \t\tbio->bi_end_io = iomap_dio_bio_end_io;\n> > diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c\n> > index c862c2489df0..2d1d37b27dc7 100644\n> > --- a/fs/nfsd/blocklayout.c\n> > +++ b/fs/nfsd/blocklayout.c\n> > @@ -65,7 +65,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,\n> >  \t\t\tbex->es = PNFS_BLOCK_READ_DATA;\n> >  \t\telse\n> >  \t\t\tbex->es = PNFS_BLOCK_READWRITE_DATA;\n> > -\t\tbex->soff = (iomap.blkno << 9);\n> > +\t\tbex->soff = iomap.addr;\n> >  \t\tbreak;\n> >  \tcase IOMAP_UNWRITTEN:\n> >  \t\tif (seg->iomode & IOMODE_RW) {\n> > @@ -78,7 +78,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,\n> >  \t\t\t}\n> >  \n> >  \t\t\tbex->es = PNFS_BLOCK_INVALID_DATA;\n> > -\t\t\tbex->soff = (iomap.blkno << 9);\n> > +\t\t\tbex->soff = iomap.addr;\n> >  \t\t\tbreak;\n> >  \t\t}\n> >  \t\t/*FALLTHRU*/\n> > diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c\n> > index 813394c62849..1bcc5d0373a5 100644\n> > --- a/fs/xfs/xfs_iomap.c\n> > +++ b/fs/xfs/xfs_iomap.c\n> > @@ -54,13 +54,13 @@ xfs_bmbt_to_iomap(\n> >  \tstruct xfs_mount\t*mp = ip->i_mount;\n> >  \n> >  \tif (imap->br_startblock == HOLESTARTBLOCK) {\n> > -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> > +\t\tiomap->addr = IOMAP_NULL_ADDR;\n> >  \t\tiomap->type = IOMAP_HOLE;\n> >  \t} else if (imap->br_startblock == DELAYSTARTBLOCK) {\n> > -\t\tiomap->blkno = IOMAP_NULL_BLOCK;\n> > +\t\tiomap->addr = IOMAP_NULL_ADDR;\n> >  \t\tiomap->type = IOMAP_DELALLOC;\n> >  \t} else {\n> > -\t\tiomap->blkno = xfs_fsb_to_db(ip, imap->br_startblock);\n> > +\t\tiomap->addr = (u64)xfs_fsb_to_db(ip, imap->br_startblock) << 9;\n> \n> iomap->addr = BBTOB(xfs_fsb_to_db(...));\n> \n> Same machine-level transformation, but please help us maintain\n> consistent unit conversion code; the 'BBTOB' name makes the units\n> analysis of a given piece of code more straightforward.\n> \n> With that fixed,\n> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>\n> \n> for the iomap and XFS parts.\n\nFWIW I still want the BBTOB thing fixed in whatever patch lands\nupstream, but I tested the first two patches in this series and nothing\nblew up so I guess everything works ok.\n\n--D\n\n> \n> --D\n> \n> >  \t\tif (imap->br_state == XFS_EXT_UNWRITTEN)\n> >  \t\t\tiomap->type = IOMAP_UNWRITTEN;\n> >  \t\telse\n> > diff --git a/include/linux/iomap.h b/include/linux/iomap.h\n> > index f64dc6ce5161..7b8a615fa021 100644\n> > --- a/include/linux/iomap.h\n> > +++ b/include/linux/iomap.h\n> > @@ -15,8 +15,8 @@ struct vm_fault;\n> >   */\n> >  #define IOMAP_HOLE\t0x01\t/* no blocks allocated, need allocation */\n> >  #define IOMAP_DELALLOC\t0x02\t/* delayed allocation blocks */\n> > -#define IOMAP_MAPPED\t0x03\t/* blocks allocated @blkno */\n> > -#define IOMAP_UNWRITTEN\t0x04\t/* blocks allocated @blkno in unwritten state */\n> > +#define IOMAP_MAPPED\t0x03\t/* blocks allocated at @addr */\n> > +#define IOMAP_UNWRITTEN\t0x04\t/* blocks allocated at @addr in unwritten state */\n> >  \n> >  /*\n> >   * Flags for all iomap mappings:\n> > @@ -30,12 +30,12 @@ struct vm_fault;\n> >  #define IOMAP_F_SHARED\t0x20\t/* block shared with another file */\n> >  \n> >  /*\n> > - * Magic value for blkno:\n> > + * Magic value for addr:\n> >   */\n> > -#define IOMAP_NULL_BLOCK -1LL\t/* blkno is not valid */\n> > +#define IOMAP_NULL_ADDR -1ULL\t/* addr is not valid */\n> >  \n> >  struct iomap {\n> > -\tsector_t\t\tblkno;\t/* 1st sector of mapping, 512b units */\n> > +\tu64\t\t\taddr; /* disk offset of mapping, bytes */\n> >  \tloff_t\t\t\toffset;\t/* file offset of mapping, bytes */\n> >  \tu64\t\t\tlength;\t/* length of mapping, bytes */\n> >  \tu16\t\t\ttype;\t/* type of mapping */\n> > -- \n> > 2.13.3\n> > \n> > --\n> > To unsubscribe from this list: send the line \"unsubscribe linux-xfs\" in\n> > the body of a message to majordomo@vger.kernel.org\n> > More majordomo info at  http://vger.kernel.org/majordomo-info.html","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>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjwZZ66dlz9s8J\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 07:32:38 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751781AbdHaVcg (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 17:32:36 -0400","from aserp1040.oracle.com ([141.146.126.69]:27197 \"EHLO\n\taserp1040.oracle.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751009AbdHaVcf (ORCPT\n\t<rfc822; linux-ext4@vger.kernel.org>); Thu, 31 Aug 2017 17:32:35 -0400","from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74])\n\tby aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with\n\tESMTP id v7VLWNEi019966\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Thu, 31 Aug 2017 21:32:24 GMT","from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])\n\tby userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v7VLWNeO016710\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Thu, 31 Aug 2017 21:32:23 GMT","from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19])\n\tby userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id\n\tv7VLWN6c028978; Thu, 31 Aug 2017 21:32:23 GMT","from localhost (/10.145.179.124)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Thu, 31 Aug 2017 14:32:22 -0700"],"Date":"Thu, 31 Aug 2017 14:32:19 -0700","From":"\"Darrick J. Wong\" <darrick.wong@oracle.com>","To":"Andreas Gruenbacher <agruenba@redhat.com>","Cc":"linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,\n\tlinux-xfs@vger.kernel.org, Jan Kara <jack@suse.cz>,\n\tChristoph Hellwig <hch@lst.de>, \"Theodore Ts'o\" <tytso@mit.edu>","Subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","Message-ID":"<20170831213219.GC4750@magnolia>","References":"<20170829142942.21594-1-agruenba@redhat.com>\n\t<20170829142942.21594-2-agruenba@redhat.com>\n\t<20170829161115.GS4757@magnolia>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170829161115.GS4757@magnolia>","User-Agent":"Mutt/1.5.24 (2015-08-30)","X-Source-IP":"userv0022.oracle.com [156.151.31.74]","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"}},{"id":1761330,"web_url":"http://patchwork.ozlabs.org/comment/1761330/","msgid":"<CAHpGcMK6psv1Ua9ku=2+Bx-KcWyhK7f0Pw+F+8kENocv_4eKdA@mail.gmail.com>","list_archive_url":null,"date":"2017-08-31T21:37:43","subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","submitter":{"id":66251,"url":"http://patchwork.ozlabs.org/api/people/66251/","name":"Andreas Grünbacher","email":"andreas.gruenbacher@gmail.com"},"content":"2017-08-31 23:32 GMT+02:00 Darrick J. Wong <darrick.wong@oracle.com>:\n> FWIW I still want the BBTOB thing fixed in whatever patch lands\n> upstream, but I tested the first two patches in this series and nothing\n> blew up so I guess everything works ok.\n\nSure, I'll repost the series once I have the ext4 part working\nproperly. Thanks for the review and testing.\n\nAndreas","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>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"OPoFqonj\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjwhZ3DmSz9s81\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 07:37:50 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751398AbdHaVhr (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 17:37:47 -0400","from mail-wm0-f54.google.com ([74.125.82.54]:36947 \"EHLO\n\tmail-wm0-f54.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750908AbdHaVhp (ORCPT\n\t<rfc822; linux-ext4@vger.kernel.org>); Thu, 31 Aug 2017 17:37:45 -0400","by mail-wm0-f54.google.com with SMTP id u26so5190364wma.0;\n\tThu, 31 Aug 2017 14:37:44 -0700 (PDT)","by 10.223.196.188 with HTTP; Thu, 31 Aug 2017 14:37:43 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=gr5nR8tdwb8ctcgjcYRURF0Fpb9F1m+B6T09GsAVZ2U=;\n\tb=OPoFqonjL3ffaTfmYXzKjrQOzeRPg6LhyOiEpiq3pse08ZcO/+XBfz/J5gRD3Hzrhg\n\tOq+dt/CpKqep35kxFZF6nytDTP91JtM5mR3Kdnw514M19MZYbL2eu9VRFRN+fHaQWApf\n\ttyj6lwgh99ua55M/gerfd6jOvns4ik+gEFr3nT4gTMXkgeECKWAJYi9DI7RsD9CnyL5l\n\tlfmmjoyYLRh97wtcNxw+Q3Nz4h/7+y2zR9lQIUFUFtfJ/ORYbIlkeDQiS33gExrgZy1X\n\tZK8hPK+xYhpcvympbtgTd2abp/4kthEIdreaiedKLx8QDGI53q7PEzOEBpTMaNUInh05\n\tCifw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=gr5nR8tdwb8ctcgjcYRURF0Fpb9F1m+B6T09GsAVZ2U=;\n\tb=Kve99m2jyux+ndxkrdn5HnqQ+n2uMeZbWObTxhqJxJHfHaTx1HbzvTNyog9s54g5l9\n\t0LAFBQvEwWiHny1WB3lDG2U2EBCtCcuR/34kZXKpx2YtYm73ZWHe/hUFN9Kw8OAry5Fu\n\t8oQFxi7jgPH8tp43s1n4Dz3SVNOLxsPkW+AH5VKHimyDKHX0kfiXRqX7cs2nxdQ6FjnL\n\tcx1c3AZIb43ITAbmEsWLwepB2Ot0JVQbZv76u5e6fkBLQjx0o5CcK5KjD4ZimdAC0wsQ\n\tEVAheuKfvTGS8Mcm2CgyWwAMC1KIKcR//M4Gt5oPwXC5zQYKeqGIp4U53kS/IWpKKpc/\n\toV8A==","X-Gm-Message-State":"AHPjjUgSpYDyfpdvl0yjAd6O7b3LPiqT5h3bAcegkP6Pm3n4gRbMe7F5\n\t3QrMGdjhnZ0xGL/cjJ9cWQjsB7NdCg==","X-Google-Smtp-Source":"ADKCNb5GFFfbppjvcz5X6b2ShiJriVSKEXoRuzJA/ZdNf0Rua5e9LEDJpDOoBTVVMCyhD0zdfRDF6SD3VDkjIbkS3jk=","X-Received":"by 10.28.181.15 with SMTP id e15mr1299011wmf.97.1504215464178;\n\tThu, 31 Aug 2017 14:37:44 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170831213219.GC4750@magnolia>","References":"<20170829142942.21594-1-agruenba@redhat.com>\n\t<20170829142942.21594-2-agruenba@redhat.com>\n\t<20170829161115.GS4757@magnolia> <20170831213219.GC4750@magnolia>","From":"=?utf-8?q?Andreas_Gr=C3=BCnbacher?= <andreas.gruenbacher@gmail.com>","Date":"Thu, 31 Aug 2017 23:37:43 +0200","Message-ID":"<CAHpGcMK6psv1Ua9ku=2+Bx-KcWyhK7f0Pw+F+8kENocv_4eKdA@mail.gmail.com>","Subject":"Re: [PATCH 1/4] iomap: Switch from blkno to disk offset","To":"\"Darrick J. Wong\" <darrick.wong@oracle.com>","Cc":"Andreas Gruenbacher <agruenba@redhat.com>,\n\tLinux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,\n\tlinux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,\n\tJan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>,\n\t\"Theodore Ts'o\" <tytso@mit.edu>","Content-Type":"text/plain; charset=\"UTF-8\"","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"}}]