Skip to content

Commit

Permalink
Btrfs: use larger limit for translation of logical to inode
Browse files Browse the repository at this point in the history
This is the change of the kernel side.

Translation of logical to inode used to have an upper limit 4k on
inode container's size, but the limit is not large enough for a data
with a great many of refs, so when resolving logical address,
we can end up with
"ioctl ret=0, bytes_left=0, bytes_missing=19944, cnt=510, missed=2493"

This changes to regard 64k as the upper limit and use vmalloc instead of
kmalloc to get memory more easily.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
  • Loading branch information
Liu Bo authored and Chris Mason committed Oct 1, 2012
1 parent df031f0 commit 425d17a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions fs/btrfs/backref.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Boston, MA 021110-1307, USA.
*/

#include <linux/vmalloc.h>
#include "ctree.h"
#include "disk-io.h"
#include "backref.h"
Expand Down Expand Up @@ -1584,7 +1585,7 @@ struct btrfs_data_container *init_data_container(u32 total_bytes)
size_t alloc_bytes;

alloc_bytes = max_t(size_t, total_bytes, sizeof(*data));
data = kmalloc(alloc_bytes, GFP_NOFS);
data = vmalloc(alloc_bytes);
if (!data)
return ERR_PTR(-ENOMEM);

Expand Down Expand Up @@ -1635,6 +1636,6 @@ void free_ipath(struct inode_fs_paths *ipath)
{
if (!ipath)
return;
kfree(ipath->fspath);
vfree(ipath->fspath);
kfree(ipath);
}
4 changes: 2 additions & 2 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3230,7 +3230,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
goto out;
}

size = min_t(u32, loi->size, 4096);
size = min_t(u32, loi->size, 64 * 1024);
inodes = init_data_container(size);
if (IS_ERR(inodes)) {
ret = PTR_ERR(inodes);
Expand All @@ -3252,7 +3252,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,

out:
btrfs_free_path(path);
kfree(inodes);
vfree(inodes);
kfree(loi);

return ret;
Expand Down

0 comments on commit 425d17a

Please sign in to comment.