From: Miao Xie <miaox@cn.fujitsu.com>
To: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/6] Btrfs: Abstract similar code for btrfs_block_rsv_add{, _noflush}()
Date: Thu, 10 Nov 2011 15:31:08 +0800 [thread overview]
Message-ID: <4EBB7DBC.8060701@cn.fujitsu.com> (raw)
In-Reply-To: <4EBB6F07.6000009@cn.fujitsu.com>
The mail of PATCH 0 was always rejected, so I try to send it as the
reply of PATCH 1.
====================
Title: [PATCH 0/6] Random fix of the space relocation
This patchset fixes 5 bugs of the space relocation, one fixes the problem
that we forgot to reserve space for writing out i-node cache, one fixes
that the path is not released, this problem may cause the deadlock.
one fixes the no-cow problem, this problem will break the meta-data.
one fixes the deadlock that caused by the race between the relocation
and the snapshot creation, the last one fixes BUG_ON() which is triggered
by the orphan back-ref nodes.
NOTE: This patchset is based on the danger branch.
Miao Xie (6):
Btrfs: Abstract similar code for btrfs_block_rsv_add{, _noflush}()
Btrfs: fix no reserved space for writing out inode cache
Btrfs: fix unreleased path in btrfs_orphan_cleanup()
Btrfs: fix nocow when deleting the item
Btrfs: fix deadlock caused by the race between relocation and snapshot creation
Btrfs: fix orphan backref nodes
fs/btrfs/extent-tree.c | 28 ++++++++++++----------------
fs/btrfs/inode-map.c | 28 ++++++++++++++++++++++++----
fs/btrfs/inode.c | 3 +++
fs/btrfs/relocation.c | 2 ++
fs/btrfs/transaction.c | 4 ++--
fs/btrfs/volumes.c | 5 ++++-
6 files changed, 47 insertions(+), 23 deletions(-)
On thu, 10 Nov 2011 14:28:23 +0800, Miao Xie wrote:
> btrfs_block_rsv_add{, _noflush}() have similar code, so abstract that code.
>
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> fs/btrfs/extent-tree.c | 28 ++++++++++++----------------
> 1 files changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 1311beb..6703a43 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -3796,16 +3796,16 @@ void btrfs_free_block_rsv(struct btrfs_root *root,
> kfree(rsv);
> }
>
> -int btrfs_block_rsv_add(struct btrfs_root *root,
> - struct btrfs_block_rsv *block_rsv,
> - u64 num_bytes)
> +static inline int __block_rsv_add(struct btrfs_root *root,
> + struct btrfs_block_rsv *block_rsv,
> + u64 num_bytes, int flush)
> {
> int ret;
>
> if (num_bytes == 0)
> return 0;
>
> - ret = reserve_metadata_bytes(root, block_rsv, num_bytes, 1);
> + ret = reserve_metadata_bytes(root, block_rsv, num_bytes, flush);
> if (!ret) {
> block_rsv_add_bytes(block_rsv, num_bytes, 1);
> return 0;
> @@ -3814,22 +3814,18 @@ int btrfs_block_rsv_add(struct btrfs_root *root,
> return ret;
> }
>
> +int btrfs_block_rsv_add(struct btrfs_root *root,
> + struct btrfs_block_rsv *block_rsv,
> + u64 num_bytes)
> +{
> + return __block_rsv_add(root, block_rsv, num_bytes, 1);
> +}
> +
> int btrfs_block_rsv_add_noflush(struct btrfs_root *root,
> struct btrfs_block_rsv *block_rsv,
> u64 num_bytes)
> {
> - int ret;
> -
> - if (num_bytes == 0)
> - return 0;
> -
> - ret = reserve_metadata_bytes(root, block_rsv, num_bytes, 0);
> - if (!ret) {
> - block_rsv_add_bytes(block_rsv, num_bytes, 1);
> - return 0;
> - }
> -
> - return ret;
> + return __block_rsv_add(root, block_rsv, num_bytes, 0);
> }
>
> int btrfs_block_rsv_check(struct btrfs_root *root,
next prev parent reply other threads:[~2011-11-10 7:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 6:28 [PATCH 1/6] Btrfs: Abstract similar code for btrfs_block_rsv_add{, _noflush}() Miao Xie
2011-11-10 7:31 ` Miao Xie [this message]
2011-11-11 0:12 ` Chris Mason
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=4EBB7DBC.8060701@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.