aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-02-03 13:23:19 -0500
committerJosef Bacik <jbacik@fb.com>2014-03-10 15:15:44 -0400
commitb23ab57d485c985c10ee7c03627359bfbba590d8 (patch)
tree7134206e1af81933608af5904783cc8187fe388a /fs/btrfs
parent64792f253508268eb390a86f42f128d877b40776 (diff)
btrfs: send: remove prepared member from fs_path
The member is used only to return value back from fs_path_prepare_for_add, we can do it locally and save 8 bytes for the inline_buf path. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/send.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 08edd0a7fff1..851ebfd43aa7 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -51,7 +51,6 @@ struct fs_path {
51 struct { 51 struct {
52 char *start; 52 char *start;
53 char *end; 53 char *end;
54 char *prepared;
55 54
56 char *buf; 55 char *buf;
57 int buf_len; 56 int buf_len;
@@ -338,7 +337,8 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
338 return 0; 337 return 0;
339} 338}
340 339
341static int fs_path_prepare_for_add(struct fs_path *p, int name_len) 340static int fs_path_prepare_for_add(struct fs_path *p, int name_len,
341 char **prepared)
342{ 342{
343 int ret; 343 int ret;
344 int new_len; 344 int new_len;
@@ -354,11 +354,11 @@ static int fs_path_prepare_for_add(struct fs_path *p, int name_len)
354 if (p->start != p->end) 354 if (p->start != p->end)
355 *--p->start = '/'; 355 *--p->start = '/';
356 p->start -= name_len; 356 p->start -= name_len;
357 p->prepared = p->start; 357 *prepared = p->start;
358 } else { 358 } else {
359 if (p->start != p->end) 359 if (p->start != p->end)
360 *p->end++ = '/'; 360 *p->end++ = '/';
361 p->prepared = p->end; 361 *prepared = p->end;
362 p->end += name_len; 362 p->end += name_len;
363 *p->end = 0; 363 *p->end = 0;
364 } 364 }
@@ -370,12 +370,12 @@ out:
370static int fs_path_add(struct fs_path *p, const char *name, int name_len) 370static int fs_path_add(struct fs_path *p, const char *name, int name_len)
371{ 371{
372 int ret; 372 int ret;
373 char *prepared;
373 374
374 ret = fs_path_prepare_for_add(p, name_len); 375 ret = fs_path_prepare_for_add(p, name_len, &prepared);
375 if (ret < 0) 376 if (ret < 0)
376 goto out; 377 goto out;
377 memcpy(p->prepared, name, name_len); 378 memcpy(prepared, name, name_len);
378 p->prepared = NULL;
379 379
380out: 380out:
381 return ret; 381 return ret;
@@ -384,12 +384,12 @@ out:
384static int fs_path_add_path(struct fs_path *p, struct fs_path *p2) 384static int fs_path_add_path(struct fs_path *p, struct fs_path *p2)
385{ 385{
386 int ret; 386 int ret;
387 char *prepared;
387 388
388 ret = fs_path_prepare_for_add(p, p2->end - p2->start); 389 ret = fs_path_prepare_for_add(p, p2->end - p2->start, &prepared);
389 if (ret < 0) 390 if (ret < 0)
390 goto out; 391 goto out;
391 memcpy(p->prepared, p2->start, p2->end - p2->start); 392 memcpy(prepared, p2->start, p2->end - p2->start);
392 p->prepared = NULL;
393 393
394out: 394out:
395 return ret; 395 return ret;
@@ -400,13 +400,13 @@ static int fs_path_add_from_extent_buffer(struct fs_path *p,
400 unsigned long off, int len) 400 unsigned long off, int len)
401{ 401{
402 int ret; 402 int ret;
403 char *prepared;
403 404
404 ret = fs_path_prepare_for_add(p, len); 405 ret = fs_path_prepare_for_add(p, len, &prepared);
405 if (ret < 0) 406 if (ret < 0)
406 goto out; 407 goto out;
407 408
408 read_extent_buffer(eb, p->prepared, off, len); 409 read_extent_buffer(eb, prepared, off, len);
409 p->prepared = NULL;
410 410
411out: 411out:
412 return ret; 412 return ret;