Commit e41e6d75 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: split wio_mutex

Split wio_mutex to adjust different temperature bio cache.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 963932a9
...@@ -894,7 +894,8 @@ struct f2fs_sb_info { ...@@ -894,7 +894,8 @@ struct f2fs_sb_info {
/* for bio operations */ /* for bio operations */
struct f2fs_bio_info *write_io[NR_PAGE_TYPE]; /* for write bios */ struct f2fs_bio_info *write_io[NR_PAGE_TYPE]; /* for write bios */
struct mutex wio_mutex[NODE + 1]; /* bio ordering for NODE/DATA */ struct mutex wio_mutex[NR_PAGE_TYPE - 1][NR_TEMP_TYPE];
/* bio ordering for NODE/DATA */
int write_io_size_bits; /* Write IO size bits */ int write_io_size_bits; /* Write IO size bits */
mempool_t *write_io_dummy; /* Dummy pages */ mempool_t *write_io_dummy; /* Dummy pages */
......
...@@ -2154,7 +2154,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio) ...@@ -2154,7 +2154,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
int err; int err;
if (fio->type == NODE || fio->type == DATA) if (fio->type == NODE || fio->type == DATA)
mutex_lock(&fio->sbi->wio_mutex[fio->type]); mutex_lock(&fio->sbi->wio_mutex[fio->type][fio->temp]);
reallocate: reallocate:
allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr, allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
&fio->new_blkaddr, sum, type); &fio->new_blkaddr, sum, type);
...@@ -2167,7 +2167,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio) ...@@ -2167,7 +2167,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
} }
if (fio->type == NODE || fio->type == DATA) if (fio->type == NODE || fio->type == DATA)
mutex_unlock(&fio->sbi->wio_mutex[fio->type]); mutex_unlock(&fio->sbi->wio_mutex[fio->type][fio->temp]);
} }
void write_meta_page(struct f2fs_sb_info *sbi, struct page *page) void write_meta_page(struct f2fs_sb_info *sbi, struct page *page)
......
...@@ -1571,7 +1571,7 @@ int sanity_check_ckpt(struct f2fs_sb_info *sbi) ...@@ -1571,7 +1571,7 @@ int sanity_check_ckpt(struct f2fs_sb_info *sbi)
static void init_sb_info(struct f2fs_sb_info *sbi) static void init_sb_info(struct f2fs_sb_info *sbi)
{ {
struct f2fs_super_block *raw_super = sbi->raw_super; struct f2fs_super_block *raw_super = sbi->raw_super;
int i; int i, j;
sbi->log_sectors_per_block = sbi->log_sectors_per_block =
le32_to_cpu(raw_super->log_sectors_per_block); le32_to_cpu(raw_super->log_sectors_per_block);
...@@ -1603,8 +1603,9 @@ static void init_sb_info(struct f2fs_sb_info *sbi) ...@@ -1603,8 +1603,9 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
INIT_LIST_HEAD(&sbi->s_list); INIT_LIST_HEAD(&sbi->s_list);
mutex_init(&sbi->umount_mutex); mutex_init(&sbi->umount_mutex);
mutex_init(&sbi->wio_mutex[NODE]); for (i = 0; i < NR_PAGE_TYPE - 1; i++)
mutex_init(&sbi->wio_mutex[DATA]); for (j = HOT; j < NR_TEMP_TYPE; j++)
mutex_init(&sbi->wio_mutex[i][j]);
spin_lock_init(&sbi->cp_lock); spin_lock_init(&sbi->cp_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment