mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-09 07:18:02 +07:00
f2fs: move grabing orphan pages out of protection region
Move grabing orphan block page out of protection region, and grab all the orphan block pages ahead. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Reviewed-by: Chao Yu <chao2.yu@samsung.com> [Jaegeuk Kim: remove unnecessary code pointed by Chao Yu] Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
5514f0aadd
commit
4531929e39
@ -303,22 +303,25 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
|
|||||||
{
|
{
|
||||||
struct list_head *head;
|
struct list_head *head;
|
||||||
struct f2fs_orphan_block *orphan_blk = NULL;
|
struct f2fs_orphan_block *orphan_blk = NULL;
|
||||||
struct page *page = NULL;
|
|
||||||
unsigned int nentries = 0;
|
unsigned int nentries = 0;
|
||||||
unsigned short index = 1;
|
unsigned short index;
|
||||||
unsigned short orphan_blocks;
|
unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans +
|
||||||
|
(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
|
||||||
|
struct page *page = NULL;
|
||||||
|
struct page *pages[orphan_blocks];
|
||||||
struct orphan_inode_entry *orphan = NULL;
|
struct orphan_inode_entry *orphan = NULL;
|
||||||
|
|
||||||
orphan_blocks = (unsigned short)((sbi->n_orphans +
|
for (index = 0; index < orphan_blocks; index++)
|
||||||
(F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
|
pages[index] = grab_meta_page(sbi, start_blk + index);
|
||||||
|
|
||||||
|
index = 1;
|
||||||
mutex_lock(&sbi->orphan_inode_mutex);
|
mutex_lock(&sbi->orphan_inode_mutex);
|
||||||
head = &sbi->orphan_inode_list;
|
head = &sbi->orphan_inode_list;
|
||||||
|
|
||||||
/* loop for each orphan inode entry and write them in Jornal block */
|
/* loop for each orphan inode entry and write them in Jornal block */
|
||||||
list_for_each_entry(orphan, head, list) {
|
list_for_each_entry(orphan, head, list) {
|
||||||
if (!page) {
|
if (!page) {
|
||||||
page = grab_meta_page(sbi, start_blk);
|
page = pages[index - 1];
|
||||||
orphan_blk =
|
orphan_blk =
|
||||||
(struct f2fs_orphan_block *)page_address(page);
|
(struct f2fs_orphan_block *)page_address(page);
|
||||||
memset(orphan_blk, 0, sizeof(*orphan_blk));
|
memset(orphan_blk, 0, sizeof(*orphan_blk));
|
||||||
@ -338,7 +341,6 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
|
|||||||
set_page_dirty(page);
|
set_page_dirty(page);
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
index++;
|
index++;
|
||||||
start_blk++;
|
|
||||||
nentries = 0;
|
nentries = 0;
|
||||||
page = NULL;
|
page = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user