[PATCH 16/24] btrfs: return actual error on btrfs_init_sysfs

2014-06-17 Thread Jeff Liu
From: Jie Liu jeff@oracle.com Return the actual error code if call kset_create_and_add() failed Cc: Chris Mason c...@fb.com Cc: Josef Bacik jba...@fb.com Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [PATCH 16/24] btrfs: return actual error on btrfs_init_sysfs

2014-06-17 Thread Jeff Liu
Hi, On 06/17/2014 22:32 PM, Jeff Liu wrote: From: Jie Liu jeff@oracle.com Return the actual error code if call kset_create_and_add() failed Cc: Chris Mason c...@fb.com Cc: Josef Bacik jba...@fb.com Signed-off-by: Jie Liu jeff@oracle.com Please ignore this patch because Greg

Re: [PATCH] xfstests: generic/315: allow a little tolerance for our used check

2013-07-29 Thread Jeff Liu
On 07/30/2013 02:55 AM, Josef Bacik wrote: So df in btrfs is tricky at best, and relying on it for accurate information is not great, but it's the best way to verify this test. To get around btrfs being inconsistent sometimes just use _within_tolerance to check our new df value to make

Re: [PATCH] btrfs: fix file truncation if FALLOC_FL_KEEP_SIZE is specified

2013-06-28 Thread Jeff Liu
On 06/28/2013 08:41 PM, Josef Bacik wrote: On Fri, Jun 28, 2013 at 01:15:52PM +0800, Jeff Liu wrote: From: Jie Liu jeff@oracle.com Create a small file and fallocate it to a big size with FALLOC_FL_KEEP_SIZE option, then truncate it back to the small size again, the disk free space

Re: [PATCH] btrfs: fix file truncation if FALLOC_FL_KEEP_SIZE is specified

2013-06-28 Thread Jeff Liu
On 06/29/2013 10:22 AM, Dave Chinner wrote: On Fri, Jun 28, 2013 at 08:41:00AM -0400, Josef Bacik wrote: On Fri, Jun 28, 2013 at 01:15:52PM +0800, Jeff Liu wrote: From: Jie Liu jeff@oracle.com Create a small file and fallocate it to a big size with FALLOC_FL_KEEP_SIZE option

[PATCH] btrfs: fix file truncation if FALLOC_FL_KEEP_SIZE is specified

2013-06-27 Thread Jeff Liu
From: Jie Liu jeff@oracle.com Create a small file and fallocate it to a big size with FALLOC_FL_KEEP_SIZE option, then truncate it back to the small size again, the disk free space is not changed back in this case. i.e, # dd if=/dev/zero of=/mnt/test bs=512 count=1 # ls -l /mnt total 4

[PATCH] btrfs: fix the code comments for LZO compression workspace

2013-06-06 Thread Jeff Liu
From: Jie Liu jeff@oracle.com Fix the code comments for lzo compression workspace. The buf item is used to store the decompressed data and cbuf is used to store the compressed data. Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/lzo.c |4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH v2 1/2] btrfs-progs: refactor check_label()

2013-01-30 Thread Jeff Liu
Refactor check_label(). - Make it be static at first, this is a preparation step since we'll remove btrfslabel.[c|h] and move those functions from there to utils.[c|h], we can do pre-checking against the input label string with it. - Fix the label length check up from BTRFS_LABEL_SIZE to

[PATCH v2 2/2] btrfs-progs: move btrfslabel.[c|h] stuff to utils.[c|h]

2013-01-30 Thread Jeff Liu
Clean btrfslabel.[c|h] out of the source tree and move those related functions to utils.[c|h]. Signed-off-by: Jie Liu jeff@oracle.com CC: David Sterba dste...@suse.cz CC: Gene Czarcinski g...@czarc.net --- Makefile |4 +- btrfslabel.c | 178

Re: [PATCH 2/2] btrfs-progs: remove btrfslabel.[c|h]

2013-01-29 Thread Jeff Liu
On 01/29/2013 06:26 PM, Stefan Behrens wrote: On Tue, 29 Jan 2013 14:24:13 +0800, Jeff Liu wrote: Clean btrfslabel.[c|h] out of the source tree and move those related functions to utils.[c|h]. Signed-off-by: Jie Liu jeff@oracle.com CC: David Sterba dste...@suse.cz CC: Gene Czarcinski g

Re: [PATCH 1/2] btrfs-progs: refactor check_label()

2013-01-29 Thread Jeff Liu
On 01/29/2013 11:19 PM, David Sterba wrote: On Tue, Jan 29, 2013 at 02:24:12PM +0800, Jeff Liu wrote: --- a/utils.c +++ b/utils.c @@ -1122,17 +1122,21 @@ char *pretty_sizes(u64 size) -1if the label is too long -2if the label contains an invalid character */ -int

Re: [PATCH] Btrfs-progs: v2 Fix minor problems in btrfslabel.c

2013-01-28 Thread Jeff Liu
Czarcinski g...@czarc.net --- btrfslabel.c | 57 + Jeff Liu has sent a series that updates the code and also fixes the formatting. And I'd prefer to take his series as a more extensive update. Also, btrfslabel.c is another file

[PATCH 0/2] btrfs-progs: btrfslabel source code consolidation

2013-01-28 Thread Jeff Liu
Hello, As per David's suggestions, we should remove btrfslabel source code and move the related functions to cmds-filesystems or utils. I prefer to move them into utils since there already has a check_label() function which can be used for the pre-checkup against the input label. This patch

[PATCH 1/2] btrfs-progs: refactor check_label()

2013-01-28 Thread Jeff Liu
Refactor check_label(). Make it be static at first, this is a preparation step since we'll remove btrfslabel.[c|h] and move those functions at them to utils.[c|h], we can do pre-checking against the input label string with it. Also, fix the input lable length verfication from BTRFS_LABEL_SIZE to

[PATCH 2/2] btrfs-progs: remove btrfslabel.[c|h]

2013-01-28 Thread Jeff Liu
Clean btrfslabel.[c|h] out of the source tree and move those related functions to utils.[c|h]. Signed-off-by: Jie Liu jeff@oracle.com CC: David Sterba dste...@suse.cz CC: Gene Czarcinski g...@czarc.net --- Makefile |4 +- btrfslabel.c | 178

[PATCH] Btrfs: fix sparse warning related to drop_delayed_ref()

2013-01-08 Thread Jeff Liu
Fix a sparse warning: fs/btrfs/delayed-ref.c:236:1: warning: ‘inline’ is not at beginning of declaration [-Wold-style-declaration] Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/delayed-ref.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/delayed-ref.c

[PATCH] Btrfs: remove meanlingless owner as well as it related stuff in btrfs_new_inode

2013-01-08 Thread Jeff Liu
Remove the owner variable as well as it related stuff. owner is meaningless in btrfs_new_inode() context, clean it out. Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/inode.c |6 -- 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index

Re: [PATCH] Btrfs: replace simple_strtoull() with kstrtoull() in btrfs_ioctl_resize()

2013-01-07 Thread Jeff Liu
On 01/08/2013 12:03 AM, David Sterba wrote: On Sun, Jan 06, 2013 at 11:53:41AM +0800, Jeff Liu wrote: -devid = simple_strtoull(devstr, end, 10); +ret = kstrtoull(devstr, 10, devid); +if (ret) { +pr_err(btrfs: resizer unable to parse

Re: [RFC PATCH v9 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2013-01-07 Thread Jeff Liu
Hi Goffredo, On 01/08/2013 01:32 AM, Goffredo Baroncelli wrote: Hi Jeff, On 01/07/2013 07:24 AM, Jeff Liu wrote: Hi, On 01/07/2013 02:44 AM, Goffredo Baroncelli wrote: Hi Jeff, On 01/05/2013 03:48 AM, Jeff Liu wrote: Add a new ioctl(2) BTRFS_IOC_GET_FSLABLE, so that we can get the label

Re: [RFC PATCH v9 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2013-01-06 Thread Jeff Liu
Hi, On 01/07/2013 02:44 AM, Goffredo Baroncelli wrote: Hi Jeff, On 01/05/2013 03:48 AM, Jeff Liu wrote: Add a new ioctl(2) BTRFS_IOC_GET_FSLABLE, so that we can get the label upon a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j

[PATCH] Btrfs: replace simple_strtoull() with kstrtoull() in btrfs_ioctl_resize()

2013-01-05 Thread Jeff Liu
simple_strtoull() is obsolete, use kstrtoull() instead. Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/ioctl.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 8fcf9a5..b147424 100644 --- a/fs/btrfs/ioctl.c +++

[RFC PATCH v9 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2013-01-04 Thread Jeff Liu
Add a new ioctl(2) BTRFS_IOC_GET_FSLABLE, so that we can get the label upon a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com Cc: Goffredo Baroncelli kreij...@inwind.it Cc: David Sterba

[RFC PATCH v9 2/2] Btrfs: set/change the label of a mounted file system

2013-01-04 Thread Jeff Liu
With this new ioctl(2) BTRFS_IOC_SET_FSLABEL, we can set/change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: Goffredo Baroncelli kreij...@inwind.it

[RFC PATCH v9 0/2] Btrfs: get/set label for a mounted file system

2013-01-04 Thread Jeff Liu
Hello, There have a couple of changes in this version which were shown as following: - Don't reserve an unit of transactions for set filesystem label. - Replace the old warning message to btrfs: label is too long, return the first %zu bytes in btrfs_ioc_get_fslabel() is the existing label

Re: [RFC PATCH v8 2/2] Btrfs: Add a new ioctl to set/change the label of a mounted file system

2012-12-31 Thread Jeff Liu
On 12/28/2012 08:03 PM, David Sterba wrote: On Fri, Dec 28, 2012 at 11:42:40AM +0800, Jeff Liu wrote: +static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg) +{ +struct btrfs_root *root = BTRFS_I(fdentry(file)-d_inode)-root; +struct btrfs_super_block *super_block

[RFC PATCH v8 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2012-12-27 Thread Jeff Liu
Add a new ioctl(2) BTRFS_IOC_GET_FSLABLE, so that we can get the label upon a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com Cc: Goffredo Baroncelli kreij...@inwind.it Cc: David Sterba

[RFC PATCH v8 0/2] Btrfs: get/set label of a mounted file system

2012-12-27 Thread Jeff Liu
Hello, Here is the updated version of introduce get/set_or_change label upon a mounted filesystem. v8-v7: btrfs_ioc_fs_getlabel(): - Examine the label length with strnlen(). - Tweak up warn() info if the label is not NUL terminated according to Goffredo's suggestions. The old versions can be

[RFC PATCH v8 2/2] Btrfs: Add a new ioctl to set/change the label of a mounted file system

2012-12-27 Thread Jeff Liu
With this new ioctl(2) BTRFS_IOC_SET_FSLABEL, we can set/change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: Goffredo Baroncelli kreij...@inwind.it

Re: [RFC PATCH v7 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2012-12-24 Thread Jeff Liu
On 12/22/2012 01:36 AM, Goffredo Baroncelli wrote: On 12/21/2012 07:42 AM, Jeff Liu wrote: Hi Goffredo, On 12/21/2012 04:18 AM, Goffredo Baroncelli wrote: HI Jeff, On 12/20/2012 09:43 AM, Jeff Liu wrote: With the new ioctl(2) BTRFS_IOC_GET_FSLABEL we can fetch the label of a mounted file

Re: [RFC PATCH v7 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2012-12-24 Thread Jeff Liu
On 12/24/2012 09:46 PM, Goffredo Baroncelli wrote: Hi Jeff, On 12/24/2012 09:07 AM, Jeff Liu wrote: On 12/22/2012 01:36 AM, Goffredo Baroncelli wrote: On 12/21/2012 07:42 AM, Jeff Liu wrote: [...] I don't think we should replace strlen() with strnlen() since it's totally wrong

Re: [RFC PATCH V6 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-20 Thread Jeff Liu
On 12/19/2012 10:21 PM, David Sterba wrote: On Tue, Dec 18, 2012 at 11:06:07AM +0800, Jeff Liu wrote: +static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg) +{ +struct btrfs_root *root = BTRFS_I(fdentry(file)-d_inode)-root; +struct btrfs_super_block *super_block

[RFC PATCH v7 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2012-12-20 Thread Jeff Liu
With the new ioctl(2) BTRFS_IOC_GET_FSLABEL we can fetch the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com Cc: Goffredo Baroncelli kreij...@inwind.it Cc: David Sterba dste...@suse.cz

[RFC PATCH v7 2/2] Btrfs: Add a new ioctl to set/change the label of a mounted file system

2012-12-20 Thread Jeff Liu
With the new ioctl(2) BTRFS_IOC_SET_FSLABEL, we can set/change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com Cc: Goffredo Baroncelli kreij...@inwind.it Cc: David Sterba

[RFC PATCH v7 0/2] Btrfs: get/set label of a mounted file system

2012-12-20 Thread Jeff Liu
Hello, Per David's comments upon v6, I missed a check up against the return value of btrfs_end_transaction for btrfs_ioctl_fs_setlabel(), it was fixed in this version. v7-v6: - take care of btrfs_end_transaction() in btrfs_ioctl_fs_setlabel() rather than keeping silence. The old versions can

Re: [RFC PATCH v7 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system

2012-12-20 Thread Jeff Liu
Hi Goffredo, On 12/21/2012 04:18 AM, Goffredo Baroncelli wrote: HI Jeff, On 12/20/2012 09:43 AM, Jeff Liu wrote: With the new ioctl(2) BTRFS_IOC_GET_FSLABEL we can fetch the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j

Re: [RFC PATCH V6 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-18 Thread Jeff Liu
Hi Goffredo, Thanks for your review. On 12/19/2012 02:00 AM, Goffredo Baroncelli wrote: Hi Jeff, On 12/18/2012 04:31 AM, Miao Xie wrote: [...] diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c [...] +static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg) +{ + struct

[RFC PATCH V5 0/2] Btrfs: get/set label of mounted file system

2012-12-17 Thread Jeff Liu
Hello, This patch set is trying to make Btrfs support get/set label for a mounted file sytem via ioctl(2). There are a couple of changes according to Miao's comments which were shown as following. Changes of V5-V4 in kernel: - Revise the ioctl number of

[RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Jeff Liu
Introduce a new ioctl BTRFS_IOC_SET_FSLABEL to change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 40

[RFC PATCH V5 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem

2012-12-17 Thread Jeff Liu
Introduce a new ioctl BTRFS_IOC_GET_FSLABEL to fetch the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 15 +++ fs/btrfs/ioctl.h |2 ++ 2 files

[PATCH v5 1/4] Btrfs-progs: get label of a mounted file system

2012-12-17 Thread Jeff Liu
With this new ioctl(2), we can get the label for a mounted file system. It still does normal process to fetch label if the specified file system is unmounted. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- btrfslabel.c | 74

[PATCH V5 2/4] Btrfs-progs: Change the label of a mounted file system

2012-12-17 Thread Jeff Liu
With this new ioctl(2), we can set/change the label for a mounted file system. It still does normal process for an umounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- btrfslabel.c | 90

[PATCH V5 3/4] Btrfs-progs: Fix set_label_unmounted() with label length validation

2012-12-17 Thread Jeff Liu
Currently, we keeping silent if the label length is exceeding BTRFS_LABEL_SIZE - 1, and just truncating the characters beyond that. This patch make it return error and exit in this situation. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com ---

[PATCH v5 4/4] Btrfs-progs: fix cmd_label_usage to reflect this change.

2012-12-17 Thread Jeff Liu
Fix the command usage of btrfs filesystem label to reflect this change. i.e. so that we can get/set the label of a mounted filesystem against the mountpoint. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- cmds-filesystem.c |4 ++-- 1 file

Re: [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Jeff Liu
On 12/17/2012 07:57 PM, Miao Xie wrote: Onmon, 17 Dec 2012 19:22:11 +0800, Jeff Liu wrote: Introduce a new ioctl BTRFS_IOC_SET_FSLABEL to change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie

Re: [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Jeff Liu
On 12/18/2012 01:34 AM, Goffredo Baroncelli wrote: On 12/17/2012 02:30 PM, Jeff Liu wrote: On 12/17/2012 07:57 PM, Miao Xie wrote: On mon, 17 Dec 2012 19:22:11 +0800, Jeff Liu wrote: Introduce a new ioctl BTRFS_IOC_SET_FSLABEL to change the label of a mounted file system. Signed-off

Re: [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Jeff Liu
On 12/18/2012 10:21 AM, Miao Xie wrote: Onmon, 17 Dec 2012 18:34:41 +0100, Goffredo Baroncelli wrote: On 12/17/2012 02:30 PM, Jeff Liu wrote: On 12/17/2012 07:57 PM, Miao Xie wrote: On mon, 17 Dec 2012 19:22:11 +0800, Jeff Liu wrote: Introduce a new ioctl BTRFS_IOC_SET_FSLABEL

Re: [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Jeff Liu
On 12/18/2012 10:33 AM, Jeff Liu wrote: On 12/18/2012 10:21 AM, Miao Xie wrote: On mon, 17 Dec 2012 18:34:41 +0100, Goffredo Baroncelli wrote: On 12/17/2012 02:30 PM, Jeff Liu wrote: On 12/17/2012 07:57 PM, Miao Xie wrote: Onmon, 17 Dec 2012 19:22:11 +0800, Jeff Liu wrote

[RFC PATCH V6 0/2] Btrfs: get/set label of a mounted file system

2012-12-17 Thread Jeff Liu
Hello, Here is quick fix for btrfs set lable ioctl(2) based on v5, it does label length check up with strnlen() to avoid searching a zero could go beyond the page limit touching an un-mapped page and raising an segmentation fault with strlen(). V6-v5: - Improve the input label string

[RFC PATCH V6 2/1] Btrfs: Add a new ioctl to get the label of a mounted file system

2012-12-17 Thread Jeff Liu
Introduce a new ioctl BTRFS_IOC_GET_FSLABEL to fetch the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 15 +++ fs/btrfs/ioctl.h |2 ++

[RFC PATCH V6 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Jeff Liu
Introduce a new ioctl BTRFS_IOC_SET_FSLABEL to change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com Cc: Goffredo Baroncelli kreij...@inwind.it --- fs/btrfs/ioctl.c | 39

Re: [RESEND PATCH V4 2/2] Btrfs: Add a new ioctl to change the label of a mounted filesystem

2012-12-16 Thread Jeff Liu
Sorry for my late response, I missed your feedback somehow. On 12/12/2012 12:15 PM, Miao Xie wrote: On wed, 12 Dec 2012 11:23:00 +0800, Jeff Liu wrote: Add a new ioctl BTRFS_FS_SETLABEL to change the label of a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off

[PATCH V4 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
Introduce a new ioctl BTRFS_IOC_GET_FSLABEL, which would be used to fetch the label of a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 14 ++ fs/btrfs/ioctl.h |2 ++ 2 files changed, 16

[PATCH V4 2/2] Btrfs: Add a new ioctl to change the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
Add a new ioctl BTRFS_FS_SETLABEL to change the label of a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 14 ++ fs/btrfs/ioctl.h |2 ++ 2 files changed, 16 insertions(+) diff --git

[RFC PATCH V4 0/2] Btrfs: get/set mounted filesystem label support

2012-12-11 Thread Jeff Liu
Hello, This is an improved tiny patch set to add get/set the label upon a mounted file system via ioctl(2). I'd like to add the Signed-off-by with Anand for the credit since He has posted a similar patch set a few month ago. Changes of V4-V3: - Add a new ioctl to fetch the label of a mounted

[PATCH v4 3/3] Btrfs-progs: fix cmd_label_usage to reflect this change.

2012-12-11 Thread Jeff Liu
Fix the command usage of btrfs filesystem label to reflect this change. i.e. so that we can get/set the label of a mounted filesystem against the mountpoint. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- cmds-filesystem.c |4 ++-- 1 file

[PATCH v4 1/3] Btrfs-progs: get the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
Get the label of a mounted filesystem through the new ioctl BTRFS_IOCTL_FS_GETLABEL. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- btrfslabel.c | 68 +- ioctl.h |2 ++ utils.c

[PATCH v4 2/3] Btrfs-progs: change the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
Change the label of a mounted file system through the new ioctl BTRFS_IOCTL_FS_SETLABEL. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- btrfslabel.c | 84 ++ ioctl.h |2 ++ 2

Re: [PATCH V4 2/2] Btrfs: Add a new ioctl to change the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
Hi Miao, On 12/12/2012 11:03 AM, Miao Xie wrote: Hi, Liu On wed, 12 Dec 2012 08:22:28 +0800, Jeff Liu wrote: Add a new ioctl BTRFS_FS_SETLABEL to change the label of a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com

[RESEND PATCH V4 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 14 ++ fs/btrfs/ioctl.h |2 ++ 2 files changed, 16 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 8fcf9a5..b0a5e17 100644 ---

[RESEND PATCH V4 2/2] Btrfs: Add a new ioctl to change the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
Add a new ioctl BTRFS_FS_SETLABEL to change the label of a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 34 ++ fs/btrfs/ioctl.h |2 ++ 2 files changed, 36

Re: [RESEND PATCH V4 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem

2012-12-11 Thread Jeff Liu
On 12/12/2012 11:50 AM, Miao Xie wrote: On Wed, 12 Dec 2012 11:22:49 +0800, Jeff Liu wrote: Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 14 ++ fs/btrfs/ioctl.h |2 ++ 2 files changed, 16 insertions

Re: How to find (out if) files sharing content?

2012-11-05 Thread Jeff Liu
On 11/06/2012 06:45 AM, David Sterba wrote: On Wed, Oct 31, 2012 at 09:02:15PM +0800, Jeff Liu wrote: I propose this because OCFS2 report shared space in this way combine with du(1). An old patch set to teach du(1) aware of reflinked file: https://oss.oracle.com/pipermail/ocfs2-devel/2010

Re: How to find (out if) files sharing content?

2012-10-31 Thread Jeff Liu
On 10/31/2012 07:31 PM, David Sterba wrote: On Wed, Oct 31, 2012 at 10:30:22AM +0800, Jeff Liu wrote: One idea is to mark those cloned extents as FIEMAP_EXTENT_SHARED so that we can go through a file to figure out how many extents are shared through fiemap(2), and calculate the real storage(fs

Re: How to find (out if) files sharing content?

2012-10-30 Thread Jeff Liu
On 10/31/2012 08:40 AM, Liu Bo wrote: On 10/30/2012 11:20 PM, Gábor Nyers wrote: Hi, How could one find out if 2 files share any extents on a btrfs file system? A more generic variation of the above: How to list files on the same file system/subvolume sharing content? One idea is to mark

[PATCH] Btrfs: Remove the invalid shrink size check up from btrfs_shrink_dev()

2012-10-27 Thread Jeff Liu
Remove an invalid size check up from btrfs_shrink_dev(). The new size should not larger than the device-total_bytes as it was already verified before coming to here(i.e. new_size old_size). Remove invalid check up for btrfs_shrink_dev(). Signed-off-by: Jie Liu jeff@oracle.com ---

Re: [RFC PATCH 0/5] btrfs-progs: snapshot diff function

2012-08-24 Thread Jeff Liu
, that would be fine. Thanks, -Jeff Apologies if I somehow misunderstood what your snapshot-diff code does. Thanks, Alex. On Tue, Aug 7, 2012 at 11:56 AM, Jeff Liu jeff@oracle.com wrote: Hello, I've done a prototype implementation of snapshot diff utility many months ago

[RFC PATCH 0/5] btrfs-progs: snapshot diff function

2012-08-07 Thread Jeff Liu
Hello, I've done a prototype implementation of snapshot diff utility many months ago. It was originally meant to analyze the differences between two snapshots which are inherited from the same subvolume/snapshot. Moreover, the upstream LXC userland tools has been released with a dedicated

[RFC PATCH 1/5] btrfs-progs: make ino_resovle() shared

2012-08-07 Thread Jeff Liu
Make ino_resolve() shared so that we can call it at snapshot diff module. Signed-off-by: Jie Liu jeff@oracle.com --- btrfs-list.c |3 +-- btrfs-list.h | 22 ++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 btrfs-list.h diff --git

[RFC PATCH 2/5] btrfs-progs: header file of snapshot diff

2012-08-07 Thread Jeff Liu
Maybe it's better to put those #defines to the source file of snapshot diff as no other modules need them. Signed-off-by: Jie Liu jeff@oracle.com --- diff-snapshot.h | 47 +++ 1 files changed, 47 insertions(+), 0 deletions(-) create mode

[RFC PATCH 3/5] btrfs-progs: souce file of snapshot diff

2012-08-07 Thread Jeff Liu
Now the source file is coming. Signed-off-by: Jie Liu jeff@oracle.com --- diff-snapshot.c | 1026 +++ 1 files changed, 1026 insertions(+), 0 deletions(-) create mode 100644 diff-snapshot.c diff --git a/diff-snapshot.c b/diff-snapshot.c

[RFC PATCH 4/5] btrfs-progs: teach Makefile aware of the new comer

2012-08-07 Thread Jeff Liu
Signed-off-by: Jie Liu jeff@oracle.com --- Makefile |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index 969..f8b517d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CFLAGS = -g -O0 objects = ctree.o disk-io.o radix-tree.o

[RFC PATCH 5/5] btrfs-progs: let this feature works at subvolume command group.

2012-08-07 Thread Jeff Liu
make this feature works as `btrfs subvolume diff-snapshot [options] src dest`. Signed-off-by: Jie Liu jeff@oracle.com --- cmds-subvolume.c | 90 ++ 1 files changed, 90 insertions(+), 0 deletions(-) diff --git a/cmds-subvolume.c

Re: btrfs_print_tree?

2012-07-01 Thread Jeff Liu
On 07/01/2012 05:49 PM, Zhi Yong Wu wrote: On Sun, Jul 1, 2012 at 5:41 PM, Mike Fleetwood mike.fleetw...@googlemail.com wrote: On 1 July 2012 05:53, Zhi Yong Wu zwu.ker...@gmail.com wrote: HI, Do anyone know where btrfs_print_tree is invoked? thanks. -- Regards, Zhi Yong Wu Is this

[PATCH] Btrfs: return EUCLEAN rather than ENXIO once internal error has occurred for SEEK_DATA/SEEK_HOLE inquiry

2012-02-08 Thread Jeff Liu
By referring to http://linux.die.net/man/2/lseek, return ENXIO only when offset beyond EOF for either SEEK_DATA or SEEK_HOLE inquiry. But we return it in case of internal issue too if btrfs_get_extent_fiemap() failed due to other issues. This will confuse the user applications to be expecting

Re: [PATCH] Btrfs: return EUCLEAN rather than ENXIO once internal error has occurred for SEEK_DATA/SEEK_HOLE inquiry

2012-02-08 Thread Jeff Liu
On 02/09/2012 11:46 AM, Jeff Liu wrote: By referring to http://linux.die.net/man/2/lseek, return ENXIO only when offset beyond EOF for either SEEK_DATA or SEEK_HOLE inquiry. But we return it in case of internal issue too if btrfs_get_extent_fiemap() failed due to other issues

Re: [PATCH] Btrfs: return EUCLEAN rather than ENXIO once internal error has occurred for SEEK_DATA/SEEK_HOLE inquiry

2012-02-08 Thread Jeff Liu
On 02/09/2012 12:51 PM, Dave Chinner wrote: On Thu, Feb 09, 2012 at 12:08:47PM +0800, Jeff Liu wrote: On 02/09/2012 11:46 AM, Jeff Liu wrote: By referring to http://linux.die.net/man/2/lseek, return ENXIO only when offset beyond EOF for either SEEK_DATA or SEEK_HOLE inquiry. But we return

[PATCH v2] Btrfs: return the internal error unchanged if btrfs_get_extent_fiemap() call failed for SEEK_DATA/SEEK_HOLE inquiry

2012-02-08 Thread Jeff Liu
Given that ENXIO only means offset beyond EOF for either SEEK_DATA or SEEK_HOLE inquiry in a desired file range, so we should return the internal error unchanged if btrfs_get_extent_fiemap() call failed, rather than ENXIO. Cc: Dave Chinner da...@fromorbit.com Signed-off-by: Jie Liu

Re: [PATCH 2/2] Btrfs: set the i_nlink to 2 for an initial dir inode

2011-11-29 Thread Jeff Liu
On 11/29/2011 11:48 PM, Chris Mason wrote: On Tue, Nov 29, 2011 at 02:04:37PM +0800, Jeff Liu wrote: Please ignore this patch for now, it can cause the file system corrupted and failed to mount again, sorry for the noise! Directories always have a link count of 1 in btrfs. This tells find

Re: [PATCH 2/2] Btrfs: set the i_nlink to 2 for an initial dir inode

2011-11-28 Thread Jeff Liu
Please ignore this patch for now, it can cause the file system corrupted and failed to mount again, sorry for the noise! -Jeff On 11/28/2011 03:47 PM, Jeff Liu wrote: For an initial dir inode, stat(1) show it links as 1, IMHO it should be 2 by default. Signed-off-by: Jie Liu jeff

[PATCH 1/2] Btrfs: adjust the variables indentation to TAB

2011-11-27 Thread Jeff Liu
Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/ioctl.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 4a34c47..795c415 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1689,9 +1689,9 @@ err: static

[PATCH 2/2] Btrfs: set the i_nlink to 2 for an initial dir inode

2011-11-27 Thread Jeff Liu
For an initial dir inode, stat(1) show it links as 1, IMHO it should be 2 by default. Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/inode.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 116ab67..92b3cb9 100644 ---

Re: [PATCH 1/7] BTRFS: Fix lseek return value for error

2011-09-18 Thread Jeff Liu
Hi Andreas and Andi, Thanks for your comments. On 09/18/2011 09:46 AM, Andi Kleen wrote: with an additional improvement if the offset is larger or equal to the file size, return -ENXIO in directly: if (offset = inode-i_size) {

Re: [PATCH 1/7] BTRFS: Fix lseek return value for error

2011-09-18 Thread Jeff liu
在 2011-9-18,下午4:42, Marco Stornelli 写道: Il 18/09/2011 09:29, Jeff Liu ha scritto: Hi Andreas and Andi, Thanks for your comments. On 09/18/2011 09:46 AM, Andi Kleen wrote: with an additional improvement if the offset is larger or equal to the file size, return -ENXIO in directly

Re: [PATCH 1/7] BTRFS: Fix lseek return value for error

2011-09-17 Thread Jeff Liu
I once posted a similar patch for this issue which can be found at: http://www.spinics.net/lists/linux-btrfs/msg12169.html with an additional improvement if the offset is larger or equal to the file size, return -ENXIO in directly: if (offset = inode-i_size) {

[PATCH V2] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()

2011-09-15 Thread Jeff Liu
Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/super.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 15634d4..16f31e1 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -406,7 +406,7 @@ static int

Re: [PATCH 2/2] Btrfs: don't change inode flag of the dest clone file

2011-09-15 Thread Jeff Liu
Add CC to Coreutils, cp --reflink performs btrfs clone operation. Thanks, -Jeff On 09/15/2011 07:43 PM, David Sterba wrote: On Wed, Sep 14, 2011 at 01:25:36PM +0800, Li Zefan wrote: The dst file will have the same inode flags with dst file after file clone, and I think it's unexpected. For

Re: [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()

2011-09-14 Thread Jeff Liu
On 09/14/2011 01:40 PM, Li Zefan wrote: 14:06, Jeff Liu wrote: Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/super.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 15634d4..16f31e1 100644 --- a/fs

[PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()

2011-09-13 Thread Jeff Liu
Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/super.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 15634d4..16f31e1 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -406,7 +406,7 @@ static int

Re: mount a multi-device filesystem using a loopback device

2011-09-08 Thread Jeff Liu
On 09/08/2011 01:32 PM, C Anthony Risinger wrote: On Wed, Sep 7, 2011 at 1:44 AM, Jeff Liujeff@oracle.com wrote: On 09/07/2011 12:37 PM, cwillu wrote: 1. Create and format two images, the 1st in 400Mbytes, and 2nd in 286Mbytes. root@pibroch:/btrfs-progs# ls -lh /usr/src/linux-3.0/img*

Re: mount a multi-device filesystem using a loopback device

2011-09-07 Thread Jeff Liu
On 09/07/2011 02:31 PM, Li Zefan wrote: Is it a bug? or Am I missing something? You need to run this before mounting the devices: # btrfs device scan Thank you, it works by executing device scan. -Jeff -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body

Re: mount a multi-device filesystem using a loopback device

2011-09-07 Thread Jeff Liu
On 09/07/2011 12:37 PM, cwillu wrote: 1. Create and format two images, the 1st in 400Mbytes, and 2nd in 286Mbytes. root@pibroch:/btrfs-progs# ls -lh /usr/src/linux-3.0/img* -rw-r--r-- 1 jeff jeff 400M 2011-09-07 12:00 /usr/src/linux-3.0/img0 -rw-r--r-- 1 jeff jeff 286M 2011-09-07 12:00

mount a multi-device filesystem using a loopback device

2011-09-06 Thread Jeff Liu
Hello, I was trying to create a multi-device Btrfs filesystem using two loopback devices, by referring to the following page: https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices However, I met a strange thing while mounting the first loop device without any extra mount

[PATCH] Btrfs: added new ioctl to set fs label V3

2011-09-05 Thread Jeff Liu
Hello, According to Hugo and David's advise, the ioctl number of BTRFS_IOC_FS_SETLABEL ioctl was changed to 50 now. Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/ctree.h |4 fs/btrfs/ioctl.c | 36 fs/btrfs/ioctl.h |2 ++ 3 files

[PATCH] Btrfs-progs: added btrfs filesystem label [label] [path] support V3

2011-09-05 Thread Jeff Liu
, int super_offset); char *pretty_sizes(u64 size); +char *parse_label(const char *); #endif -- 1.7.4.1 On 09/05/2011 01:34 PM, Jeff Liu wrote: On 09/05/2011 01:03 AM, Hugo Mills wrote: On Sat, Sep 03, 2011 at 11:11:36AM +0800, Jeff liu wrote: On Fri, Sep 02, 2011 at 09:13:34PM

Re: [PATCH] Btrfs-progs: added btrfs filesystem label [label] [path] support V2

2011-09-04 Thread Jeff Liu
On 09/05/2011 01:03 AM, Hugo Mills wrote: On Sat, Sep 03, 2011 at 11:11:36AM +0800, Jeff liu wrote: 在 2011-9-2,下午11:48, David Sterba 写道: On Fri, Sep 02, 2011 at 09:13:34PM +0800, Jeff Liu wrote: --- a/ioctl.h +++ b/ioctl.h @@ -140,6 +140,8 @@ struct btrfs_ioctl_space_args

Re: [PATCH] Btrfs-progs: added btrfs filesystem label [label] [path] support V2

2011-09-02 Thread Jeff Liu
:54PM +0800, Jeff Liu wrote: Revise the patch according to kernel side change. Leave original commit message. If you want to document changes between revised patch version put them ... ok, fixed as below: From e2990b69ecd3bac8da8023a64c866d16c81a1679 Mon Sep 17 00:00:00 2001 From: Jie Liu jeff

Re: [PATCH] Btrfs-progs: added btrfs filesystem label [label] [path] support V2

2011-09-02 Thread Jeff liu
在 2011-9-2,下午11:48, David Sterba 写道: On Fri, Sep 02, 2011 at 09:13:34PM +0800, Jeff Liu wrote: --- a/ioctl.h +++ b/ioctl.h @@ -140,6 +140,8 @@ struct btrfs_ioctl_space_args { struct btrfs_ioctl_vol_args) #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4

[PATCH] Btrfs: added new ioctl to set fs label

2011-09-01 Thread Jeff Liu
Hello, I'd like to introduce a new ioctl to set file system label. With this feature, we can execute `btrfs filesystem label [label] [path]` through btrfs tools to set or change the label. Signed-off-by: Jie Liu jeff@oracle.com --- fs/btrfs/ctree.h |6 ++ fs/btrfs/ioctl.c |

[PATCH] Btrfs-progs: added btrfs filesystem label [label] [path] support

2011-09-01 Thread Jeff Liu
Hello, This patch make use of the new ioctl(2) to set Btrfs label via `btrfs filesystem label` command. Signed-off-by: Jie Liu jeff@oracle.com --- btrfs.c |7 +++ btrfs_cmds.c | 27 +++ btrfs_cmds.h |1 + ctree.h |6 ++ ioctl.h

Re: [PATCH] Btrfs: added new ioctl to set fs label

2011-09-01 Thread Jeff Liu
Hi Hugo, On 09/01/2011 05:00 PM, Hugo Mills wrote: On Thu, Sep 01, 2011 at 04:47:47PM +0800, Jeff Liu wrote: Hello, I'd like to introduce a new ioctl to set file system label. With this feature, we can execute `btrfs filesystem label [label] [path]` through btrfs tools to set or change

  1   2   >