linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/3] Btrfs: rework qgroup accounting
Date: Wed, 8 Jan 2014 09:42:34 -0500	[thread overview]
Message-ID: <52CD63DA.30101@fb.com> (raw)
In-Reply-To: <20140108143327.GG6498@twin.jikos.cz>


On 01/08/2014 09:33 AM, David Sterba wrote:
> On Wed, Dec 18, 2013 at 04:07:28PM -0500, Josef Bacik wrote:
>>   /*
>> - * btrfs_qgroup_record_ref is called when the ref is added or deleted. it puts
>> - * the modification into a list that's later used by btrfs_end_transaction to
>> - * pass the recorded modifications on to btrfs_qgroup_account_ref.
>> + * Record a quota operation for processing later on.
>> + * @trans: the transaction we are adding the delayed op to.
>> + * @fs_info: the fs_info for this fs.
>> + * @ref_root: the root of the reference we are acting on,
>> + * @num_bytes: the number of bytes in the reference.
>> + * @parent: if we are removing a shared ref then this will be set.
>> + * @type: the type of operation this is.
>> + *
>> + * We just add it to our trans qgroup_ref_list and carry on and process these
>> + * operations in order at some later point.  If the reference root isn't a fs
>> + * root then we don't bother with doing anything.
>> + *
>> + * MUST BE HOLDING THE REF LOCK.
>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>>    */
>>   int btrfs_qgroup_record_ref(struct btrfs_trans_handle *trans,
>> -			    struct btrfs_delayed_ref_node *node,
>> -			    struct btrfs_delayed_extent_op *extent_op)
>> +			    struct btrfs_fs_info *fs_info, u64 ref_root,
>> +			    u64 bytenr, u64 num_bytes, u64 parent,
>> +			    enum btrfs_qgroup_operation_type type)
>>   {
>> -	struct qgroup_update *u;
>> +	struct btrfs_qgroup_operation *oper;
>> +	int ret;
>>   
>> -	BUG_ON(!trans->delayed_ref_elem.seq);
>> -	u = kmalloc(sizeof(*u), GFP_NOFS);
>> -	if (!u)
>> +	if (!is_fstree(ref_root) || !fs_info->quota_enabled)
>> +		return 0;
>> +
>> +	oper = kmalloc(sizeof(*oper), GFP_NOFS);
> Must use GFP_ATOMIC then, ohterwise spits some warnings:

This is because I'm still holding the tree lock, the ref_lock is just a 
range lock so you can allocate under it.  I'll fix this up, thanks,

Josef

  reply	other threads:[~2014-01-08 14:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 21:07 Rework qgroup accounting Josef Bacik
2013-12-18 21:07 ` [PATCH 1/3] Btrfs: introduce lock_ref/unlock_ref Josef Bacik
2013-12-19  4:01   ` Dave Chinner
2013-12-19 14:37     ` Josef Bacik
2013-12-18 21:07 ` [PATCH 2/3] Btrfs: rework qgroup accounting Josef Bacik
2013-12-21  8:01   ` Wang Shilong
2013-12-21 14:13     ` Josef Bacik
2013-12-21  8:56   ` Wang Shilong
2013-12-21 14:14     ` Josef Bacik
2014-01-07 16:43     ` Josef Bacik
2014-01-08 14:33   ` David Sterba
2014-01-08 14:42     ` Josef Bacik [this message]
2013-12-18 21:07 ` [PATCH 3/3] Btrfs: add sanity tests for new qgroup accounting code Josef Bacik
2013-12-19  2:00 ` Rework qgroup accounting Liu Bo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CD63DA.30101@fb.com \
    --to=jbacik@fb.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).