* [PATCH 1/3] drivers/dax/super: Add annotation for ops in struct dax_device @ 2018-07-01 6:18 Huaisheng Ye [not found] ` <20180701061848.7036-1-yehs2007-ytc+IHgoah0@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Huaisheng Ye @ 2018-07-01 6:18 UTC (permalink / raw) To: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, chengnt-6jq1YtArVR3QT0dZR+AlfA, jack-IBi9RG/b67k, linux-kernel-u79uwXL29TY76Z2rM5mHXA, willy-wEGCiKHe2LqWVfeAwA7xHQ, linux-ext4-u79uwXL29TY76Z2rM5mHXA From: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> There is no annotation for member ops within struct dax_device. Add it. Signed-off-by: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> --- drivers/dax/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 2b2332b..aa6382a 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -161,6 +161,7 @@ enum dax_device_flags { * @host: optional name for lookups where the device path is not available * @private: dax driver private data * @flags: state and boolean properties + * @ops: function pointers for direct_access and fs-dax */ struct dax_device { struct hlist_node list; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <20180701061848.7036-1-yehs2007-ytc+IHgoah0@public.gmane.org>]
* [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax [not found] ` <20180701061848.7036-1-yehs2007-ytc+IHgoah0@public.gmane.org> @ 2018-07-01 6:18 ` Huaisheng Ye [not found] ` <20180701061848.7036-2-yehs2007-ytc+IHgoah0@public.gmane.org> 2018-07-01 6:18 ` [PATCH 3/3] fs/ext2/inode: Optimize the condition for iomap_begin Huaisheng Ye 1 sibling, 1 reply; 7+ messages in thread From: Huaisheng Ye @ 2018-07-01 6:18 UTC (permalink / raw) To: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, chengnt-6jq1YtArVR3QT0dZR+AlfA, jack-IBi9RG/b67k, linux-kernel-u79uwXL29TY76Z2rM5mHXA, willy-wEGCiKHe2LqWVfeAwA7xHQ, linux-ext4-u79uwXL29TY76Z2rM5mHXA From: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> The type of offset within struct iomap is loff_t, which represents file offset of mapping. In ext2_iomap_begin, iomap->offset shall be given a type cast as loff_t instead of u64. Signed-off-by: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> --- fs/ext2/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 7163590..ca211bd 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -816,7 +816,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length, iomap->flags = 0; iomap->bdev = inode->i_sb->s_bdev; - iomap->offset = (u64)first_block << blkbits; + iomap->offset = (loff_t)first_block << blkbits; iomap->dax_dev = sbi->s_daxdev; if (ret == 0) { -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <20180701061848.7036-2-yehs2007-ytc+IHgoah0@public.gmane.org>]
* Re: [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax [not found] ` <20180701061848.7036-2-yehs2007-ytc+IHgoah0@public.gmane.org> @ 2018-07-01 19:26 ` Al Viro [not found] ` <20180701192600.GT30522-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Al Viro @ 2018-07-01 19:26 UTC (permalink / raw) To: Huaisheng Ye Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, chengnt-6jq1YtArVR3QT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, willy-wEGCiKHe2LqWVfeAwA7xHQ, jack-IBi9RG/b67k, linux-ext4-u79uwXL29TY76Z2rM5mHXA On Sun, Jul 01, 2018 at 02:18:47PM +0800, Huaisheng Ye wrote: > From: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> > > The type of offset within struct iomap is loff_t, which represents > file offset of mapping. > > In ext2_iomap_begin, iomap->offset shall be given a type cast as > loff_t instead of u64. Why is it an error? loff_t is uniformly typedefed to long long. In which case the second variant is different from the first one *and* does not step into nasal demon territory? > - iomap->offset = (u64)first_block << blkbits; > + iomap->offset = (loff_t)first_block << blkbits; ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20180701192600.GT30522-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>]
* Re: [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax [not found] ` <20180701192600.GT30522-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> @ 2018-07-02 6:23 ` Huaisheng Ye [not found] ` <16459a9432e.10c419704327.5268154349116077352-ytc+IHgoah0@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Huaisheng Ye @ 2018-07-02 6:23 UTC (permalink / raw) To: "Al Viro" Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, chengnt-6jq1YtArVR3QT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, willy-wEGCiKHe2LqWVfeAwA7xHQ, jack-IBi9RG/b67k, linux-ext4-u79uwXL29TY76Z2rM5mHXA ---- On Mon, 02 Jul 2018 03:26:00 +0800 Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> wrote ---- > On Sun, Jul 01, 2018 at 02:18:47PM +0800, Huaisheng Ye wrote: > > From: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> > > > > The type of offset within struct iomap is loff_t, which represents > > file offset of mapping. > > > > In ext2_iomap_begin, iomap->offset shall be given a type cast as > > loff_t instead of u64. > > Why is it an error? loff_t is uniformly typedefed to long long. > In which case the second variant is different from the first one > *and* does not step into nasal demon territory? Sorry for my inaccuracy. The type of iomap->offset is loff_t, is it better to cast first_block to loff_t, then do the left shift operation? > > > - iomap->offset = (u64)first_block << blkbits; > > + iomap->offset = (loff_t)first_block << blkbits; > --- Cheers, Huaisheng ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <16459a9432e.10c419704327.5268154349116077352-ytc+IHgoah0@public.gmane.org>]
* Re: [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax [not found] ` <16459a9432e.10c419704327.5268154349116077352-ytc+IHgoah0@public.gmane.org> @ 2018-07-02 7:55 ` Jan Kara 0 siblings, 0 replies; 7+ messages in thread From: Jan Kara @ 2018-07-02 7:55 UTC (permalink / raw) To: Huaisheng Ye Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, chengnt-6jq1YtArVR3QT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, willy-wEGCiKHe2LqWVfeAwA7xHQ, "Al Viro", jack-IBi9RG/b67k, linux-ext4-u79uwXL29TY76Z2rM5mHXA On Mon 02-07-18 14:23:42, Huaisheng Ye wrote: > ---- On Mon, 02 Jul 2018 03:26:00 +0800 Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> wrote ---- > > On Sun, Jul 01, 2018 at 02:18:47PM +0800, Huaisheng Ye wrote: > > > From: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> > > > > > > The type of offset within struct iomap is loff_t, which represents > > > file offset of mapping. > > > > > > In ext2_iomap_begin, iomap->offset shall be given a type cast as > > > loff_t instead of u64. > > > > Why is it an error? loff_t is uniformly typedefed to long long. > > In which case the second variant is different from the first one > > *and* does not step into nasal demon territory? > > Sorry for my inaccuracy. > The type of iomap->offset is loff_t, is it better to cast first_block > to loff_t, then do the left shift operation? I think what Al meant is that in the kernel loff_t is 64-bit anyway and furthermore it is signed which means most people have to look up C standard to remember how right shift is (un)defined if it would overflow ;). So this does not really make the code any more readable. Rather on contrary... Honza > > > > > > - iomap->offset = (u64)first_block << blkbits; > > > + iomap->offset = (loff_t)first_block << blkbits; > > > > --- > Cheers, > Huaisheng > > -- Jan Kara <jack-IBi9RG/b67k@public.gmane.org> SUSE Labs, CR ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] fs/ext2/inode: Optimize the condition for iomap_begin [not found] ` <20180701061848.7036-1-yehs2007-ytc+IHgoah0@public.gmane.org> 2018-07-01 6:18 ` [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax Huaisheng Ye @ 2018-07-01 6:18 ` Huaisheng Ye [not found] ` <20180701061848.7036-3-yehs2007-ytc+IHgoah0@public.gmane.org> 1 sibling, 1 reply; 7+ messages in thread From: Huaisheng Ye @ 2018-07-01 6:18 UTC (permalink / raw) To: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, chengnt-6jq1YtArVR3QT0dZR+AlfA, jack-IBi9RG/b67k, linux-kernel-u79uwXL29TY76Z2rM5mHXA, willy-wEGCiKHe2LqWVfeAwA7xHQ, linux-ext4-u79uwXL29TY76Z2rM5mHXA From: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> If ext2_get_blocks returns negative result, ext2_iomap_begin will return for error case. Adjust the judging condition of ret value will be useful for code simplification. Signed-off-by: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> --- fs/ext2/inode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index ca211bd..9b1004d 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -819,15 +819,15 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length, iomap->offset = (loff_t)first_block << blkbits; iomap->dax_dev = sbi->s_daxdev; - if (ret == 0) { - iomap->type = IOMAP_HOLE; - iomap->addr = IOMAP_NULL_ADDR; - iomap->length = 1 << blkbits; - } else { + if (ret) { iomap->type = IOMAP_MAPPED; iomap->addr = (u64)bno << blkbits; iomap->length = (u64)ret << blkbits; iomap->flags |= IOMAP_F_MERGED; + } else { + iomap->type = IOMAP_HOLE; + iomap->addr = IOMAP_NULL_ADDR; + iomap->length = 1 << blkbits; } if (new) -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <20180701061848.7036-3-yehs2007-ytc+IHgoah0@public.gmane.org>]
* Re: [PATCH 3/3] fs/ext2/inode: Optimize the condition for iomap_begin [not found] ` <20180701061848.7036-3-yehs2007-ytc+IHgoah0@public.gmane.org> @ 2018-07-02 7:57 ` Jan Kara 0 siblings, 0 replies; 7+ messages in thread From: Jan Kara @ 2018-07-02 7:57 UTC (permalink / raw) To: Huaisheng Ye Cc: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, chengnt-6jq1YtArVR3QT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, willy-wEGCiKHe2LqWVfeAwA7xHQ, jack-IBi9RG/b67k, linux-ext4-u79uwXL29TY76Z2rM5mHXA On Sun 01-07-18 14:18:48, Huaisheng Ye wrote: > From: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> > > If ext2_get_blocks returns negative result, ext2_iomap_begin > will return for error case. > Adjust the judging condition of ret value will be useful for > code simplification. > > Signed-off-by: Huaisheng Ye <yehs1-6jq1YtArVR3QT0dZR+AlfA@public.gmane.org> I'm sorry but how exactly is this simpler? Honza > --- > fs/ext2/inode.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c > index ca211bd..9b1004d 100644 > --- a/fs/ext2/inode.c > +++ b/fs/ext2/inode.c > @@ -819,15 +819,15 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length, > iomap->offset = (loff_t)first_block << blkbits; > iomap->dax_dev = sbi->s_daxdev; > > - if (ret == 0) { > - iomap->type = IOMAP_HOLE; > - iomap->addr = IOMAP_NULL_ADDR; > - iomap->length = 1 << blkbits; > - } else { > + if (ret) { > iomap->type = IOMAP_MAPPED; > iomap->addr = (u64)bno << blkbits; > iomap->length = (u64)ret << blkbits; > iomap->flags |= IOMAP_F_MERGED; > + } else { > + iomap->type = IOMAP_HOLE; > + iomap->addr = IOMAP_NULL_ADDR; > + iomap->length = 1 << blkbits; > } > > if (new) > -- > 1.8.3.1 > > > -- Jan Kara <jack-IBi9RG/b67k@public.gmane.org> SUSE Labs, CR ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-02 7:57 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-07-01 6:18 [PATCH 1/3] drivers/dax/super: Add annotation for ops in struct dax_device Huaisheng Ye [not found] ` <20180701061848.7036-1-yehs2007-ytc+IHgoah0@public.gmane.org> 2018-07-01 6:18 ` [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax Huaisheng Ye [not found] ` <20180701061848.7036-2-yehs2007-ytc+IHgoah0@public.gmane.org> 2018-07-01 19:26 ` Al Viro [not found] ` <20180701192600.GT30522-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> 2018-07-02 6:23 ` Huaisheng Ye [not found] ` <16459a9432e.10c419704327.5268154349116077352-ytc+IHgoah0@public.gmane.org> 2018-07-02 7:55 ` Jan Kara 2018-07-01 6:18 ` [PATCH 3/3] fs/ext2/inode: Optimize the condition for iomap_begin Huaisheng Ye [not found] ` <20180701061848.7036-3-yehs2007-ytc+IHgoah0@public.gmane.org> 2018-07-02 7:57 ` Jan Kara
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).