Re: [PATCH 5/7] nilfs2: add bmap function to seek a valid key

From: Ryusuke Konishi
Date: Wed Mar 25 2015 - 11:19:41 EST


Hi Andrew,

On Thu, 12 Mar 2015 23:38:12 +0900, Ryusuke Konishi wrote:
> Add a new bmap function, nilfs_bmap_seek_key(), which seeks a valid
> entry and returns its key starting from a given key. This function
> can be used to skip hole blocks efficiently.
>
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx>
> ---
<snip>
> +static int nilfs_btree_seek_key(const struct nilfs_bmap *btree, __u64 start,
> + __u64 *keyp)
> +{
> + struct nilfs_btree_path *path;
> + const int minlevel = NILFS_BTREE_LEVEL_NODE_MIN;
> + int ret;
> +

> + if (start > NILFS_BTREE_KEY_MAX)
> + return -ENOENT;

Could you apply the following amendment ?

I've got a report from Dan Carpenter that this range check causes a
warning:

fs/nilfs2/btree.c:1611 nilfs_btree_seek_key() warn: impossible condition '(start > (~0)) => (0-u64max > u64max)'

A range check was needed there in a wip patch, but we no longer need
it.

Thanks,
Ryusuke Konishi
--
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 841d177..059f371 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -1608,9 +1608,6 @@ static int nilfs_btree_seek_key(const struct nilfs_bmap *btree, __u64 start,
const int minlevel = NILFS_BTREE_LEVEL_NODE_MIN;
int ret;

- if (start > NILFS_BTREE_KEY_MAX)
- return -ENOENT;
-
path = nilfs_btree_alloc_path();
if (!path)
return -ENOMEM;
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/