Commit b23ab57d authored by David Sterba's avatar David Sterba Committed by Josef Bacik

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: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
parent 64792f25
...@@ -51,7 +51,6 @@ struct fs_path { ...@@ -51,7 +51,6 @@ struct fs_path {
struct { struct {
char *start; char *start;
char *end; char *end;
char *prepared;
char *buf; char *buf;
int buf_len; int buf_len;
...@@ -338,7 +337,8 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) ...@@ -338,7 +337,8 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
return 0; return 0;
} }
static int fs_path_prepare_for_add(struct fs_path *p, int name_len) static int fs_path_prepare_for_add(struct fs_path *p, int name_len,
char **prepared)
{ {
int ret; int ret;
int new_len; int new_len;
...@@ -354,11 +354,11 @@ static int fs_path_prepare_for_add(struct fs_path *p, int name_len) ...@@ -354,11 +354,11 @@ static int fs_path_prepare_for_add(struct fs_path *p, int name_len)
if (p->start != p->end) if (p->start != p->end)
*--p->start = '/'; *--p->start = '/';
p->start -= name_len; p->start -= name_len;
p->prepared = p->start; *prepared = p->start;
} else { } else {
if (p->start != p->end) if (p->start != p->end)
*p->end++ = '/'; *p->end++ = '/';
p->prepared = p->end; *prepared = p->end;
p->end += name_len; p->end += name_len;
*p->end = 0; *p->end = 0;
} }
...@@ -370,12 +370,12 @@ static int fs_path_prepare_for_add(struct fs_path *p, int name_len) ...@@ -370,12 +370,12 @@ static int fs_path_prepare_for_add(struct fs_path *p, int name_len)
static int fs_path_add(struct fs_path *p, const char *name, int name_len) static int fs_path_add(struct fs_path *p, const char *name, int name_len)
{ {
int ret; int ret;
char *prepared;
ret = fs_path_prepare_for_add(p, name_len); ret = fs_path_prepare_for_add(p, name_len, &prepared);
if (ret < 0) if (ret < 0)
goto out; goto out;
memcpy(p->prepared, name, name_len); memcpy(prepared, name, name_len);
p->prepared = NULL;
out: out:
return ret; return ret;
...@@ -384,12 +384,12 @@ static int fs_path_add(struct fs_path *p, const char *name, int name_len) ...@@ -384,12 +384,12 @@ static int fs_path_add(struct fs_path *p, const char *name, int name_len)
static int fs_path_add_path(struct fs_path *p, struct fs_path *p2) static int fs_path_add_path(struct fs_path *p, struct fs_path *p2)
{ {
int ret; int ret;
char *prepared;
ret = fs_path_prepare_for_add(p, p2->end - p2->start); ret = fs_path_prepare_for_add(p, p2->end - p2->start, &prepared);
if (ret < 0) if (ret < 0)
goto out; goto out;
memcpy(p->prepared, p2->start, p2->end - p2->start); memcpy(prepared, p2->start, p2->end - p2->start);
p->prepared = NULL;
out: out:
return ret; return ret;
...@@ -400,13 +400,13 @@ static int fs_path_add_from_extent_buffer(struct fs_path *p, ...@@ -400,13 +400,13 @@ static int fs_path_add_from_extent_buffer(struct fs_path *p,
unsigned long off, int len) unsigned long off, int len)
{ {
int ret; int ret;
char *prepared;
ret = fs_path_prepare_for_add(p, len); ret = fs_path_prepare_for_add(p, len, &prepared);
if (ret < 0) if (ret < 0)
goto out; goto out;
read_extent_buffer(eb, p->prepared, off, len); read_extent_buffer(eb, prepared, off, len);
p->prepared = NULL;
out: out:
return ret; return ret;
......
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