未验证 提交 73497a3a 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1333 [sync] PR-1314: ext4: Stop trying writing pages if no free blocks generated

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/1314 
 
PR sync from: Zhihao Cheng <chengzhihao1@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/ALOJ633HB2KNGCGZVSSVUI34JMM2MTRP/ 
 
 
Link:https://gitee.com/openeuler/kernel/pulls/1333 

Reviewed-by: zhangyi (F) <yi.zhang@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
......@@ -700,6 +700,7 @@ enum {
#define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER 0x0010
#define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020
#define EXT4_FREE_BLOCKS_RERESERVE_CLUSTER 0x0040
#define EXT4_FREE_BLOCKS_DONT_WAIT_JOURNAL 0x0080
/*
* ioctl commands
......
......@@ -1294,7 +1294,8 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
if (!ablocks[i])
continue;
ext4_free_blocks(handle, inode, NULL, ablocks[i], 1,
EXT4_FREE_BLOCKS_METADATA);
EXT4_FREE_BLOCKS_METADATA |
EXT4_FREE_BLOCKS_DONT_WAIT_JOURNAL);
}
}
kfree(ablocks);
......@@ -4329,6 +4330,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
ext4_discard_preallocations(inode, 0);
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
fb_flags = EXT4_FREE_BLOCKS_NO_QUOT_UPDATE;
fb_flags |= EXT4_FREE_BLOCKS_DONT_WAIT_JOURNAL;
ext4_free_blocks(handle, inode, NULL, newblock,
EXT4_C2B(sbi, allocated_clusters),
fb_flags);
......
......@@ -2479,7 +2479,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,
* is non-zero, a commit should free up blocks.
*/
if ((err == -ENOMEM) ||
(err == -ENOSPC && ext4_count_free_clusters(sb))) {
(err == -ENOSPC && EXT4_SB(sb)->s_mb_free_pending)) {
if (progress)
goto update_disksize;
return err;
......
......@@ -5498,8 +5498,9 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
* consistency guarantees.
*/
if (ext4_handle_valid(handle) &&
((flags & EXT4_FREE_BLOCKS_METADATA) ||
!ext4_should_writeback_data(inode))) {
(((flags & EXT4_FREE_BLOCKS_METADATA) ||
!ext4_should_writeback_data(inode)) &&
!(flags & EXT4_FREE_BLOCKS_DONT_WAIT_JOURNAL))) {
struct ext4_free_data *new_entry;
/*
* We use __GFP_NOFAIL because ext4_free_blocks() is not allowed
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册