mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-27 02:23:08 +00:00
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:
+5
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user