diff options
author | Hugo Mills <hugo@carfax.org.uk> | 2011-05-14 13:43:41 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-05-23 13:05:39 -0400 |
commit | e2156867159ae7b3bc38ef1c26ea0ee30a895ef8 (patch) | |
tree | d949884cdaf5ebeb8d9ba14ec0284c9ece437164 /fs/btrfs | |
parent | 0956c798ef8dbe0fc215870eb68bd2d8e789f86a (diff) |
btrfs: Ensure the tree search ioctl returns the right number of records
Btrfs's tree search ioctl has a field to indicate that no more than a
given number of records should be returned. The ioctl doesn't honour
this, as the tested value is not incremented until the end of the
copy_to_sk function. This patch removes an unnecessary local variable,
and updates the num_found counter as each key is found in the tree.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ioctl.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2616f7ed4799..ce773fb736a1 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1279,7 +1279,6 @@ static noinline int copy_to_sk(struct btrfs_root *root, | |||
1279 | int nritems; | 1279 | int nritems; |
1280 | int i; | 1280 | int i; |
1281 | int slot; | 1281 | int slot; |
1282 | int found = 0; | ||
1283 | int ret = 0; | 1282 | int ret = 0; |
1284 | 1283 | ||
1285 | leaf = path->nodes[0]; | 1284 | leaf = path->nodes[0]; |
@@ -1326,7 +1325,7 @@ static noinline int copy_to_sk(struct btrfs_root *root, | |||
1326 | item_off, item_len); | 1325 | item_off, item_len); |
1327 | *sk_offset += item_len; | 1326 | *sk_offset += item_len; |
1328 | } | 1327 | } |
1329 | found++; | 1328 | (*num_found)++; |
1330 | 1329 | ||
1331 | if (*num_found >= sk->nr_items) | 1330 | if (*num_found >= sk->nr_items) |
1332 | break; | 1331 | break; |
@@ -1345,7 +1344,6 @@ advance_key: | |||
1345 | } else | 1344 | } else |
1346 | ret = 1; | 1345 | ret = 1; |
1347 | overflow: | 1346 | overflow: |
1348 | *num_found += found; | ||
1349 | return ret; | 1347 | return ret; |
1350 | } | 1348 | } |
1351 | 1349 | ||