From: Jaegeuk Kim <jaegeuk.kim@samsung.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, 谭姝 <shu.tan@samsung.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: split sbi->write_mutex for DATA/NODE/META to avoid unnecessary race
Date: Tue, 19 Nov 2013 12:18:16 +0900 [thread overview]
Message-ID: <1384831096.26319.25.camel@kjgkr> (raw)
In-Reply-To: <001201cee4c8$de450360$9acf0a20$@samsung.com>
Hi,
2013-11-19 (화), 09:43 +0800, Chao Yu:
> All DATA/NODE/META bio buffers in superblock is protected by
> 'sbi->write_mutex', but each bio buffer area is independent, So we
> should split write_mutex to three for DATA/NODE/META.
Agreed, one comment below though.
Anyway I'll send v2.
Thanks, :)
>
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
> fs/f2fs/f2fs.h | 2 +-
> fs/f2fs/segment.c | 8 ++++----
> fs/f2fs/super.c | 4 +++-
> 3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 2df1e61..1c67521 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -362,7 +362,7 @@ struct f2fs_sb_info {
> struct f2fs_sm_info *sm_info; /* segment manager */
> struct bio *bio[NR_PAGE_TYPE]; /* bios to merge */
> sector_t last_block_in_bio[NR_PAGE_TYPE]; /* last block number */
> - struct mutex write_mutex; /* mutex for writing IOs */
> + struct mutex write_mutex[NR_PAGE_TYPE]; /* mutex for writing IOs */
>
> /* for checkpoint */
> struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 556965f..a36713ae 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -661,9 +661,9 @@ void f2fs_submit_bio(struct f2fs_sb_info *sbi, enum
> page_type type, bool sync)
> if (!sbi->bio[btype])
> return;
>
> - mutex_lock(&sbi->write_mutex);
> + mutex_lock(&sbi->write_mutex[type]);
btype instead of type.
> do_submit_bio(sbi, type, sync);
> - mutex_unlock(&sbi->write_mutex);
> + mutex_unlock(&sbi->write_mutex[type]);
> }
>
> static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page,
> @@ -674,7 +674,7 @@ static void submit_write_page(struct f2fs_sb_info *sbi,
> struct page *page,
>
> verify_block_addr(sbi, blk_addr);
>
> - mutex_lock(&sbi->write_mutex);
> + mutex_lock(&sbi->write_mutex[type]);
>
> inc_page_count(sbi, F2FS_WRITEBACK);
>
> @@ -709,7 +709,7 @@ retry:
>
> sbi->last_block_in_bio[type] = blk_addr;
>
> - mutex_unlock(&sbi->write_mutex);
> + mutex_unlock(&sbi->write_mutex[type]);
> trace_f2fs_submit_write_page(page, blk_addr, type);
> }
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index f56941c..6928c0a 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -874,7 +874,9 @@ static int f2fs_fill_super(struct super_block *sb, void
> *data, int silent)
> mutex_init(&sbi->node_write);
> sbi->por_doing = false;
> spin_lock_init(&sbi->stat_lock);
> - mutex_init(&sbi->write_mutex);
> + mutex_init(&sbi->write_mutex[DATA]);
> + mutex_init(&sbi->write_mutex[NODE]);
> + mutex_init(&sbi->write_mutex[META]);
> init_rwsem(&sbi->cp_rwsem);
> init_waitqueue_head(&sbi->cp_wait);
> init_sb_info(sbi);
--
Jaegeuk Kim
Samsung
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-11-19 3:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 1:43 [f2fs-dev] [PATCH] f2fs: split sbi->write_mutex for DATA/NODE/META to avoid unnecessary race Chao Yu
2013-11-19 3:18 ` Jaegeuk Kim [this message]
2013-11-19 3:36 ` Jaegeuk Kim
2013-11-19 4:56 ` [f2fs-dev] " Chao Yu
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=1384831096.26319.25.camel@kjgkr \
--to=jaegeuk.kim@samsung.com \
--cc=chao2.yu@samsung.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shu.tan@samsung.com \
/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).