From: Miao Xie <miaox@cn.fujitsu.com>
To: Djalal Harouni <tixxdz@opendz.org>
Cc: Chris Mason <chris.mason@fusionio.com>,
Josef Bacik <jbacik@fusionio.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Btrfs: do not ignore errors when truncating the free space cache inode
Date: Wed, 19 Jun 2013 09:57:14 +0800 [thread overview]
Message-ID: <51C10FFA.3010307@cn.fujitsu.com> (raw)
In-Reply-To: <1371592661-11167-1-git-send-email-tixxdz@opendz.org>
It was fixed by Wei Yongjun
http://marc.info/?l=linux-btrfs&m=136910396606489&w=2
Thanks
Miao
On tue, 18 Jun 2013 22:57:41 +0100, Djalal Harouni wrote:
> 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@opendz.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,
>
prev parent reply other threads:[~2013-06-19 1:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-18 21:57 [PATCH] Btrfs: do not ignore errors when truncating the free space cache inode Djalal Harouni
2013-06-19 1:57 ` Miao Xie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51C10FFA.3010307@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=chris.mason@fusionio.com \
--cc=jbacik@fusionio.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tixxdz@opendz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).