Re: [PATCH] Btrfs: make sure fs_info is not null before its field is used in __btrfs_panic

2012-12-08 Thread Li Zefan
On 2012/12/7 23:42, Wang Sheng-Hui wrote: > We should make sure fs_info is not null before we refer to its field. > Add simple check here. Why? Is there any caller passing NULL @fs_info to this function? > > Signed-off-by: Wang Sheng-Hui > --- > fs/btrfs/super.c |2 +- > 1 file changed, 1

Re: [PATCH] btrfs: Return EINVAL when length to trim is less than FSB

2012-10-24 Thread Li Zefan
On 2012/10/24 16:15, Lukáš Czerner wrote: > On Tue, 16 Oct 2012, Lukas Czerner wrote: > >> Date: Tue, 16 Oct 2012 11:34:36 +0200 >> From: Lukas Czerner >> To: linux-btrfs@vger.kernel.org >> Cc: jba...@fusionio.com, Lukas Czerner >> Subject: [PATCH] btrfs: Return EINVAL when length to trim is les

Re: enquiry about defrag

2012-09-10 Thread Li Zefan
> may i ask a stupid question, if i remove my "compress-force=lzo" option, will > compression disabled for new written data? the answer is yes. :) -- 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 a

Re: Tail packing

2012-09-02 Thread Li Zefan
On 2012/9/2 13:25, David Sterba wrote: > On Fri, Aug 31, 2012 at 04:40:36PM +0200, Ben Wreder wrote: >> The disk format description implies that btrfs should be able to >> support tail packing. I just did some experimentation, and while small >> files are packed, it seems that files occupying more

Re: [PATCH v3 1/1] Btrfs: Check INCOMPAT flags on remount and add helper function

2012-07-22 Thread Li Zefan
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index a0ee2f8..3a1a700 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -3103,6 +3103,19 @@ void __btrfs_abort_transaction(struct > btrfs_trans_handle *trans, > struct btrfs_root *root, const char *func

Re: [PATCH] Btrfs: kill free_space pointer from inode structure

2012-07-11 Thread Li Zefan
On 2012/7/11 3:29, Josef Bacik wrote: > On Mon, Jul 09, 2012 at 08:21:07PM -0600, Li Zefan wrote: >> Inodes always allocate free space with BTRFS_BLOCK_GROUP_DATA type, >> which means every inode has the same BTRFS_I(inode)->free_space pointer. >> >> This shrinks str

[PATCH] Btrfs: zero unused bytes in inode item

2012-07-09 Thread Li Zefan
The otime field is not zeroed, so users will see random otime in an old filesystem with a new kernel which has otime support in the future. The reserved bytes are also not zeroed, and we'll have compatibility issue if we make use of those bytes. Signed-off-by: Li Zefan --- fs/btrfs/de

Re: [PATCH] Btrfs: Add code to support file creation time.

2012-07-09 Thread Li Zefan
On 2012/7/5 9:52, Alexander Block wrote: > On Thu, Jul 5, 2012 at 3:07 AM, Li Zefan wrote: >> On 2012/7/4 19:04, Alexander Block wrote: >> >>> On Wed, Jul 4, 2012 at 9:56 AM, Li Zefan wrote: >>>> On 2012/7/4 15:18, chandan r wrote: >>>> &

[PATCH] Btrfs: rewrite BTRFS_SETGET_FUNCS

2012-07-09 Thread Li Zefan
in redunction of ~37K bytes. textdata bss dec hex filename 629661 12489 216 642366 9cd3e fs/btrfs/btrfs.o.orig 592637 12489 216 605342 93c9e fs/btrfs/btrfs.o Signed-off-by: Li Zefan --- fs/btrfs/ctree.h| 53 +++-- fs/btrfs/struct-funcs.c

[PATCH] Btrfs: kill free_space pointer from inode structure

2012-07-09 Thread Li Zefan
Inodes always allocate free space with BTRFS_BLOCK_GROUP_DATA type, which means every inode has the same BTRFS_I(inode)->free_space pointer. This shrinks struct btrfs_inode by 4 bytes (or 8 bytes on 64 bits). Signed-off-by: Li Zefan --- fs/btrfs/btrfs_inode.h |3 --- fs/btrfs/ctre

Re: [PATCH] Btrfs: Add code to support file creation time.

2012-07-04 Thread Li Zefan
On 2012/7/4 19:04, Alexander Block wrote: > On Wed, Jul 4, 2012 at 9:56 AM, Li Zefan wrote: >> On 2012/7/4 15:18, chandan r wrote: >> >>> This patch adds a new member to the 'struct btrfs_inode' structure to hold >>> the file creation time. >>>

Re: [PATCH] Btrfs: Add code to support file creation time.

2012-07-04 Thread Li Zefan
On 2012/7/4 15:18, chandan r wrote: > This patch adds a new member to the 'struct btrfs_inode' structure to hold > the file creation time. > Well, how do users use this file creation time? There's no syscall and there's no ioctl that exports this information. That xstat syscall hasn't been acce

[PATCH] Btrfs: fix incompat flags setting

2012-06-11 Thread Li Zefan
It's a bug, but it happens to work, as BTRFS_COMPRESS_LZO == 2, which has only one bit set. Signed-off-by: Li Zefan --- fs/btrfs/disk-io.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 7ae51de..fe82070 100644 --- a/fs/

[PATCH] Btrfs: fix defrag regression

2012-06-11 Thread Li Zefan
heck to decide if we should defrag the range") The cause is, that commit looked into previous and next extents using lookup_extent_mapping() only. While at it, remove the code that checks the previous extent, since it's sufficient to check the next extent. Signed-off-by: Li Zefan

Re: Make existing snapshots read-only?

2012-05-28 Thread Li Zefan
On 2012/5/29 2:37, Bruce Guenter wrote: > > Is there any way to mark existing snapshots as read-only? Making new > ones read-only is easy enough, but what about existing ones? > We have code in the kernel side, so what we need to do is to update btrfs-progs, which is trivial. -- To unsubscribe

Re: [PATCH 1/2] Btrfs: make clear_extent_bit() always return 0 on success

2012-04-05 Thread Li Zefan
(Note: I've changed my email address ;) David Sterba wrote: > On Mon, Mar 12, 2012 at 04:39:28PM +0800, Li Zefan wrote: >> Currently it returns a set of bits that were cleared, but this return >> value is not used at all. >> >> Moreover it doesn't seem to be

[PATCH 2/2][RESEND] Btrfs: avoid possible use-after-free in clear_extent_bit()

2012-03-12 Thread Li Zefan
he passing extent_state, so clear_extent_bit() may end up referencing freed memory. Signed-off-by: Li Zefan --- no more Chinese characters in this section. ;) --- fs/btrfs/extent_io.c | 36 +--- 1 files changed, 21 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/e

[PATCH 2/2] Btrfs: avoid possible use-after-free in clear_extent_bit()

2012-03-12 Thread Li Zefan
he passing extent_state, so clear_extent_bit() may end up referencing freed memory. Signed-off-by: Li Zefan --- 经过测试,发现clear_state_bit()会在80%的情况下直接把state free掉。所以之前 的比较简单的patch,会在80%的情况下重新goto回去搜索rbtree,会很慢。所以,现在 改成由clear_state_bit()返回下一个state。 --- fs/btrfs/extent_i

[PATCH 1/2] Btrfs: make clear_extent_bit() always return 0 on success

2012-03-12 Thread Li Zefan
Currently it returns a set of bits that were cleared, but this return value is not used at all. Moreover it doesn't seem to be useful, because we may clear the bits of a few extent_states, but only the cleared bits of last one is returned. Signed-off-by: Li Zefan --- fs/btrfs/extent

[PATCH] btrfs: fix locking issues in find_parent_nodes()

2012-02-29 Thread Li Zefan
- We might unlock head->mutex while it was not locked - We might leave the function without unlocking delayed_refs->lock Signed-off-by: Li Zefan --- fs/btrfs/backref.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c

Re: [PATCH] Btrfs: avoid setting ->d_op twice

2012-02-21 Thread Li Zefan
David Sterba wrote: > Hi, > > thanks for the patch! > > On Tue, Feb 21, 2012 at 05:04:28PM +0800, Li Zefan wrote: >> Follow those instructions, and you'll trigger a warning in the >> beginning of d_set_d_op(): >> >> # mkfs.btrfs /dev/loop3 >>

[PATCH] Btrfs: avoid setting ->d_op twice

2012-02-21 Thread Li Zefan
lloc() set d_op to sb->s_d_op (btrfs_dentry_operations), and then simple_lookup() reset it to simple_dentry_operations, which triggered the warning. Signed-off-by: Li Zefan --- fs/btrfs/inode.c | 14 +- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/inode

Re: Problems Implementing Snappy Patches

2012-02-15 Thread Li Zefan
Mitch Harder wrote: > I've been trying to test the snappy compression patches, but I'm > getting corruptions when trying to use snappy as built on my system. > > I'm checking out the Linux 3.2.6 kernel, merging that with the latest > 'for-linus' branch on Chris Mason's kernel.org repo, and then >

Re: [PATCH 12/12] Btrfs: Fix file clone when source offset is not 0

2012-02-01 Thread Li Zefan
Yan, Zheng wrote: > On Thu, Jan 27, 2011 at 4:46 PM, Li Zefan wrote: >> Suppose: >> - the source extent is: [0, 100] >> - the src offset is 10 >> - the clone length is 90 >> - the dest offset is 0 >> >> This statement: >> >>new_k

Re: [PATCH 12/12] Btrfs: Fix file clone when source offset is not 0

2012-02-01 Thread Li Zefan
Jan Schmidt wrote: > On 30.01.2012 07:33, Li Zefan wrote: >> Jan Schmidt wrote: >>> I was looking at the clone range ioctl and have some remarks: >>> >>> On 27.01.2011 09:46, Li Zefan wrote: >>>> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c

Re: [PATCH] Btrfs: allow cloning ranges within the same file

2012-02-01 Thread Li Zefan
>> It's safe and easy to do so, provided the ranges don't overlap. >> >> Signed-off-by: Li Zefan >> --- >> fs/btrfs/ioctl.c | 23 --- >> 1 files changed, 16 insertions(+), 7 deletions(-) >> >> diff --git a/fs/btrfs/i

[PATCH] Btrfs: allow cloning ranges within the same file

2012-01-30 Thread Li Zefan
It's safe and easy to do so, provided the ranges don't overlap. Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c | 23 --- 1 files changed, 16 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0b06a5c..8fcd671 100644 --- a/fs/btr

Re: Setting options permanently?

2012-01-29 Thread Li Zefan
> Is there a way to set options like compression on a btrfs permanently to > activate them even when mounted automatically by the desktop or manually > by a third person? Actually there is. Btrfs supports per file compression flag, and if this flag is set to a directory, all files in that directo

Re: [PATCH 12/12] Btrfs: Fix file clone when source offset is not 0

2012-01-29 Thread Li Zefan
Jan Schmidt wrote: > I was looking at the clone range ioctl and have some remarks: > > On 27.01.2011 09:46, Li Zefan wrote: >> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c >> index f87552a..1b61dab 100644 >> --- a/fs/btrfs/ioctl.c >> +++ b/fs/btrfs/ioctl.c

Re: Setting options permanently?

2012-01-29 Thread Li Zefan
>> I currently don't see how to repair this afterwards without removing the >> uncompressed files and writing new ones, which on the other hand spoils >> hte memory saving effect of using snapshots instead of copies. > > A rebalance is the usual way of handling such things, since that rewrites >

Re: btrfs-raid questions I couldn't find an answer to on the wiki

2012-01-29 Thread Li Zefan
Goffredo Baroncelli wrote: > On Thursday, 26 January, 2012 16:41:32 Duncan wrote: >> 1) My /boot partition and its backup (which I do want to keep separate >> from root) are only 128 MB each. The wiki recommends 1 gig sizes >> minimum, but there's some indication that's dated info due to mixed d

Re: Updated btrfs/crypto snappy interface ready for merging

2012-01-17 Thread Li Zefan
Andi Kleen wrote: >> It's because decompressing inline extents always fails. I've fixed it >> and will send the patch out in a new mail thread. > > Thanks for fixing. > >> >> But seems there's bug in lib snappy code, which makes the decompressed >> data doesn't quite match the original data. >> >

[PATCH] Btrfs: fix decompressing of snappy-compressed inline extents

2012-01-17 Thread Li Zefan
The first four bytes is the length of all data chunks, and the first four bytes of each chunk is the length of compressed chunk data, even when there's only one chunk, which is the case for inline extents. Signed-off-by: Li Zefan --- fs/btrfs/snappy.c |4 1 files changed, 4 inser

Re: Updated btrfs/crypto snappy interface ready for merging

2012-01-17 Thread Li Zefan
Andi Kleen wrote: >> It's because decompressing inline extents always fails. I've fixed it >> and will send the patch out in a new mail thread. > > Thanks for fixing. > >> >> But seems there's bug in lib snappy code, which makes the decompressed >> data doesn't quite match the original data. >> >

Re: Updated btrfs/crypto snappy interface ready for merging

2012-01-17 Thread Li Zefan
21:54, Chris Mason wrote: > On Thu, Jan 12, 2012 at 04:28:47PM -0800, Andi Kleen wrote: >> Here's a slightly updated version of the BTRFS snappy interface. >> snappy is a faster compression algorithm that provides similar >> compression as LZO, but generally better performance. > > Thanks Andi, I'

[PATCH] Btrfs: fix incompat flags setting

2012-01-16 Thread Li Zefan
g was set, though we didn't mount with snappy enabled. Signed-off-by: Li Zefan --- This patch is for the snappy branch. --- fs/btrfs/disk-io.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 5924163..27101e4 10064

Re: [PATCH] Btrfs: do not defrag a file partially

2012-01-16 Thread Li Zefan
d-off-by: Liu Bo Reviewed-by: Li Zefan > --- > fs/btrfs/ioctl.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) -- 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 04/11] Btrfs: remove BUG_ON()s in btrfs_ioctl_setflags()

2012-01-10 Thread Li Zefan
We can recover from errors and return -errno to user space. Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c | 18 ++ 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c04f02c..9619fb0 100644 --- a/fs/btrfs/ioctl.c +++ b/fs

[PATCH 07/11] Btrfs: don't pre-allocate btrfs bio

2012-01-10 Thread Li Zefan
We pre-allocate a btrfs bio with fixed size, and then may re-allocate memory if we find stripes are bigger than the fixed size. But this pre-allocation is not necessary. Also we don't have to calcuate the stripe number twice. Signed-off-by: Li Zefan --- fs/btrfs/volumes.c |

[PATCH 01/11] Btrfs: add pinned extents to on-disk free space cache correctly

2012-01-10 Thread Li Zefan
than the start of the block group. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c | 41 - 1 files changed, 20 insertions(+), 21 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index ec23d43..01840ef 100644 ---

[PATCH 06/11] Btrfs: don't pass a trans handle unnecessarily in volumes.c

2012-01-10 Thread Li Zefan
Some functions never use the transaction handle passed to them. Signed-off-by: Li Zefan --- fs/btrfs/extent-tree.c |2 +- fs/btrfs/volumes.c | 18 +++--- fs/btrfs/volumes.h |3 +-- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent

[PATCH 02/11] Btrfs: avoid possible NULL deref in io_ctl_drop_pages()

2012-01-10 Thread Li Zefan
If we run into some failure path in io_ctl_prepare_pages(), io_ctl->pages[] array may have some NULL pointers. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/f

[PATCH 00/11] Btrfs: some patches for 3.3

2012-01-10 Thread Li Zefan
ll confict with Al Viro's vfs changes. Li Zefan (11): Btrfs: add pinned extents to on-disk free space cache correctly Btrfs: avoid possible NULL deref in io_ctl_drop_pages() Btrfs: check the return value of io_ctl_init() Btrfs: remove BUG_ON()s in btrfs_ioctl_setflag

[PATCH 03/11] Btrfs: check the return value of io_ctl_init()

2012-01-10 Thread Li Zefan
It can return -ENOMEM. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 4e55af3..e4eb222 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs

[PATCH 05/11] Btrfs: reserve metadata space in btrfs_ioctl_setflags()

2012-01-10 Thread Li Zefan
Check and reserve space for btrfs_update_inode(). Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9619fb0..fe8a60c 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -254,7

[PATCH 11/11] Btrfs: fix possible deadlock when opening a seed device

2012-01-10 Thread Li Zefan
evices(); lock(uuid_mutex); and then we hit a lockdep splat. Signed-off-by: Li Zefan --- fs/btrfs/disk-io.c |2 -- fs/btrfs/volumes.c |9 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 3f9d555..858ab34

[PATCH 10/11] Btrfs: update global block_rsv when creating a new block group

2012-01-10 Thread Li Zefan
space in the filesystem. Afterwards we add a sprout device to it, and the kernel creates a METADATA block group and a SYSTEM block group where comes free space we can reserve, but we still get revervation failure because the global block_rsv hasn't been updated accordingly. Signed-off-by

[PATCH 09/11][RESEND] Btrfs: rewrite btrfs_trim_block_group()

2012-01-10 Thread Li Zefan
/mnt Data: total=3.58GB, used=1.79GB System, DUP: total=8.00MB, used=4.00KB System: total=4.00MB, used=0.00 Metadata, DUP: total=205.12MB, used=97.14MB Metadata: total=8.00MB, used=0.00 Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c | 235

[PATCH 08/11] Btrfs: simplfy calculation of stripe length for discard operation

2012-01-10 Thread Li Zefan
dev2 dev3(raid0) --- s0 s3 s6 s1 s4 s7 s2 s5 Each device has (total_stripes / nr_dev) stripes, or plus one. Signed-off-by: Li Zefan --- fs/btrfs/volumes.c | 95 +--

Re: Crash in io_ctl_drop_pages after mount with csum errors

2012-01-05 Thread Li Zefan
David Sterba wrote: > I mounted a multi-folume fs created not-so-long ago in a 3.1 based > kernel and mounted with v3.2-rc7-83-g115e8e7 , it crashed immediately. > It's quite possible that the disk is to blame, it's an old 160G > SP1614C, but syslog does not contain any error messages. I'm not sure

Re: btrfs truncate() does not change inode times

2012-01-05 Thread Li Zefan
idank wrote: > Hi all, > I was running fstest (http://www.tuxera.com/community/posix-test-suite/) on > btrfs. Only one test failed, and I believe it to be a bug in btrfs. The > scenario is as follows: > * crate a file. > * note its times with stat. > * sleep a few seconds > * call truncate() on t

Re: [PATCH v2 00/10] Btrfs: backref walking rewrite

2012-01-04 Thread Li Zefan
Jan Schmidt wrote: > This patch series is a major rewrite of the backref walking code. The patch > series Arne sent some weeks ago for quota groups had a very interesting > function, find_all_roots. I took this from him together with the bits needed > for find_all_roots to work and replaced a major

Re: fstrim on BTRFS

2011-12-29 Thread Li Zefan
Fajar A. Nugraha wrote: > On Thu, Dec 29, 2011 at 4:39 PM, Li Zefan wrote: >> Fajar A. Nugraha wrote: >>> On Wed, Dec 28, 2011 at 11:57 PM, Martin Steigerwald >>> wrote: >>>> But BTRFS does not: >>>> >>>> merkaba:~> fstrim -v

[PATCH 3/3] Btrfs: save trimmed flag onto disk

2011-12-29 Thread Li Zefan
/: 152240128 bytes were trimmed Because caches for block groups smaller than 100M will not be written to disk, we'll still have to trim them. Signed-off-by: Li Zefan --- fs/btrfs/ctree.h|1 + fs/btrfs/free-space-cache.c | 19 --- 2 files changed, 17 insertions(

[PATCH 2/3] Btrfs: speed up fstrim

2011-12-29 Thread Li Zefan
By remembering which areas has been trimmed, we can speed up fstrim significantly. # fstrim -v /mnt/ /mnt/: 152772608 bytes were trimmed # fstrim -v /mnt/ /mnt/: 0 bytes were trimmed No bytes has to be trimmed for the second run. Signed-off-by: Li Zefan --- fs/btrfs/extent

[PATCH 1/3][URGENT] Btrfs: allow future use of type field of struct btrfs_free_space_entry

2011-12-29 Thread Li Zefan
This field indicates if an entry is an extent or a bitmap, and only 2 bits of it are used. This patch makes the other bits are avaiable for future use without breaking old kernels. For example, we're going to use one bit to mark if the free space has been trimmed. Signed-off-by: Li

[RFC][PATCH 0/3] Btrfs: speed up fstrim

2011-12-29 Thread Li Zefan
(This patchset is not for merge or review, except the first patch) By remembering which areas have been trimmed, we can speed up fstrim significantly. # fstrim -v /mnt/ /mnt/: 152772608 bytes were trimmed # fstrim -v /mnt/ /mnt/: 0 bytes were trimmed To implement this, after a fr

Re: fstrim on BTRFS

2011-12-29 Thread Li Zefan
Fajar A. Nugraha wrote: > On Wed, Dec 28, 2011 at 11:57 PM, Martin Steigerwald > wrote: >> But BTRFS does not: >> >> merkaba:~> fstrim -v / >> /: 4431613952 bytes were trimmed >> merkaba:~> fstrim -v / >> /: 4341846016 bytes were trimmed > > and apparently it can't trim everything. Or maybe

Re: fstrim on BTRFS

2011-12-28 Thread Li Zefan
Martin Steigerwald wrote: > Hi! > > With 3.2-rc4 (probably earlier), Ext4 seems to remember what areas it > trimmed: > > merkaba:~> fstrim -v /boot > /boot: 224657408 bytes were trimmed > merkaba:~> fstrim -v /boot > /boot: 0 bytes were trimmed > > > But BTRFS does not: > > merkaba:~> fstrim

[PATCH] xfstests: add a new test to verify on disk ctime update for chattr

2011-12-21 Thread Li Zefan
We had a bug in btrfs which can be triggered by this test. Signed-off-by: Li Zefan --- 277 | 71 +++ 277.out |1 + group |1 + 3 files changed, 73 insertions(+), 0 deletions(-) create mode 100755 277 create mode

Re: Consistent crash with cp reflink on large files

2011-12-12 Thread Li Zefan
Nik Markovic wrote: > Li Zefan wrote: >> >> Nik Markovic wrote: >>> Hi All, >>> >>> I have been encountering consistent btrfs filesystem crashes when >>> using cp –reflink=always on a large file and modifying it. I believe >>> that

Re: Consistent crash with cp reflink on large files

2011-12-12 Thread Li Zefan
Nik Markovic wrote: > Hi All, > > I have been encountering consistent btrfs filesystem crashes when > using cp –reflink=always on a large file and modifying it. I believe > that the test file needs to be fairly large as I was not able to > reproduce with smaller files. The filesystem size is 45GB

Re: [PATCH] btrfs: change resize ioctl to take device path instead of id

2011-12-11 Thread Li Zefan
Phillip Susi wrote: > The resize ioctl took an optional argument that was a string > representation of the devid which you wish to resize. For > the sake of consistency with the other ioctls that take a > device argument, I converted this to take a device path instead > of a devid number, and look

Re: BUG during btrfs device delete missing

2011-12-10 Thread Li Zefan
>>> On Thu, Dec 08, 2011 at 11:06:47AM -0800, David Marcin wrote: raid10 metadata and data filesystem. dmesg log follows. The system is unable to unmount the filesystem after this occurs. Filesystem mounted at/mnt/btrfs with -o compress,degraded Command: btrfs device dele

Re: [PATCH] Btrfs: fix ctime update of on-disk inode

2011-12-08 Thread Li Zefan
Christoph Hellwig wrote: > On Fri, Dec 09, 2011 at 09:40:35AM +0800, Li Zefan wrote: >> To reproduce the bug: >> >> # touch /mnt/tmp >> # stat /mnt/tmp | grep Change >> Change: 2011-12-09 09:32:23.412105981 +0800 >> # chattr +i /mnt/t

[PATCH] Btrfs: fix ctime update of on-disk inode

2011-12-08 Thread Li Zefan
| grep Change Change: 2011-12-09 09:32:23.412105981 +0800 We should update ctime of in-memory inode before calling btrfs_update_inode(). Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs

[PATCH] Btrfs: fix possible deadlock when opening a seed device

2011-12-06 Thread Li Zefan
evices(); lock(uuid_mutex); and then we hit a lockdep splat. Signed-off-by: Li Zefan --- fs/btrfs/disk-io.c |2 -- fs/btrfs/volumes.c |9 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 94abc25..b2d103f

[PATCH] Btrfs: update global block_rsv when creating a new block group

2011-12-06 Thread Li Zefan
space in the filesystem. Afterwards we add a sprout device to it, and the kernel creates a METADATA block group and a SYSTEM block group where comes free space we can reserve, but we still get revervation failure because the global block_rsv hasn't been updated accordingly. Signed-off-by

Re: [PATCH 00/20] Here's my current btrfs patchset

2011-11-28 Thread Li Zefan
Alexandre Oliva wrote: > The first 11 patches are relatively simple fixes or improvements that > I suppose go could make it even in 3.2 (02 is particularly essential > to avoid progressive performance degradation and metadata space waste > in the default clustered allocation strategy). > I think

Re: [PATCH 1/1] btrfs: btrfs_calc_avail_data_space cope with no read/write devices V2

2011-11-28 Thread Li Zefan
Andy Whitcroft wrote: > On Mon, Nov 28, 2011 at 06:11:06AM -0600, Jonathan Nieder wrote: >> Hi, >> >> Andy Whitcroft wrote: >> >>> When we mount a btrfs filesystem from read-only media there will be no >>> read/write devices; for example mounting an SD card with its lock enabled. >>> This triggers

[PATCH] Btrfs: check if the to-be-added device is writable

2011-11-28 Thread Li Zefan
igned-off-by: Li Zefan --- fs/btrfs/volumes.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c37433d..0a8c8f8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1611,7 +1611,7 @@ int btrfs_init_new_device(s

[PATCH] Btrfs: fix oops when calling statfs on readonly device

2011-11-28 Thread Li Zefan
: # df -h /dev/loop1 FilesystemSize Used Avail Use% Mounted on /dev/loop1250M 28K 238M 1% /mnt Signed-off-by: Li Zefan --- fs/btrfs/super.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index

[PATCH v2] Btrfs: rewrite btrfs_trim_block_group()

2011-11-24 Thread Li Zefan
trim extents only, and the other is to trim bitmaps only. Signed-off-by: Li Zefan --- v2: fix possible uninitialized return value --- fs/btrfs/free-space-cache.c | 235 ++- 1 files changed, 164 insertions(+), 71 deletions(-) diff --git a/fs/btrfs/free

Re: [PATCH] Btrfs: rewrite btrfs_trim_block_group()

2011-11-23 Thread Li Zefan
David Sterba wrote: > On Thu, Nov 17, 2011 at 03:26:17PM +0800, Li Zefan wrote: >> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c >> index 8c32434..89cc54e 100644 >> --- a/fs/btrfs/free-space-cache.c >> +++ b/fs/btrfs/free-space-cache.c >>

[PATCH v2] 254: avoid output mismatch due to space cache

2011-11-21 Thread Li Zefan
will have. Signed-off-by: Li Zefan --- 254 |4 ++-- 254.out |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/254 b/254 index 1cd4832..7b74a02 100755 --- a/254 +++ b/254 @@ -48,7 +48,7 @@ _supported_os Linux _require_scratch _scratch_mkfs > /

Re: [PATCH] 254: disable space cache

2011-11-20 Thread Li Zefan
Hidetoshi Seto wrote: > (2011/11/18 17:43), Li Zefan wrote: >> I can't pass 254, and below is the output: >> >> 254 3s ... - output mismatch (see 254.out.bad) >> ... >> ID 256 top level 5 path snap >> -ID 257 top level 5 path subvol >> +ID 258

[PATCH] 254: disable space cache

2011-11-18 Thread Li Zefan
es in the root tree, and they consume some IDs, and that's why "subvol" has the ID 258 but not 257. Just disable space cache for this test case. Signed-off-by: Li Zefan --- 254 |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/254 b/254 index 5216120..1cd4

[PATCH] 254: fix to pass subvolid=0 to set default btrfs subvolme

2011-11-17 Thread Li Zefan
The usage is 'btrfs subvolume set-default ', not ' '. The code happens to work because strotoull(path) returns 0, but it will fail if in the future we check the argument more strict in btrfs-progs. Signed-off-by: Li Zefan --- 254 |4 ++-- 1 files changed, 2 insert

[PATCH] Btrfs: rewrite btrfs_trim_block_group()

2011-11-16 Thread Li Zefan
trim extents only, and the other is to trim bitmaps only. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c | 235 ++- 1 files changed, 164 insertions(+), 71 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index

[PATCH v2 1/2] Btrfs: fix to search one more bitmap for cluster setup

2011-11-16 Thread Li Zefan
itmap [0, 256]. The cause is, the list is constructed in setup_cluster_no_bitmap(), and only bitmaps with bitmap_entry->offset >= offset will be added into the list, and the very bitmap that convers offset has bitmap_entry->offset <= offset. Signed-off-by: Li Zefan --- v2: fix a N

[PATCH 2/2] Btrfs: avoid unnecessary bitmap search for cluster setup

2011-11-15 Thread Li Zefan
setup_cluster_no_bitmap() searches all the extents and bitmaps starting from offset. Therefore if it returns -ENOSPC, all the bitmaps starting from offset are in the bitmaps list, so it's sufficient to search from this list in setup_cluser_bitmap(). Signed-off-by: Li Zefan --- fs/btrfs

[PATCH 1/2] Btrfs: fix to search one more bitmap for cluster setup

2011-11-15 Thread Li Zefan
ways set offset=0 when calling btrfs_find_space_cluster(), but it may change in the future, for example to improve for SSD_SPREAD. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/free-space-cache.

Re: [PATCH v8 1/8] btrfs: added helper functions to iterate backrefs

2011-11-02 Thread Li Zefan
(as this is going to be merged into mainline..) > +/* > + * calls iterate() for every inode that references the extent identified by > + * the given parameters. will use the path given as a parameter and return it > + * released. > + * when the iterator function returns a non-zero value, iteration

Re: btrfs fi defrag -c

2011-10-27 Thread Li Zefan
> When the FS is mounted with compress: > > ~# mkfs.btrfs ./a > nodesize 4096 leafsize 4096 sectorsize 4096 size 2.00GB > ~# mount -o compress ./a /mnt/1 > ~# cd /mnt/1 > /mnt/1# yes | head -c400M > a > /mnt/1# sync > /mnt/1# df -h . > Filesystem Size Used Avail Use% Mounted on > /de

Re: btrfs fi defrag -c

2011-10-27 Thread Li Zefan
Stephane Chazelas wrote: > I don't quite understand the behavior of "btrfs fi defrag" > > ~# truncate -s2G ~/a > ~# mkfs.btrfs ~/a > nodesize 4096 leafsize 4096 sectorsize 4096 size 2.00GB > ~# mount -o loop ~/a /mnt/1 > /mnt/1# cd x > /mnt/1# df -h . > Filesystem Size Used Avail Use

Re: [PATCH 1/4] Btrfs: fix defragmentation regression

2011-10-18 Thread Li Zefan
16:48, Dan Merillat wrote: > On Fri, Sep 2, 2011 at 4:42 AM, Christoph Hellwig wrote: >> On Fri, Sep 02, 2011 at 03:56:25PM +0800, Li Zefan wrote: >>> There's an off-by-one bug: >>> >>> # create a file with lots of 4K file extents >>> # btrfs

Re: defrag makes fragmentation worse

2011-10-11 Thread Li Zefan
You can try it out: http://marc.info/?l=linux-btrfs&m=131495014823121&w=2 With this bug fixed, I think autodefrag won't be problematic. -- Li Zefan -- 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

Re: defrag makes fragmentation worse

2011-10-10 Thread Li Zefan
Chester wrote: > Kernel 3.1-rc8 > btrfs-progs-0.19 > mount options: noatime,autodefrag (space_cache is enabled) > There are snapshots present on the filesystem. > > When I do a btrfs fi defrag on a file, the file becomes much more > fragmented. The end result can be a file with 20k times more frag

[PATCH] Btrfs: fix recursive auto-defrag

2011-10-05 Thread Li Zefan
s [8K, 200K] and then writes [0, 8K]. I tried to make writeback know if the pages are dirtied by defrag, but the patch was a bit intrusive. Here I simply set writeback_index when we defrag a file. Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c |7 +++ 1 files changed, 7 insertions(+), 0 de

Re: File compression control, again.

2011-09-27 Thread Li Zefan
01:17, Artem worte: > Hi! > > So, it makes sense to keep the compression on by default > and with LZO many people are going there. > > But, I want to create a database on a compressed btrfs filesystem > which is seek-heavy rather than throughput-heavy > and I really want to turn the compression o

Re: kernel bug

2011-09-25 Thread Li Zefan
Roman Kapusta wrote: > Segfault and kernel bug after reflinking several files (20-30 files) > each of size around 1GB through following command: > > cp -r --reflink sorce_dir . > Segmentation fault > > I'm on Fedora 15, kernel 3.0.4 This has been fixed in Linux 3.1-rc7. -- To unsubscribe from t

Re: Inefficient storing of ISO images with compress=lzo

2011-09-19 Thread Li Zefan
07:06, Maciej Marcin Piechotka wrote: > On Mon, 2011-09-19 at 10:53 +0800, Li Zefan wrote: >> Maciej Marcin Piechotka wrote: >>> I've noticed that: >>> >>> - with x86-64 Fedora 15 DVD install images: >>>- du -sh was 36 GB >>&

Re: Inefficient storing of ISO images with compress=lzo

2011-09-18 Thread Li Zefan
Li Zefan wrote: > Maciej Marcin Piechotka wrote: >> I've noticed that: >> >> - with x86-64 Fedora 15 DVD install images: >>- du -sh was 36 GB >>- btrfs df | grep -i data have shown over 40 GB used >> - without >>- du -sh is 34 GB &g

Re: [PATCH] Btrfs: fix pages truncation in btrfs_ioctl_clone()

2011-09-18 Thread Li Zefan
ocks > cloner: locks extent, clones, unlocks extent > (besides Chris' comments) How can we avoid the race on dst file by locking src file extent state.. -- Li Zefan -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord

Re: Inefficient storing of ISO images with compress=lzo

2011-09-18 Thread Li Zefan
e marked as uncompressable. I just tried with Fedora-14-i386-DVD.iso, and the first 896K is compressed, with a compress ratio about 71.7%, and the remaining data is not compressed. -- Li Zefan -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a messa

[PATCH] Btrfs: fix pages truncation in btrfs_ioctl_clone()

2011-09-16 Thread Li Zefan
It's a bug in commit f81c9cdc567cd3160ff9e64868d9a1a7ee226480 (Btrfs: truncate pages from clone ioctl target range) We should pass the dest range to the truncate function, but not the src range. Also move the function before locking extent state. Signed-off-by: Li Zefan --- fs/btrfs/io

Re: [PATCH 1/2] Btrfs: don't make a file partly checksummed through file clone

2011-09-15 Thread Li Zefan
David Sterba wrote: > On Wed, Sep 14, 2011 at 01:25:21PM +0800, Li Zefan wrote: >> It's because part of the file is checksummed and the other part is not, >> and then btrfs will complain checksum is not found when we read the file. >> >> Disallow file clone if

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

2011-09-13 Thread Li Zefan
14:06, Jeff Liu wrote: > Signed-off-by: Jie Liu > > --- > 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 +40

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

2011-09-13 Thread Li Zefan
The dst file will have the same inode flags with dst file after file clone, and I think it's unexpected. For example, the dst file will suddenly become immutable after getting some share of data with src file, if the src is immutable. Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c |1

[PATCH 1/2] Btrfs: don't make a file partly checksummed through file clone

2011-09-13 Thread Li Zefan
src and dst file have different checksum flag, so we ensure a file is completely checksummed or unchecksummed. Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 970977a..dc82bbb 100644

  1   2   3   4   >