Have _lookup_exact return 0

scoutfs_item_lookup_exact() exists to only return one size.  Have it
just return 0 on success so callers don't have to remember that it
returns > 0.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-04-18 13:42:30 -07:00
parent 3f27de0b2c
commit 6957c73aba
+5 -1
View File
@@ -126,6 +126,8 @@ int scoutfs_item_lookup(struct super_block *sb, struct kvec *key,
* match. This isn't the fast path so we don't mind the copying
* overhead that comes from only detecting the size mismatch after the
* copy by reusing the more permissive _lookup().
*
* Returns 0 or -errno.
*/
int scoutfs_item_lookup_exact(struct super_block *sb, struct kvec *key,
struct kvec *val, int size)
@@ -133,7 +135,9 @@ int scoutfs_item_lookup_exact(struct super_block *sb, struct kvec *key,
int ret;
ret = scoutfs_item_lookup(sb, key, val);
if (ret >= 0 && ret != size)
if (ret == size)
ret = 0;
else if (ret >= 0 && ret != size)
ret = -EIO;
return ret;