* [PATCH 1/2] Btrfs: return free space to global_rsv as much as possible
@ 2013-12-29 13:44 Liu Bo
2013-12-29 13:44 ` [PATCH 2/2] Btrfs: release subvolume's block_rsv before transaction commit Liu Bo
0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2013-12-29 13:44 UTC (permalink / raw)
To: linux-btrfs
@full is not protected within global_rsv.lock, so we may think global_rsv
is already full but in fact it's not, so we miss the opportunity to return
free space to global_rsv directly when we release other block_rsvs.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/extent-tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9c01509..009980c 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4637,7 +4637,7 @@ void btrfs_block_rsv_release(struct btrfs_root *root,
u64 num_bytes)
{
struct btrfs_block_rsv *global_rsv = &root->fs_info->global_block_rsv;
- if (global_rsv->full || global_rsv == block_rsv ||
+ if (global_rsv == block_rsv ||
block_rsv->space_info != global_rsv->space_info)
global_rsv = NULL;
block_rsv_release_bytes(root->fs_info, block_rsv, global_rsv,
--
1.8.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Btrfs: release subvolume's block_rsv before transaction commit
2013-12-29 13:44 [PATCH 1/2] Btrfs: return free space to global_rsv as much as possible Liu Bo
@ 2013-12-29 13:44 ` Liu Bo
2014-01-08 15:22 ` Josef Bacik
0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2013-12-29 13:44 UTC (permalink / raw)
To: linux-btrfs
We don't have to keep subvolume's block_rsv during transaction commit,
and within transaction commit, we may also need the free space reclaimed
from this block_rsv to process delayed refs.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/ioctl.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 21da576..347bf61 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -417,7 +417,8 @@ static noinline int create_subvol(struct inode *dir,
trans = btrfs_start_transaction(root, 0);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
- goto out;
+ btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
+ return ret;
}
trans->block_rsv = &block_rsv;
trans->bytes_reserved = block_rsv.size;
@@ -542,6 +543,8 @@ static noinline int create_subvol(struct inode *dir,
fail:
trans->block_rsv = NULL;
trans->bytes_reserved = 0;
+ btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
+
if (async_transid) {
*async_transid = trans->transid;
err = btrfs_commit_transaction_async(trans, root, 1);
@@ -555,8 +558,6 @@ fail:
if (!ret)
d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
-out:
- btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
return ret;
}
--
1.8.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Btrfs: release subvolume's block_rsv before transaction commit
2013-12-29 13:44 ` [PATCH 2/2] Btrfs: release subvolume's block_rsv before transaction commit Liu Bo
@ 2014-01-08 15:22 ` Josef Bacik
2014-01-09 6:57 ` [PATCH v2] " Liu Bo
0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2014-01-08 15:22 UTC (permalink / raw)
To: Liu Bo, linux-btrfs
On 12/29/2013 08:44 AM, Liu Bo wrote:
> We don't have to keep subvolume's block_rsv during transaction commit,
> and within transaction commit, we may also need the free space reclaimed
> from this block_rsv to process delayed refs.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> fs/btrfs/ioctl.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 21da576..347bf61 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -417,7 +417,8 @@ static noinline int create_subvol(struct inode *dir,
> trans = btrfs_start_transaction(root, 0);
> if (IS_ERR(trans)) {
> ret = PTR_ERR(trans);
> - goto out;
> + btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
> + return ret;
> }
> trans->block_rsv = &block_rsv;
> trans->bytes_reserved = block_rsv.size;
> @@ -542,6 +543,8 @@ static noinline int create_subvol(struct inode *dir,
> fail:
> trans->block_rsv = NULL;
> trans->bytes_reserved = 0;
> + btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
> +
> if (async_transid) {
> *async_transid = trans->transid;
> err = btrfs_commit_transaction_async(trans, root, 1);
> @@ -555,8 +558,6 @@ fail:
>
> if (!ret)
> d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
> -out:
> - btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
> return ret;
> }
>
Doesn't compile, please rebase onto new btrfs-next and resubmit. Thanks,
Josef
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] Btrfs: release subvolume's block_rsv before transaction commit
2014-01-08 15:22 ` Josef Bacik
@ 2014-01-09 6:57 ` Liu Bo
0 siblings, 0 replies; 4+ messages in thread
From: Liu Bo @ 2014-01-09 6:57 UTC (permalink / raw)
To: linux-btrfs; +Cc: Josef Bacik
We don't have to keep subvolume's block_rsv during transaction commit,
and within transaction commit, we may also need the free space reclaimed
from this block_rsv to process delayed refs.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: rebase onto the latest btrfs-next.
fs/btrfs/ioctl.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 3970f32..332b624 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -436,7 +436,9 @@ static noinline int create_subvol(struct inode *dir,
trans = btrfs_start_transaction(root, 0);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
- goto out;
+ btrfs_subvolume_release_metadata(root, &block_rsv,
+ qgroup_reserved);
+ return ret;
}
trans->block_rsv = &block_rsv;
trans->bytes_reserved = block_rsv.size;
@@ -561,6 +563,8 @@ static noinline int create_subvol(struct inode *dir,
fail:
trans->block_rsv = NULL;
trans->bytes_reserved = 0;
+ btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
+
if (async_transid) {
*async_transid = trans->transid;
err = btrfs_commit_transaction_async(trans, root, 1);
@@ -574,14 +578,10 @@ fail:
if (!ret) {
inode = btrfs_lookup_dentry(dir, dentry);
- if (IS_ERR(inode)) {
- ret = PTR_ERR(inode);
- goto out;
- }
+ if (IS_ERR(inode))
+ return PTR_ERR(inode);
d_instantiate(dentry, inode);
}
-out:
- btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
return ret;
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-09 6:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 13:44 [PATCH 1/2] Btrfs: return free space to global_rsv as much as possible Liu Bo
2013-12-29 13:44 ` [PATCH 2/2] Btrfs: release subvolume's block_rsv before transaction commit Liu Bo
2014-01-08 15:22 ` Josef Bacik
2014-01-09 6:57 ` [PATCH v2] " 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).