diff options
author | Chris Mason <chris.mason@oracle.com> | 2010-05-26 11:02:00 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-05-26 11:02:00 -0400 |
commit | 94b604429a6cd94ddc128fa2772c57209bb1318f (patch) | |
tree | 700c5b9cb431bde48f07813224e6a5165a9d6540 /fs/btrfs | |
parent | 3f7c579c41a3d20af76fd6ff1f6b949edf105fd1 (diff) |
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ca9d5501d340..5d62f21b2e45 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4308,10 +4308,18 @@ void btrfs_dirty_inode(struct inode *inode) | |||
4308 | btrfs_set_trans_block_group(trans, inode); | 4308 | btrfs_set_trans_block_group(trans, inode); |
4309 | 4309 | ||
4310 | ret = btrfs_update_inode(trans, root, inode); | 4310 | ret = btrfs_update_inode(trans, root, inode); |
4311 | if (ret) | 4311 | if (ret && ret == -ENOSPC) { |
4312 | printk(KERN_ERR"btrfs: fail to dirty inode %lu error %d\n", | 4312 | /* whoops, lets try again with the full transaction */ |
4313 | inode->i_ino, ret); | 4313 | btrfs_end_transaction(trans, root); |
4314 | trans = btrfs_start_transaction(root, 1); | ||
4315 | btrfs_set_trans_block_group(trans, inode); | ||
4314 | 4316 | ||
4317 | ret = btrfs_update_inode(trans, root, inode); | ||
4318 | if (ret) { | ||
4319 | printk(KERN_ERR"btrfs: fail to dirty inode %lu error %d\n", | ||
4320 | inode->i_ino, ret); | ||
4321 | } | ||
4322 | } | ||
4315 | btrfs_end_transaction(trans, root); | 4323 | btrfs_end_transaction(trans, root); |
4316 | } | 4324 | } |
4317 | 4325 | ||