linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4 v2] Btrfs: do not abort transaction in prealloc case
@ 2012-07-06  9:31 Liu Bo
  2012-07-06  9:31 ` [PATCH 2/4 v2] Btrfs: fix a bug of writting free space cache during balance Liu Bo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Liu Bo @ 2012-07-06  9:31 UTC (permalink / raw)
  To: linux-btrfs

During disk balance, we prealloc new file extent for file data relocation,
but we may fail in 'no available space' case, and it leads to flipping btrfs
into readonly.

It is not necessary to bail out and abort transaction since we do have several
ways to rescue ourselves from ENOSPC case.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
v1->v2: adopt an easier and cleaner way:
        checking return value instead of adding more arguments.

 fs/btrfs/extent-tree.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5775dc4..0469398 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5777,7 +5777,11 @@ loop:
 				ret = do_chunk_alloc(trans, root, num_bytes +
 						     2 * 1024 * 1024, data,
 						     CHUNK_ALLOC_LIMITED);
-				if (ret < 0) {
+				/*
+				 * Do not bail out on ENOSPC since we
+				 * can do more things.
+				 */
+				if (ret < 0 && ret != -ENOSPC) {
 					btrfs_abort_transaction(trans,
 								root, ret);
 					goto out;
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-06  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06  9:31 [PATCH 1/4 v2] Btrfs: do not abort transaction in prealloc case Liu Bo
2012-07-06  9:31 ` [PATCH 2/4 v2] Btrfs: fix a bug of writting free space cache during balance Liu Bo
2012-07-06  9:31 ` [PATCH 3/4 v2] Btrfs: add ro notification to dump_space_info Liu Bo
2012-07-06  9:31 ` [PATCH 4/4 v2] Btrfs: do not count in readonly bytes Liu Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).