btrfs: send: simplify allocation code in fs_path_ensure_buf
authorDavid Sterba <dsterba@suse.cz>
Tue, 25 Feb 2014 18:33:08 +0000 (19:33 +0100)
committerJosef Bacik <jbacik@fb.com>
Mon, 10 Mar 2014 19:16:59 +0000 (15:16 -0400)
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fb.com>
fs/btrfs/send.c

index 246df85..ba23fef 100644 (file)
@@ -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;