[PATCH v2 6/6] btrfs-progs: fix using on-disk structure to store in memory data

2016-01-03 Thread Byongho Lee
'btrfs_qgroup_info_item' by 'qgroup_info'. In addition in alloc_cnt() 'generation' is set but not used after that so remove the relevant code. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- v2: remove, "Signed-off-by: Zach Brown <z...@redhat.com>" which was for below patc

[PATCH v2 4/6] btrfs-progs: fix endian bugs in chunk rebuilding

2016-01-03 Thread Byongho Lee
This is a same patch as Zach Brown's but we lost so I resend it based on current code. - 'commit 2cd95f945a61 ("fix endian bugs in chunk rebuilding")' Signed-off-by: Zach Brown <z...@redhat.com> Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- chunk-recover.c | 8 ++

[PATCH v2 2/6] btrfs-progs: use NULL instead of 0

2016-01-03 Thread Byongho Lee
Fix the code assigning 0 to pointer instead of NULL. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- cmds-fi-usage.c | 12 ++-- props.c | 2 +- qgroup.c| 6 -- utils.c | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git

[PATCH v2 3/6] btrfs-progs: make private symbols to static

2016-01-03 Thread Byongho Lee
Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- btrfs-show-super.c | 4 ++-- qgroup-verify.c| 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/btrfs-show-super.c b/btrfs-show-super.c index c0ffeacb928c..f11701539d1a 100644 --- a/btrfs-show-super.c +++ b

[PATCH v2 5/6] btrfs-progs: fix endian bug in update_super()

2016-01-03 Thread Byongho Lee
In update_super() 'chunk->stripe.devid' and 'super->dev_item.devid' both are little endian. So we should not use endian helper btrfs_set_stack_stripe_devid(). Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- btrfs-image.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)

[PATCH v2 1/6] btrfs-progs: get sparse checking working

2016-01-03 Thread Byongho Lee
so there could be some my misunderstanding and better solution. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 85b45e5bee3b..3b98709f31a5 100644 --- a/Makefile.in

[PATCH v2 0/6] btrfs-progs: fix endian bugs and clean-ups

2016-01-03 Thread Byongho Lee
data: remove, "Signed-off-by: Zach Brown <z...@redhat.com>" which was for below patch but added by mistake. '[PATCH 4/6] btrfs-progs: fix endian bugs in chunk rebuilding' Byongho Lee (6): btrfs-progs: get sparse checking working btrfs-progs: use NULL instead of

[PATCH 5/6] btrfs-progs: fix endian bug in update_super()

2016-01-03 Thread Byongho Lee
In update_super() 'chunk->stripe.devid' and 'super->dev_item.devid' both are little endian. So we should not use endian helper btrfs_set_stack_stripe_devid(). Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- btrfs-image.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)

[PATCH 4/6] btrfs-progs: fix endian bugs in chunk rebuilding

2016-01-03 Thread Byongho Lee
This is a same patch as Zach Brown's but we lost so I resend it based on current code. - 'commit 2cd95f945a61 ("fix endian bugs in chunk rebuilding")' Signed-off-by: Zach Brown <z...@redhat.com> Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- chunk-recover.c | 8 ++

[PATCH 3/6] btrfs-progs: make private symbols to static

2016-01-03 Thread Byongho Lee
Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- btrfs-show-super.c | 4 ++-- qgroup-verify.c| 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/btrfs-show-super.c b/btrfs-show-super.c index c0ffeacb928c..f11701539d1a 100644 --- a/btrfs-show-super.c +++ b

[PATCH 1/6] btrfs-progs: get sparse checking working

2016-01-03 Thread Byongho Lee
there could be some my misunderstanding and better solution. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 85b45e5bee3b..3b98709f31a5 100644 --- a/Makefile.in +++ b/Makef

[PATCH 6/6] btrfs-progs: fix using on-disk structure to store in memory data

2016-01-03 Thread Byongho Lee
'btrfs_qgroup_info_item' by 'qgroup_info'. In addition in alloc_cnt() 'generation' is set but not used after that so remove the relevant code. Signed-off-by: Zach Brown <z...@redhat.com> Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- qgroup-verify.c | 28 +--- 1 file

[PATCH 0/6] fix endian bugs and clean-ups

2016-01-03 Thread Byongho Lee
This is a patch-set after getting running sparse. There are two endian patches one is new and the other is Zach Brown's work but we lost. And rest are just for clean-ups. Byongho Lee (6): btrfs-progs: get sparse checking working btrfs-progs: use NULL instead of 0 btrfs-progs: make private

[PATCH 2/6] btrfs-progs: use NULL instead of 0

2016-01-03 Thread Byongho Lee
Fix the code assigning 0 to pointer instead of NULL. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- cmds-fi-usage.c | 12 ++-- props.c | 2 +- qgroup.c| 6 -- utils.c | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git

Re: [PATCH 0/6] fix endian bugs and clean-ups

2016-01-03 Thread Byongho Lee
I'ms sorry. While writing cover-letter I missed to add prefix 'btrfs-progs' in subject. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH] Btrfs: use linux/sizes.h to represent constants

2015-12-14 Thread Byongho Lee
' kind of expression with single 'SZ_xxxMB' if 'xxx' is a power of 2 then 'xxx * SZ_1M' if 'xxx' is not a power of 2. And I haven't touched to '4096' & '8192' because it's more intuitive than 'SZ_4KB' & 'SZ_8KB'. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- fs

[PATCH v2] btrfs: compress: put variables defined per compress type in struct to make cache friendly

2015-10-13 Thread Byongho Lee
comp_workspace_wait[BTRFS_COMPRESS_TYPES] BTW, while accessing one compress type of these variables, the next or before address is other compress types of it. So this patch puts these variables in a struct to make cache friendly. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- V2: Apply D

[PATCH] btrfs: compress: put variables defined per compress type in struct to make cache friendly

2015-10-13 Thread Byongho Lee
comp_workspace_wait[BTRFS_COMPRESS_TYPES] BTW, while accessing one compress type of these variables, the next or before address is other compress types of it. So this patch puts these variables in a struct to make cache friendly. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- fs

Re: [PATCH] btrfs: compress: put variables defined per compress type in struct to make cache friendly

2015-10-13 Thread Byongho Lee
David Sterba writes: > >> +static struct { >> +struct list_head idle_workspace; >> +spinlock_t workspace_lock; >> +int num_workspace; >> +atomic_t alloc_workspace; >> +wait_queue_head_t workspace_wait; >> +} comp[BTRFS_COMPRESS_TYPES]; > > The name became too generic, please

[PATCH] btrfs: cleanup iterating over prop_handlers array

2015-10-08 Thread Byongho Lee
This patch eliminates the last item of prop_handlers array which is used to check end of array and instead uses ARRAY_SIZE macro. Though this is a very tiny optimization, using ARRAY_SIZE macro is a good practice to iterate array. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- fs

[PATCH] btrfs: remove unnecessary list_del

2015-09-01 Thread Byongho Lee
We can safely iterate whole list items, without using list_del macro. So remove the list_del call. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- fs/btrfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index bda3c41dc9d5..fe42e3

[PATCH] btrfs: replace unnecessary list_for_each_entry_safe to list_for_each_entry

2015-09-01 Thread Byongho Lee
There is no removing list element while iterating over list. So, replace list_for_each_entry_safe to list_for_each_entry. Signed-off-by: Byongho Lee <bhlee.ker...@gmail.com> --- fs/btrfs/ioctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs

[PATCH 2/3] btrfs-progs: fix memory leak in btrfs-map-logical main()

2015-08-27 Thread Byongho Lee
In btrfs-map-logical main(), strdup() allocates memory to output_file, but that memory is not freed. So add missing free() calls before return. Signed-off-by: Byongho Lee bhlee.ker...@gmail.com --- btrfs-map-logical.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/btrfs-map-logical.c b

[PATCH 0/3] btrfs-progs: Small fixes for code using strdup()

2015-08-27 Thread Byongho Lee
1. fix memory leak in btrfs-convert main() 2. fix memory leak in btrfs-map-logical main() 3. add memory allocation fail check in btrfs_add_to_fsid() Byongho Lee (3): btrfs-progs: fix memory leak in btrfs-convert main() btrfs-progs: fix memory leak in btrfs-map-logical main() btrfs-progs

[PATCH 1/3] btrfs-progs: fix memory leak in btrfs-convert main()

2015-08-27 Thread Byongho Lee
and strncpy(). And btrfs-convert main() guarantees that string length of fslabel is not to exceed 'BTRFS_LABEL_SIZE', so it's enough to use strcpy() instead of strncpy() to copy fslabel in do_convert(). Signed-off-by: Byongho Lee bhlee.ker...@gmail.com --- btrfs-convert.c | 9 + 1 file

[PATCH 3/3] btrfs-progs: add memory allocation fail check in btrfs_add_to_fsid()

2015-08-27 Thread Byongho Lee
In btrfs_add_to_fsid(), strdup() allocates memory to device-name, but the return value is not checked. So add the return value check and error handling code. And clean-up error handling code for ENOMEM case. Signed-off-by: Byongho Lee bhlee.ker...@gmail.com --- utils.c | 20

[PATCH v2] btrfs-progs: fix memory leaks in error path

2015-08-21 Thread Byongho Lee
This patch includes below fixes in error path: 1. fix memory leaks if realloc() fails 2. add missing call free_history() before return error in scrub_read_file() Signed-off-by: Byongho Lee bhlee.ker...@gmail.com --- changelog: v2: Add one more fix for memory leak when realloc() fails by Zhao

Re: [PATCH] btrfs-progs: fix memory leaks in error path

2015-08-20 Thread Byongho Lee
Zhao Lei writes: Hi, Byongho Lee -Original Message- From: linux-btrfs-ow...@vger.kernel.org [mailto:linux-btrfs-ow...@vger.kernel.org] On Behalf Of Byongho Lee Sent: Friday, August 21, 2015 11:10 AM To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: fix memory leaks

[PATCH] Btrfs: remove unused mutex from struct 'btrfs_fs_info'

2015-07-09 Thread Byongho Lee
'btrfs_fs_info' and its initialization code. Signed-off-by: Byongho Lee bhlee.ker...@gmail.com --- fs/btrfs/ctree.h | 6 -- fs/btrfs/disk-io.c | 1 - 2 files changed, 7 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index aac314e14188..cdde6d541b3a 100644 --- a/fs/btrfs/ctree.h +++ b/fs