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

btrfs: send: remove virtual_mem member from fs_path

We don't need to keep track of that, it's available via is_vmalloc_addr.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
parent b23ab57d
...@@ -55,7 +55,6 @@ struct fs_path { ...@@ -55,7 +55,6 @@ struct fs_path {
char *buf; char *buf;
int buf_len; int buf_len;
unsigned int reversed:1; unsigned int reversed:1;
unsigned int virtual_mem:1;
char inline_buf[]; char inline_buf[];
}; };
char pad[PAGE_SIZE]; char pad[PAGE_SIZE];
...@@ -241,7 +240,6 @@ static struct fs_path *fs_path_alloc(void) ...@@ -241,7 +240,6 @@ static struct fs_path *fs_path_alloc(void)
if (!p) if (!p)
return NULL; return NULL;
p->reversed = 0; p->reversed = 0;
p->virtual_mem = 0;
p->buf = p->inline_buf; p->buf = p->inline_buf;
p->buf_len = FS_PATH_INLINE_SIZE; p->buf_len = FS_PATH_INLINE_SIZE;
fs_path_reset(p); fs_path_reset(p);
...@@ -265,7 +263,7 @@ static void fs_path_free(struct fs_path *p) ...@@ -265,7 +263,7 @@ static void fs_path_free(struct fs_path *p)
if (!p) if (!p)
return; return;
if (p->buf != p->inline_buf) { if (p->buf != p->inline_buf) {
if (p->virtual_mem) if (is_vmalloc_addr(p->buf))
vfree(p->buf); vfree(p->buf);
else else
kfree(p->buf); kfree(p->buf);
...@@ -299,13 +297,12 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) ...@@ -299,13 +297,12 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
tmp_buf = vmalloc(len); tmp_buf = vmalloc(len);
if (!tmp_buf) if (!tmp_buf)
return -ENOMEM; return -ENOMEM;
p->virtual_mem = 1;
} }
memcpy(tmp_buf, p->buf, p->buf_len); memcpy(tmp_buf, p->buf, p->buf_len);
p->buf = tmp_buf; p->buf = tmp_buf;
p->buf_len = len; p->buf_len = len;
} else { } else {
if (p->virtual_mem) { if (is_vmalloc_addr(p->buf)) {
tmp_buf = vmalloc(len); tmp_buf = vmalloc(len);
if (!tmp_buf) if (!tmp_buf)
return -ENOMEM; return -ENOMEM;
...@@ -319,7 +316,6 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) ...@@ -319,7 +316,6 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
return -ENOMEM; return -ENOMEM;
memcpy(tmp_buf, p->buf, p->buf_len); memcpy(tmp_buf, p->buf, p->buf_len);
kfree(p->buf); kfree(p->buf);
p->virtual_mem = 1;
} }
} }
p->buf = tmp_buf; p->buf = tmp_buf;
......
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