Btrfs: avoid ENOSPC errors in btrfs_dirty_inode
btrfs_dirty_inode tries to sneak in without much waiting or space reservation, mostly for performance reasons. This usually works well but can cause problems when there are many many writers. When btrfs_update_inode fails with ENOSPC, we fallback to a slower btrfs_start_transaction call that will reserve some space. Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
3f7c579c41
commit
94b604429a
|
@ -4308,10 +4308,18 @@ void btrfs_dirty_inode(struct inode *inode)
|
||||||
btrfs_set_trans_block_group(trans, inode);
|
btrfs_set_trans_block_group(trans, inode);
|
||||||
|
|
||||||
ret = btrfs_update_inode(trans, root, inode);
|
ret = btrfs_update_inode(trans, root, inode);
|
||||||
if (ret)
|
if (ret && ret == -ENOSPC) {
|
||||||
printk(KERN_ERR"btrfs: fail to dirty inode %lu error %d\n",
|
/* whoops, lets try again with the full transaction */
|
||||||
inode->i_ino, ret);
|
btrfs_end_transaction(trans, root);
|
||||||
|
trans = btrfs_start_transaction(root, 1);
|
||||||
|
btrfs_set_trans_block_group(trans, inode);
|
||||||
|
|
||||||
|
ret = btrfs_update_inode(trans, root, inode);
|
||||||
|
if (ret) {
|
||||||
|
printk(KERN_ERR"btrfs: fail to dirty inode %lu error %d\n",
|
||||||
|
inode->i_ino, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
btrfs_end_transaction(trans, root);
|
btrfs_end_transaction(trans, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue