Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: dsterba@suse.cz, Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] Btrfs: use a lock to protect incompat/compat flag of the super block
Date: Mon, 22 Apr 2013 10:38:33 +0800	[thread overview]
Message-ID: <5174A2A9.9060709@cn.fujitsu.com> (raw)
In-Reply-To: <20130417221710.GD16427@twin.jikos.cz>

On 	thu, 18 Apr 2013 00:17:11 +0200, David Sterba wrote:
> On Thu, Apr 11, 2013 at 06:30:16PM +0800, Miao Xie wrote:
>> In order to avoid this problem, we introduce a lock named super_lock into
>> the btrfs_fs_info structure. If we want to update incompat/compat flags
>> of the super block, we must hold it.
>>
>> +	/*
>> +	 * Used to protect the incompat_flags, compat_flags, compat_ro_flags
>> +	 * when they are updated.
> 
>> +	spinlock_t super_lock;
> 
> The lock name is too general for protecting just *_flags, do you have
> plans to add more items from superblock under this lock?  If no, I
> suggest to pick a different name.

Yes, I want to add more items from super block under this lock.

> 
>> @@ -3663,8 +3674,15 @@ static inline void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info,
>>  	disk_super = fs_info->super_copy;
>>  	features = btrfs_super_incompat_flags(disk_super);
>>  	if (!(features & flag)) {
>> -		features |= flag;
>> -		btrfs_set_super_incompat_flags(disk_super, features);
>> +		spin_lock(&fs_info->super_lock);
>> +		features = btrfs_super_incompat_flags(disk_super);
>> +		if (!(features & flag)) {
>> +			features |= flag;
>> +			btrfs_set_super_incompat_flags(disk_super, features);
>> +			printk(KERN_INFO "btrfs: setting %llu feature flag\n",
>> +					 flag);
> 
> flag is u64, please use (unsigned long long)flag and possibly the new
> btrfs_info replacement of printks.

OK, I'll modify my patch.

Thanks for your view.

Miao

> 
>> +		}
>> +		spin_unlock(&fs_info->super_lock);
>>  	}
>>  }
> 
> otherwise ok.
> 
> Reviewed-by: David Sterba <dsterba@suse.cz>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


      reply	other threads:[~2013-04-22  2:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 10:30 [PATCH 2/2] Btrfs: use a lock to protect incompat/compat flag of the super block Miao Xie
2013-04-17 22:17 ` David Sterba
2013-04-22  2:38   ` Miao Xie [this message]

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=5174A2A9.9060709@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.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