From: majianpeng <majianpeng@gmail.com>
To: Libo Chen <clbchenlibo.chen@huawei.com>
Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>,
peterz@infradead.org, mingo@redhat.com,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-f2fs <linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [RFC][PATCH] f2fs: Avoid print false deadlock messages.
Date: Wed, 15 May 2013 15:33:26 +0800 [thread overview]
Message-ID: <51933A46.1090504@gmail.com> (raw)
In-Reply-To: <51933770.4060607@huawei.com>
On 05/15/2013 03:21 PM, Libo Chen wrote:
> On 2013/5/15 14:58, majianpeng wrote:
>> By adding some messages, i found this problem because the gcc
>> optimizing. For those codes:
>>>> for (i = 0; i < NR_GLOBAL_LOCKS; i++)
>>>> mutex_init(&sbi->fs_lock[i]);
>> The defination of mutex_init is:
>>>> #define mutex_init(mutex)
>>>> do {
>>>>
>>>> static struct lock_class_key __key;
>>>>
>>>>
>>>> __mutex_init((mutex), #mutex, &__key);
>>>>
>>>> } while (0)
>> Because the optimizing of gcc, there are only one __key rather than
>> NR_GLOBAL_LOCKS times.
>>
>> Add there is other problems about lockname.Using 'for()' the lockname is
>> the same which is '&sbi->fs_lock[i]'.If it met problem about
>> mutex-operation, it can't find which one.
>>
>> Although my patch can work,i think it's not best.Because if
>> NR_GLOBAL_LOCKS changed, we may leak to change this.
>>
>> BTY, if who know how to avoid optimize, please tell me. Thanks!
>>
>> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
>> ---
>> fs/f2fs/super.c | 13 ++++++++++---
>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>> index 8555f7d..ce08b96 100644
>> --- a/fs/f2fs/super.c
>> +++ b/fs/f2fs/super.c
>> @@ -520,7 +520,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>> struct buffer_head *raw_super_buf;
>> struct inode *root;
>> long err = -EINVAL;
>> - int i;
>>
>> /* allocate memory for f2fs-specific super block info */
>> sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL);
>> @@ -578,8 +577,16 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>> mutex_init(&sbi->gc_mutex);
>> mutex_init(&sbi->writepages);
>> mutex_init(&sbi->cp_mutex);
>> - for (i = 0; i < NR_GLOBAL_LOCKS; i++)
>> - mutex_init(&sbi->fs_lock[i]);
>> +
> you can try barrier() or mb() to avoid compile optimization.
>
Hi,
They aren't work!But thanks very much!
Thanks!
Jianpeng Ma
next prev parent reply other threads:[~2013-05-15 7:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 6:58 [RFC][PATCH] f2fs: Avoid print false deadlock messages majianpeng
2013-05-15 7:21 ` Libo Chen
2013-05-15 7:33 ` majianpeng [this message]
2013-05-15 8:28 ` Peter Zijlstra
2013-05-16 1:16 ` majianpeng
2013-05-16 8:41 ` Peter Zijlstra
2013-05-16 11:34 ` majianpeng
2013-05-16 18:03 ` Peter Zijlstra
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=51933A46.1090504@gmail.com \
--to=majianpeng@gmail.com \
--cc=clbchenlibo.chen@huawei.com \
--cc=jaegeuk.kim@samsung.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.