summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorDavid Sterba2014-02-25 19:33:08 +0100
committerJosef Bacik2014-03-10 20:16:59 +0100
commit9c9ca00bd31989f1a3dcbf54e97c979024e44409 (patch)
tree62681e801a8ba701155ebf7448055085fa9dc1e7 /fs/btrfs/send.c
parentbtrfs: send: fix old buffer length in fs_path_ensure_buf (diff)
downloadkernel-qcow2-linux-9c9ca00bd31989f1a3dcbf54e97c979024e44409.tar.gz
kernel-qcow2-linux-9c9ca00bd31989f1a3dcbf54e97c979024e44409.tar.xz
kernel-qcow2-linux-9c9ca00bd31989f1a3dcbf54e97c979024e44409.zip
btrfs: send: simplify allocation code in fs_path_ensure_buf
Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 246df8513c8a..ba23fef3c5e5 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -352,24 +352,18 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
/*
* First time the inline_buf does not suffice
*/
- if (p->buf == p->inline_buf) {
- p->buf = kmalloc(len, GFP_NOFS);
- if (!p->buf)
- return -ENOMEM;
- /*
- * The real size of the buffer is bigger, this will let the
- * fast path happen most of the time
- */
- p->buf_len = ksize(p->buf);
- } else {
- char *tmp;
-
- tmp = krealloc(p->buf, len, GFP_NOFS);
- if (!tmp)
- return -ENOMEM;
- p->buf = tmp;
- p->buf_len = ksize(p->buf);
- }
+ if (p->buf == p->inline_buf)
+ tmp_buf = kmalloc(len, GFP_NOFS);
+ else
+ tmp_buf = krealloc(p->buf, len, GFP_NOFS);
+ if (!tmp_buf)
+ return -ENOMEM;
+ p->buf = tmp_buf;
+ /*
+ * The real size of the buffer is bigger, this will let the fast path
+ * happen most of the time
+ */
+ p->buf_len = ksize(p->buf);
if (p->reversed) {
tmp_buf = p->buf + old_buf_len - path_len - 1;