[2/5] btrfs: send: use kvmalloc in iterate_dir_item
diff mbox

Message ID b4c7abc3e53eda95ca717d793863639711625d63.1496252765.git.dsterba@suse.com
State New
Headers show

Commit Message

David Sterba May 31, 2017, 5:49 p.m. UTC
We use a growing buffer for xattrs larger than a page size, at some
point vmalloc is unconditionally used for larger buffers. We can still
try to avoid it using the kvmalloc helper.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anand Jain June 1, 2017, 9:23 a.m. UTC | #1
On 06/01/17 01:49, David Sterba wrote:
> We use a growing buffer for xattrs larger than a page size, at some
> point vmalloc is unconditionally used for larger buffers. We can still
> try to avoid it using the kvmalloc helper.

  Reviewed-by: Anand Jain <anand.jain@oracle.com>

> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/send.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index 924b1d941b53..7416b17c0eac 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -1083,7 +1083,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
>  				buf = tmp;
>  			}
>  			if (!buf) {
> -				buf = vmalloc(buf_len);
> +				buf = kvmalloc(buf_len, GFP_KERNEL);
>  				if (!buf) {
>  					ret = -ENOMEM;
>  					goto out;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 924b1d941b53..7416b17c0eac 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1083,7 +1083,7 @@  static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
 				buf = tmp;
 			}
 			if (!buf) {
-				buf = vmalloc(buf_len);
+				buf = kvmalloc(buf_len, GFP_KERNEL);
 				if (!buf) {
 					ret = -ENOMEM;
 					goto out;