* [PULL][PATCH 0/4] Minor fixes to free-space-tree patchset, for 4.5
@ 2016-01-27 14:01 David Sterba
2016-01-27 14:02 ` [PATCH 1/4] btrfs: tests: switch to GFP_KERNEL David Sterba
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: David Sterba @ 2016-01-27 14:01 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, clm
Hi,
the newly added free space tree has to be added to a few more places. Plus two
minor updates to memory allocations, similar to what went in during this dev
cycle.
----------------------------------------------------------------
The following changes since commit 988f1f576d4f7531cb2175ee1b7cb7afd6d95d22:
Merge branch 'for-chris-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux into for-linus-4.5 (2016-01-11 08:39:28 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git dev/fst-followup
for you to fetch changes up to 3e4c5efbb3ac7c9c4fb5f33b659fa98afe568ab1:
btrfs: add free space tree to the cow-only list (2016-01-25 16:48:07 +0100)
----------------------------------------------------------------
David Sterba (4):
btrfs: tests: switch to GFP_KERNEL
btrfs: tweak free space tree bitmap allocation
btrfs: add free space tree to lockdep classes
btrfs: add free space tree to the cow-only list
fs/btrfs/disk-io.c | 1 +
fs/btrfs/free-space-tree.c | 18 ++++++++++++++++--
fs/btrfs/relocation.c | 3 ++-
fs/btrfs/tests/btrfs-tests.c | 10 +++++-----
fs/btrfs/tests/extent-io-tests.c | 12 ++++++------
fs/btrfs/tests/inode-tests.c | 8 ++++----
6 files changed, 34 insertions(+), 18 deletions(-)
--
2.6.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] btrfs: tests: switch to GFP_KERNEL
2016-01-27 14:01 [PULL][PATCH 0/4] Minor fixes to free-space-tree patchset, for 4.5 David Sterba
@ 2016-01-27 14:02 ` David Sterba
2016-01-27 14:02 ` [PATCH 2/4] btrfs: tweak free space tree bitmap allocation David Sterba
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-01-27 14:02 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
There's no reason to do GFP_NOFS in tests, it's not data-heavy and
memory allocation failures would affect only developers or testers.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/tests/btrfs-tests.c | 10 +++++-----
fs/btrfs/tests/extent-io-tests.c | 12 ++++++------
fs/btrfs/tests/inode-tests.c | 8 ++++----
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
index b1d920b30070..0e1e61a7ec23 100644
--- a/fs/btrfs/tests/btrfs-tests.c
+++ b/fs/btrfs/tests/btrfs-tests.c
@@ -82,18 +82,18 @@ void btrfs_destroy_test_fs(void)
struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(void)
{
struct btrfs_fs_info *fs_info = kzalloc(sizeof(struct btrfs_fs_info),
- GFP_NOFS);
+ GFP_KERNEL);
if (!fs_info)
return fs_info;
fs_info->fs_devices = kzalloc(sizeof(struct btrfs_fs_devices),
- GFP_NOFS);
+ GFP_KERNEL);
if (!fs_info->fs_devices) {
kfree(fs_info);
return NULL;
}
fs_info->super_copy = kzalloc(sizeof(struct btrfs_super_block),
- GFP_NOFS);
+ GFP_KERNEL);
if (!fs_info->super_copy) {
kfree(fs_info->fs_devices);
kfree(fs_info);
@@ -180,11 +180,11 @@ btrfs_alloc_dummy_block_group(unsigned long length)
{
struct btrfs_block_group_cache *cache;
- cache = kzalloc(sizeof(*cache), GFP_NOFS);
+ cache = kzalloc(sizeof(*cache), GFP_KERNEL);
if (!cache)
return NULL;
cache->free_space_ctl = kzalloc(sizeof(*cache->free_space_ctl),
- GFP_NOFS);
+ GFP_KERNEL);
if (!cache->free_space_ctl) {
kfree(cache);
return NULL;
diff --git a/fs/btrfs/tests/extent-io-tests.c b/fs/btrfs/tests/extent-io-tests.c
index e29fa297e053..669b58201e36 100644
--- a/fs/btrfs/tests/extent-io-tests.c
+++ b/fs/btrfs/tests/extent-io-tests.c
@@ -94,7 +94,7 @@ static int test_find_delalloc(void)
* test.
*/
for (index = 0; index < (total_dirty >> PAGE_CACHE_SHIFT); index++) {
- page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
+ page = find_or_create_page(inode->i_mapping, index, GFP_KERNEL);
if (!page) {
test_msg("Failed to allocate test page\n");
ret = -ENOMEM;
@@ -113,7 +113,7 @@ static int test_find_delalloc(void)
* |--- delalloc ---|
* |--- search ---|
*/
- set_extent_delalloc(&tmp, 0, 4095, NULL, GFP_NOFS);
+ set_extent_delalloc(&tmp, 0, 4095, NULL, GFP_KERNEL);
start = 0;
end = 0;
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -144,7 +144,7 @@ static int test_find_delalloc(void)
test_msg("Couldn't find the locked page\n");
goto out_bits;
}
- set_extent_delalloc(&tmp, 4096, max_bytes - 1, NULL, GFP_NOFS);
+ set_extent_delalloc(&tmp, 4096, max_bytes - 1, NULL, GFP_KERNEL);
start = test_start;
end = 0;
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -199,7 +199,7 @@ static int test_find_delalloc(void)
*
* We are re-using our test_start from above since it works out well.
*/
- set_extent_delalloc(&tmp, max_bytes, total_dirty - 1, NULL, GFP_NOFS);
+ set_extent_delalloc(&tmp, max_bytes, total_dirty - 1, NULL, GFP_KERNEL);
start = test_start;
end = 0;
found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -262,7 +262,7 @@ static int test_find_delalloc(void)
}
ret = 0;
out_bits:
- clear_extent_bits(&tmp, 0, total_dirty - 1, (unsigned)-1, GFP_NOFS);
+ clear_extent_bits(&tmp, 0, total_dirty - 1, (unsigned)-1, GFP_KERNEL);
out:
if (locked_page)
page_cache_release(locked_page);
@@ -360,7 +360,7 @@ static int test_eb_bitmaps(void)
test_msg("Running extent buffer bitmap tests\n");
- bitmap = kmalloc(len, GFP_NOFS);
+ bitmap = kmalloc(len, GFP_KERNEL);
if (!bitmap) {
test_msg("Couldn't allocate test bitmap\n");
return -ENOMEM;
diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c
index 5de55fdd28bc..e2d3da02deee 100644
--- a/fs/btrfs/tests/inode-tests.c
+++ b/fs/btrfs/tests/inode-tests.c
@@ -974,7 +974,7 @@ static int test_extent_accounting(void)
(BTRFS_MAX_EXTENT_SIZE >> 1) + 4095,
EXTENT_DELALLOC | EXTENT_DIRTY |
EXTENT_UPTODATE | EXTENT_DO_ACCOUNTING, 0, 0,
- NULL, GFP_NOFS);
+ NULL, GFP_KERNEL);
if (ret) {
test_msg("clear_extent_bit returned %d\n", ret);
goto out;
@@ -1045,7 +1045,7 @@ static int test_extent_accounting(void)
BTRFS_MAX_EXTENT_SIZE+8191,
EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0,
- NULL, GFP_NOFS);
+ NULL, GFP_KERNEL);
if (ret) {
test_msg("clear_extent_bit returned %d\n", ret);
goto out;
@@ -1079,7 +1079,7 @@ static int test_extent_accounting(void)
ret = clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0,
- NULL, GFP_NOFS);
+ NULL, GFP_KERNEL);
if (ret) {
test_msg("clear_extent_bit returned %d\n", ret);
goto out;
@@ -1096,7 +1096,7 @@ static int test_extent_accounting(void)
clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
EXTENT_DIRTY | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0,
- NULL, GFP_NOFS);
+ NULL, GFP_KERNEL);
iput(inode);
btrfs_free_dummy_root(root);
return ret;
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] btrfs: tweak free space tree bitmap allocation
2016-01-27 14:01 [PULL][PATCH 0/4] Minor fixes to free-space-tree patchset, for 4.5 David Sterba
2016-01-27 14:02 ` [PATCH 1/4] btrfs: tests: switch to GFP_KERNEL David Sterba
@ 2016-01-27 14:02 ` David Sterba
2016-01-27 14:02 ` [PATCH 3/4] btrfs: add free space tree to lockdep classes David Sterba
2016-01-27 14:02 ` [PATCH 4/4] btrfs: add free space tree to the cow-only list David Sterba
3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-01-27 14:02 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
The requested bitmap size varies, observed numbers were < 4K up to 16K.
Using vmalloc unconditionally would be too heavy, we'll try contiguous
allocations first and fall back to vmalloc if there's no contig memory.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/free-space-tree.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
index 393e36bd5845..0f33d58cb321 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -153,6 +153,20 @@ static inline u32 free_space_bitmap_size(u64 size, u32 sectorsize)
static unsigned long *alloc_bitmap(u32 bitmap_size)
{
+ void *mem;
+
+ /*
+ * The allocation size varies, observed numbers were < 4K up to 16K.
+ * Using vmalloc unconditionally would be too heavy, we'll try
+ * contiguous allocations first.
+ */
+ if (bitmap_size <= PAGE_SIZE)
+ return kzalloc(bitmap_size, GFP_NOFS);
+
+ mem = kzalloc(bitmap_size, GFP_NOFS | __GFP_HIGHMEM | __GFP_NOWARN);
+ if (mem)
+ return mem;
+
return __vmalloc(bitmap_size, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO,
PAGE_KERNEL);
}
@@ -289,7 +303,7 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
ret = 0;
out:
- vfree(bitmap);
+ kvfree(bitmap);
if (ret)
btrfs_abort_transaction(trans, root, ret);
return ret;
@@ -438,7 +452,7 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
ret = 0;
out:
- vfree(bitmap);
+ kvfree(bitmap);
if (ret)
btrfs_abort_transaction(trans, root, ret);
return ret;
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] btrfs: add free space tree to lockdep classes
2016-01-27 14:01 [PULL][PATCH 0/4] Minor fixes to free-space-tree patchset, for 4.5 David Sterba
2016-01-27 14:02 ` [PATCH 1/4] btrfs: tests: switch to GFP_KERNEL David Sterba
2016-01-27 14:02 ` [PATCH 2/4] btrfs: tweak free space tree bitmap allocation David Sterba
@ 2016-01-27 14:02 ` David Sterba
2016-01-27 14:02 ` [PATCH 4/4] btrfs: add free space tree to the cow-only list David Sterba
3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-01-27 14:02 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/disk-io.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c67c129fe99a..ca78bf2ed287 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -176,6 +176,7 @@ static struct btrfs_lockdep_keyset {
{ .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" },
{ .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" },
{ .id = BTRFS_UUID_TREE_OBJECTID, .name_stem = "uuid" },
+ { .id = BTRFS_FREE_SPACE_TREE_OBJECTID, .name_stem = "free-space" },
{ .id = 0, .name_stem = "tree" },
};
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] btrfs: add free space tree to the cow-only list
2016-01-27 14:01 [PULL][PATCH 0/4] Minor fixes to free-space-tree patchset, for 4.5 David Sterba
` (2 preceding siblings ...)
2016-01-27 14:02 ` [PATCH 3/4] btrfs: add free space tree to lockdep classes David Sterba
@ 2016-01-27 14:02 ` David Sterba
3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-01-27 14:02 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/relocation.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index ef6d8fc85853..c5540302402d 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -575,7 +575,8 @@ static int is_cowonly_root(u64 root_objectid)
root_objectid == BTRFS_TREE_LOG_OBJECTID ||
root_objectid == BTRFS_CSUM_TREE_OBJECTID ||
root_objectid == BTRFS_UUID_TREE_OBJECTID ||
- root_objectid == BTRFS_QUOTA_TREE_OBJECTID)
+ root_objectid == BTRFS_QUOTA_TREE_OBJECTID ||
+ root_objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
return 1;
return 0;
}
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-01-27 14:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 14:01 [PULL][PATCH 0/4] Minor fixes to free-space-tree patchset, for 4.5 David Sterba
2016-01-27 14:02 ` [PATCH 1/4] btrfs: tests: switch to GFP_KERNEL David Sterba
2016-01-27 14:02 ` [PATCH 2/4] btrfs: tweak free space tree bitmap allocation David Sterba
2016-01-27 14:02 ` [PATCH 3/4] btrfs: add free space tree to lockdep classes David Sterba
2016-01-27 14:02 ` [PATCH 4/4] btrfs: add free space tree to the cow-only list David Sterba
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).