Re: [PATCH] btrfs: zero out delayed node upon allocation

2015-10-25 Thread Alexandru Moise
On Sun, Oct 25, 2015 at 01:33:45PM -0400, Jeff Mahoney wrote: > > On Oct 25, 2015, at 3:50 PM, Alexandru Moise <00moses.alexande...@gmail.com> > wrote: > > >>> This allows us to trim out half of btrfs_init_delayed_node() which > >>> i

Re: [PATCH] btrfs: zero out delayed node upon allocation

2015-10-25 Thread Alexandru Moise
> > This allows us to trim out half of btrfs_init_delayed_node() which > > is now reduntant. > > It's redundant if kmem_cache_zalloc is used, but you haven't > documented that doing so is now required. For all of these changes > you've posted, if they're to be accepted, I'd really prefer to set

[PATCH v2] btrfs: zero out delayed node upon allocation

2015-10-25 Thread Alexandru Moise
It's slightly cleaner to zero-out the delayed node upon allocation than to do it by hand in btrfs_init_delayed_node() for a few members Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- v2: Thanks Jeff Mahoney for pointing out the mistake of removing the atomic_set

[PATCH] btrfs: zero out delayed node upon allocation

2015-10-25 Thread Alexandru Moise
This allows us to trim out half of btrfs_init_delayed_node() which is now reduntant. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/delayed-inode.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/d

[PATCH] btrfs: pass proper enum type to start_transaction()

2015-10-25 Thread Alexandru Moise
Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/transaction.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index a5b0644..cb50f53 100644 --- a/fs/btrfs/transaction.c +++ b/fs

[PATCH] btrfs: switch __btrfs_fs_incompat return type from int to bool

2015-10-18 Thread Alexandru Moise
Conform to __btrfs_fs_incompat() cast-to-bool (!!) by explicitly returning boolean not int. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/ctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 9

Re: [PATCH] btrfs: remove unneeded NULL initializer for struct fs_path

2015-09-29 Thread Alexandru Moise
On Tue, Sep 29, 2015 at 02:32:29PM +0200, David Sterba wrote: > On Sat, Sep 26, 2015 at 12:05:19PM +0000, Alexandru Moise wrote: > > fs_path_alloc() either returns an alloc'ed struct fs_path > > or NULL, no need to initialize the pointer to NULL. > > > > Sig

[PATCH v2 1/2] btrfs: change num_items type from u64 to unsigned int

2015-09-22 Thread Alexandru Moise
The value of num_items that start_transaction() ultimately always takes is a small one, so a 64 bit integer is overkill. Also change num_items for btrfs_start_transaction() and btrfs_start_transaction_lflush() as well. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com>

[PATCH v2 2/2] btrfs: declare rsv_count as unsigned int instead of int

2015-09-22 Thread Alexandru Moise
rsv_count ultimately gets passed to start_transaction() which now takes an unsigned int as its num_items parameter. The value of rsv_count should always be positive so declare it as being unsigned. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- v2: followed dave's sugge

[PATCH v2] btrfs: cleanup btrfs_balance profile validity checks

2015-09-22 Thread Alexandru Moise
Improve readability by generalizing the profile validity checks. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- v2: Followed Dave's suggestion and renamed function to validate_convert_profile instead of balance_relocate_invalid fs/btrfs/volumes.

Re: [PATCH] btrfs: memset cur_trans->delayed_refs to zero

2015-09-22 Thread Alexandru Moise
On Tue, Sep 22, 2015 at 03:04:54PM +0200, David Sterba wrote: > On Mon, Sep 07, 2015 at 05:24:37PM +0300, Alexandru Moise wrote: > > Use memset() to null out the btrfs_delayed_ref_root of > > btrfs_transaction instead of setting all the members to 0 by hand. > > > > Sig

Re: [PATCH 1/2] btrfs: avoid passing int param to start_transaction which takes u64

2015-09-22 Thread Alexandru Moise
On Tue, Sep 22, 2015 at 03:09:33PM +0200, David Sterba wrote: > On Sun, Sep 13, 2015 at 06:47:20PM +0000, Alexandru Moise wrote: > > Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> > > --- > > v2: Forgot to add transaction.h when I made the com

[PATCH 1/2] btrfs: avoid passing int param to start_transaction which takes u64

2015-09-13 Thread Alexandru Moise
Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8f259b3..8a83acd 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transac

[PATCH 2/2] btrfs: declare rsv_count as u64 instead of int

2015-09-13 Thread Alexandru Moise
This patch completes the 2-patches patch series which modifies btrfs_start_transaction() to receive an u64 as its "num_items" parameter thus avoiding to pass an int to start_transaction() which actually takes an u64. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com&g

[PATCH 1/2] btrfs: avoid passing int param to start_transaction which takes u64

2015-09-13 Thread Alexandru Moise
Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- v2: Forgot to add transaction.h when I made the commit, many thanks Holger for pointing it out. fs/btrfs/transaction.c | 2 +- fs/btrfs/transaction.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs

Re: [PATCH 1/2] btrfs: avoid passing int param to start_transaction which takes u64

2015-09-13 Thread Alexandru Moise
On Sun, Sep 13, 2015 at 02:53:14PM +, Holger Hoffstätte wrote: > On Sun, 13 Sep 2015 14:29:41 +0000, Alexandru Moise wrote: > > > Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> > > --- > > fs/btrfs/transaction.c | 2 +- > > 1 file

Re: [PATCH 1/2] btrfs: avoid passing int param to start_transaction which takes u64

2015-09-13 Thread Alexandru Moise
On Sun, Sep 13, 2015 at 02:53:14PM +, Holger Hoffstätte wrote: > On Sun, 13 Sep 2015 14:29:41 +0000, Alexandru Moise wrote: > > > Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> > > --- > > fs/btrfs/transaction.c | 2 +- > > 1 file

[PATCH] btrfs: use a single if() statement for one outcome in get_block_rsv()

2015-09-08 Thread Alexandru Moise
Rather than have three separate if() statements for the same outcome we should just OR them together in the same if() statement. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/extent-tree.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff

Re: [PATCH] btrfs: memset cur_trans->delayed_refs to zero

2015-09-07 Thread Alexandru Moise
On Mon, Sep 07, 2015 at 02:24:20PM +0200, David Sterba wrote: > On Sun, Sep 06, 2015 at 12:25:27PM +0000, Alexandru Moise wrote: > > Use memset() to null out the btrfs_delayed_ref_root of > > btrfs_transaction instead of setting all the members to 0 by hand. > > > > Sig

[PATCH] btrfs: memset cur_trans->delayed_refs to zero

2015-09-07 Thread Alexandru Moise
Use memset() to null out the btrfs_delayed_ref_root of btrfs_transaction instead of setting all the members to 0 by hand. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/transaction.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --gi

Re: [PATCH] btrfs: memset cur_trans->delayed_refs to zero

2015-09-07 Thread Alexandru Moise
On Mon, Sep 07, 2015 at 04:01:22PM +0200, David Sterba wrote: > So, updated patches should mention that in the subject eg: > > [PATCH v2] btrfs: memset cur_trans->delayed_refs to zero > > On Mon, Sep 07, 2015 at 04:45:02PM +0300, Alexandru Moise wrote: > >

[PATCH] btrfs: memset cur_trans->delayed_refs to zero

2015-09-07 Thread Alexandru Moise
Use memset() to null out the btrfs_delayed_ref_root of btrfs_transaction instead of setting all the members to 0 by hand. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- Rather than setting each member of ->delayed_refs by hand we should adhere to the practice of usi

[PATCH] btrfs: memset cur_trans->delayed_refs to zero

2015-09-06 Thread Alexandru Moise
Use memset() to null out the btrfs_delayed_ref_root of btrfs_transaction instead of setting all the members to 0 by hand. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/transaction.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --gi

Re: [PATCH] btrfs: Remove unneeded cast to s64 for qgroup rfer state

2015-08-31 Thread Alexandru Moise
On Mon, Aug 31, 2015 at 09:44:49AM +0800, Qu Wenruo wrote: > >>>From the perspective of users, qgroup's referenced or exclusive > >>is negative,but user can not continue to write data! a workaround > >>way is to cast u64 to s64 when doing qgroup reservation > > > >I am unable to

Re: [PATCH] btrfs: Remove unneeded cast to s64 for qgroup rfer state

2015-08-31 Thread Alexandru Moise
On Mon, Aug 31, 2015 at 02:51:08PM +0800, Qu Wenruo wrote: > > > Alexandru Moise wrote on 2015/08/31 09:32 +0300: > >On Mon, Aug 31, 2015 at 09:44:49AM +0800, Qu Wenruo wrote: > >>>>>From the perspective of users, qgroup's referenced or exclusive &

[PATCH] btrfs: cleanup btrfs_balance profile validity checks

2015-08-30 Thread Alexandru Moise
Improve readability by generalizing the profile validity checks, I had to read through those if statements half a dozen times on my first try just to get an idea of what's happening there. Signed-off-by: Alexandru Moise 00moses.alexande...@gmail.com --- fs/btrfs/volumes.c | 21

[PATCH] btrfs: Remove unneeded cast to s64 for qgroup rfer state

2015-08-29 Thread Alexandru Moise
can not continue to write data! a workaround way is to cast u64 to s64 when doing qgroup reservation I am unable to reproduce this problem without his modification. I could be wrong in reverting this, so I'm gonna CC Wang as well so he is aware of this patch. Signed-off-by: Alexandru Moise

Re: [PATCH] btrfs: trimming some start_transaction() code away

2015-08-28 Thread Alexandru Moise
On Fri, Aug 28, 2015 at 07:38:56PM +0200, David Sterba wrote: On Thu, Aug 27, 2015 at 11:53:45PM +, Alexandru Moise wrote: Just call kmem_cache_zalloc() instead of calling kmem_cache_alloc(). We're just initializing most fields to 0, false and NULL later on _anyway_, so to make the code

[PATCH] btrfs: trimming some start_transaction() code away

2015-08-27 Thread Alexandru Moise
on allocation then just initialize those five remaining fields (not counting the list_heads) as normal. Signed-off-by: Alexandru Moise 00moses.alexande...@gmail.com --- fs/btrfs/transaction.c | 15 +-- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/fs/btrfs

[PATCH] btrfs: Fixed declaration of old_len

2015-08-24 Thread Alexandru Moise
old_len is used to store the return value of btrfs_item_size_nr(). The return value of btrfs_item_size_nr() is of type u32. To improve code correctness and avoid mixing signed and unsigned integers I've changed old_len to be of type u32 as well. Signed-off-by: Alexandru Moise 00moses.alexande

[PATCH] btrfs: Fixed dsize and last_off declarations

2015-08-23 Thread Alexandru Moise
The return values of btrfs_item_offset_nr and btrfs_item_size_nr are of type u32. To avoid mixing signed and unsigned integers we should also declare dsize and last_off to be of type u32. Signed-off-by: Alexandru Moise 00moses.alexande...@gmail.com --- fs/btrfs/ctree.c | 4 ++-- 1 file changed