[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1371592661-11167-1-git-send-email-tixxdz@opendz.org>
Date: Tue, 18 Jun 2013 22:57:41 +0100
From: Djalal Harouni <tixxdz@...ndz.org>
To: Chris Mason <chris.mason@...ionio.com>,
Miao Xie <miaox@...fujitsu.com>,
Josef Bacik <jbacik@...ionio.com>, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Djalal Harouni <tixxdz@...ndz.org>
Subject: [PATCH] Btrfs: do not ignore errors when truncating the free space cache inode
btrfs_check_trunc_cache_free_space() tries to check if there is enough
space for cache inode truncation but it fails.
Currently this function always returns success even if there is no
enough space. Fix this by returning the -ENOSPC error code.
Signed-off-by: Djalal Harouni <tixxdz@...ndz.org>
---
Totally untested code.
fs/btrfs/free-space-cache.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 2750b50..9629830 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -201,7 +201,7 @@ int btrfs_check_trunc_cache_free_space(struct btrfs_root *root,
struct btrfs_block_rsv *rsv)
{
u64 needed_bytes;
- int ret;
+ int ret = 0;
/* 1 for slack space, 1 for updating the inode */
needed_bytes = btrfs_calc_trunc_metadata_size(root, 1) +
@@ -210,10 +210,10 @@ int btrfs_check_trunc_cache_free_space(struct btrfs_root *root,
spin_lock(&rsv->lock);
if (rsv->reserved < needed_bytes)
ret = -ENOSPC;
- else
- ret = 0;
+
spin_unlock(&rsv->lock);
- return 0;
+
+ return ret;
}
int btrfs_truncate_free_space_cache(struct btrfs_root *root,
--
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists