Commit 9c9ca00b authored by David Sterba's avatar David Sterba Committed by Josef Bacik

btrfs: send: simplify allocation code in fs_path_ensure_buf

Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
parent 1b2782c8
...@@ -352,24 +352,18 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) ...@@ -352,24 +352,18 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
/* /*
* First time the inline_buf does not suffice * First time the inline_buf does not suffice
*/ */
if (p->buf == p->inline_buf) { if (p->buf == p->inline_buf)
p->buf = kmalloc(len, GFP_NOFS); tmp_buf = kmalloc(len, GFP_NOFS);
if (!p->buf) else
return -ENOMEM; tmp_buf = krealloc(p->buf, len, GFP_NOFS);
/* if (!tmp_buf)
* The real size of the buffer is bigger, this will let the return -ENOMEM;
* fast path happen most of the time p->buf = tmp_buf;
*/ /*
p->buf_len = ksize(p->buf); * The real size of the buffer is bigger, this will let the fast path
} else { * happen most of the time
char *tmp; */
p->buf_len = ksize(p->buf);
tmp = krealloc(p->buf, len, GFP_NOFS);
if (!tmp)
return -ENOMEM;
p->buf = tmp;
p->buf_len = ksize(p->buf);
}
if (p->reversed) { if (p->reversed) {
tmp_buf = p->buf + old_buf_len - path_len - 1; tmp_buf = p->buf + old_buf_len - path_len - 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment