* [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes.
@ 2014-09-08 18:43 Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 1/3] reiser4: deferred (BA_DEFER) deallocations do not make use of target stage Ivan Shapovalov
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Ivan Shapovalov @ 2014-09-08 18:43 UTC (permalink / raw)
To: reiserfs-devel; +Cc: edward.shishkin, Ivan Shapovalov
Actually, the idea of converting immediate allocations into deferred when
discard is enabled was flawed. Deferred deallocations ignore block stage
and additional flags, while some immediate deallocations use non-standard
stage/flags which do not match what's done by reiser4_post_write_back_hook().
While at it, I've removed specifications of block stage in deferred deallocations.
It is not used anyway. This is first commit.
Next commit does the following. Actually, most of the immediate deallocations
do not need to be considered for discarding: these are deallocations done in
error paths, and respective blocks are never written between their allocation
and deallocation. Two exceptions are deallocations in wandering log code. In these
cases, blocks are allocated, then written, then deallocated without BA_DEFER.
I've just made these deallocations explicitly deferred, which is OK because they
have a suitable block stage.
Last commit actually removes wrong code, again making immediate deallocations
always immediate.
Ivan Shapovalov (3):
reiser4: deferred (BA_DEFER) deallocations do not make use of target stage.
reiser4: mark final deallocations in wandering log code as deferred.
reiser4: block_alloc: get rid of discard-related hack in reiser4_dealloc_blocks().
fs/reiser4/block_alloc.c | 9 +++++++--
fs/reiser4/plugin/txmod.c | 15 +++++----------
fs/reiser4/wander.c | 6 +++---
3 files changed, 15 insertions(+), 15 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC] [PATCHv2 1/3] reiser4: deferred (BA_DEFER) deallocations do not make use of target stage.
2014-09-08 18:43 [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Ivan Shapovalov
@ 2014-09-08 18:43 ` Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 2/3] reiser4: mark final deallocations in wandering log code as deferred Ivan Shapovalov
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Ivan Shapovalov @ 2014-09-08 18:43 UTC (permalink / raw)
To: reiserfs-devel; +Cc: edward.shishkin, Ivan Shapovalov
...so remove it (set to 0) in all cases to avoid confusion.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/block_alloc.c | 6 ++++++
fs/reiser4/plugin/txmod.c | 15 +++++----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/reiser4/block_alloc.c b/fs/reiser4/block_alloc.c
index 324b11c..6e7030a 100644
--- a/fs/reiser4/block_alloc.c
+++ b/fs/reiser4/block_alloc.c
@@ -1010,6 +1010,12 @@ reiser4_dealloc_blocks(const reiser4_block_nr * start,
if ((flags & BA_DEFER) ||
reiser4_is_set(reiser4_get_current_sb(), REISER4_DISCARD)) {
+ /*
+ * These blocks will be later deallocated by apply_dset().
+ * It is equivalent to a non-deferred deallocation with target
+ * stage BLOCK_NOT_COUNTED.
+ */
+
/* store deleted block numbers in the atom's deferred delete set
for further actual deletion */
do {
diff --git a/fs/reiser4/plugin/txmod.c b/fs/reiser4/plugin/txmod.c
index 63d461f..5982b4c 100644
--- a/fs/reiser4/plugin/txmod.c
+++ b/fs/reiser4/plugin/txmod.c
@@ -287,8 +287,7 @@ static int forward_relocate_unformatted(flush_pos_t *flush_pos,
* on relocating - free nodes which are going to be
* relocated
*/
- reiser4_dealloc_blocks(&start, &allocated,
- BLOCK_ALLOCATED, BA_DEFER);
+ reiser4_dealloc_blocks(&start, &allocated, 0, BA_DEFER);
/* assign new block numbers to protected nodes */
assign_real_blocknrs(flush_pos, oid, index, allocated, first_allocated);
@@ -386,16 +385,13 @@ static squeeze_result squeeze_relocate_unformatted(znode *left,
result = put_unit_to_end(left, key, ©_extent);
if (result == -E_NODE_FULL) {
- int target_block_stage;
/*
* free blocks which were just allocated
*/
- target_block_stage =
- (state ==
- ALLOCATED_EXTENT) ? BLOCK_FLUSH_RESERVED :
- BLOCK_UNALLOCATED;
reiser4_dealloc_blocks(&first_allocated, &allocated,
- target_block_stage,
+ (state == ALLOCATED_EXTENT)
+ ? BLOCK_FLUSH_RESERVED
+ : BLOCK_UNALLOCATED,
BA_PERMANENT);
/*
* rewind the preceder
@@ -408,8 +404,7 @@ static squeeze_result squeeze_relocate_unformatted(znode *left,
/*
* free nodes which were relocated
*/
- reiser4_dealloc_blocks(&start, &allocated,
- BLOCK_ALLOCATED, BA_DEFER);
+ reiser4_dealloc_blocks(&start, &allocated, 0, BA_DEFER);
}
/*
* assign new block numbers to protected nodes
--
2.1.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC] [PATCHv2 2/3] reiser4: mark final deallocations in wandering log code as deferred.
2014-09-08 18:43 [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 1/3] reiser4: deferred (BA_DEFER) deallocations do not make use of target stage Ivan Shapovalov
@ 2014-09-08 18:43 ` Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 3/3] reiser4: block_alloc: get rid of discard-related hack in reiser4_dealloc_blocks() Ivan Shapovalov
2014-09-08 19:03 ` [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Edward Shishkin
3 siblings, 0 replies; 8+ messages in thread
From: Ivan Shapovalov @ 2014-09-08 18:43 UTC (permalink / raw)
To: reiserfs-devel; +Cc: edward.shishkin, Ivan Shapovalov
Now there is a clear semantic distinction between deferred and immediate
deallocations. Deferred mode is used to deallocate blocks that were previously
written, immediate mode is used to deallocate "just allocated" blocks in error
paths or if some previously allocated blocks turn out to be unneeded.
This way, we may get rid of discard-related hack in the deallocation routine,
i. e. treating immediate deallocations as deferred (which messes up
block accounting). This is done in the next commit.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/wander.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/reiser4/wander.c b/fs/reiser4/wander.c
index 04ddec6..fd5954a 100644
--- a/fs/reiser4/wander.c
+++ b/fs/reiser4/wander.c
@@ -482,8 +482,8 @@ static void dealloc_tx_list(struct commit_handle *ch)
jnode *cur = list_entry(ch->tx_list.next, jnode, capture_link);
list_del(&cur->capture_link);
ON_DEBUG(INIT_LIST_HEAD(&cur->capture_link));
- reiser4_dealloc_block(jnode_get_block(cur), BLOCK_NOT_COUNTED,
- BA_FORMATTED);
+ reiser4_dealloc_block(jnode_get_block(cur), 0,
+ BA_DEFER | BA_FORMATTED);
unpin_jnode_data(cur);
reiser4_drop_io_head(cur);
@@ -502,7 +502,7 @@ dealloc_wmap_actor(txn_atom * atom UNUSED_ARG,
assert("zam-500", *b != 0);
assert("zam-501", !reiser4_blocknr_is_fake(b));
- reiser4_dealloc_block(b, BLOCK_NOT_COUNTED, BA_FORMATTED);
+ reiser4_dealloc_block(b, 0, BA_DEFER | BA_FORMATTED);
return 0;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC] [PATCHv2 3/3] reiser4: block_alloc: get rid of discard-related hack in reiser4_dealloc_blocks().
2014-09-08 18:43 [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 1/3] reiser4: deferred (BA_DEFER) deallocations do not make use of target stage Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 2/3] reiser4: mark final deallocations in wandering log code as deferred Ivan Shapovalov
@ 2014-09-08 18:43 ` Ivan Shapovalov
2014-09-08 19:03 ` [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Edward Shishkin
3 siblings, 0 replies; 8+ messages in thread
From: Ivan Shapovalov @ 2014-09-08 18:43 UTC (permalink / raw)
To: reiserfs-devel; +Cc: edward.shishkin, Ivan Shapovalov
When discard was enabled, immediate deallocations were made deferred in order
to record these extents in the atom's delete set and, consequently, allow
their discarding.
However, this is wrong in the following way. Immediate deallocations make use
of target allocation stage and ancillary flags like BA_PERMANENT and BA_FORMATTED.
By converting immediate deallocations to deferred, these flags are essentially
dropped, and application of deferred deallocations in reiser4_post_write_back_hook()
uses an equivalent of BLOCK_NOT_COUNTED stage and BA_FORMATTED flag.
Dropping this hack does not hinder efficiency of the discard procedure, because
immediate deallocations are now used only to deallocate "just allocated" and not
yet written blocks, which actually do not need to be discarded.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/block_alloc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/reiser4/block_alloc.c b/fs/reiser4/block_alloc.c
index 6e7030a..fee1c18 100644
--- a/fs/reiser4/block_alloc.c
+++ b/fs/reiser4/block_alloc.c
@@ -1008,8 +1008,7 @@ reiser4_dealloc_blocks(const reiser4_block_nr * start,
spin_unlock_reiser4_super(sbinfo);
}
- if ((flags & BA_DEFER) ||
- reiser4_is_set(reiser4_get_current_sb(), REISER4_DISCARD)) {
+ if (flags & BA_DEFER) {
/*
* These blocks will be later deallocated by apply_dset().
* It is equivalent to a non-deferred deallocation with target
--
2.1.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes.
2014-09-08 18:43 [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Ivan Shapovalov
` (2 preceding siblings ...)
2014-09-08 18:43 ` [RFC] [PATCHv2 3/3] reiser4: block_alloc: get rid of discard-related hack in reiser4_dealloc_blocks() Ivan Shapovalov
@ 2014-09-08 19:03 ` Edward Shishkin
2014-09-08 19:52 ` Ivan Shapovalov
3 siblings, 1 reply; 8+ messages in thread
From: Edward Shishkin @ 2014-09-08 19:03 UTC (permalink / raw)
To: Ivan Shapovalov; +Cc: reiserfs-devel
Ok, I'll include this to the 3.15.2-reiser4-basic-discard-support.patch
As to 3.16: unfortunately the ancient bug, which leads to non-deleted
directories raised the head in 3.16. I don't want to release buggy stuff.
So let's work around the stable 3.15 for now..
Thanks,
Edward.
On 09/08/2014 08:43 PM, Ivan Shapovalov wrote:
> Actually, the idea of converting immediate allocations into deferred when
> discard is enabled was flawed. Deferred deallocations ignore block stage
> and additional flags, while some immediate deallocations use non-standard
> stage/flags which do not match what's done by reiser4_post_write_back_hook().
>
> While at it, I've removed specifications of block stage in deferred deallocations.
> It is not used anyway. This is first commit.
>
> Next commit does the following. Actually, most of the immediate deallocations
> do not need to be considered for discarding: these are deallocations done in
> error paths, and respective blocks are never written between their allocation
> and deallocation. Two exceptions are deallocations in wandering log code. In these
> cases, blocks are allocated, then written, then deallocated without BA_DEFER.
> I've just made these deallocations explicitly deferred, which is OK because they
> have a suitable block stage.
>
> Last commit actually removes wrong code, again making immediate deallocations
> always immediate.
>
> Ivan Shapovalov (3):
> reiser4: deferred (BA_DEFER) deallocations do not make use of target stage.
> reiser4: mark final deallocations in wandering log code as deferred.
> reiser4: block_alloc: get rid of discard-related hack in reiser4_dealloc_blocks().
>
> fs/reiser4/block_alloc.c | 9 +++++++--
> fs/reiser4/plugin/txmod.c | 15 +++++----------
> fs/reiser4/wander.c | 6 +++---
> 3 files changed, 15 insertions(+), 15 deletions(-)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes.
2014-09-08 19:03 ` [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Edward Shishkin
@ 2014-09-08 19:52 ` Ivan Shapovalov
2014-09-08 20:19 ` Edward Shishkin
0 siblings, 1 reply; 8+ messages in thread
From: Ivan Shapovalov @ 2014-09-08 19:52 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Edward Shishkin
[-- Attachment #1: Type: text/plain, Size: 501 bytes --]
On Monday 08 September 2014 at 21:03:17, Edward Shishkin wrote:
> Ok, I'll include this to the 3.15.2-reiser4-basic-discard-support.patch
Good, at least this is done...
>
> As to 3.16: unfortunately the ancient bug, which leads to non-deleted
> directories raised the head in 3.16. I don't want to release buggy stuff.
> So let's work around the stable 3.15 for now..
Uhm, what relation does that bug have to 3.16? Does it manifest itself more often?
--
Ivan Shapovalov / intelfx /
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes.
2014-09-08 19:52 ` Ivan Shapovalov
@ 2014-09-08 20:19 ` Edward Shishkin
2014-09-08 21:13 ` Ivan Shapovalov
0 siblings, 1 reply; 8+ messages in thread
From: Edward Shishkin @ 2014-09-08 20:19 UTC (permalink / raw)
To: Ivan Shapovalov, reiserfs-devel
On 09/08/2014 09:52 PM, Ivan Shapovalov wrote:
> On Monday 08 September 2014 at 21:03:17, Edward Shishkin wrote:
>> Ok, I'll include this to the 3.15.2-reiser4-basic-discard-support.patch
> Good, at least this is done...
>
>> As to 3.16: unfortunately the ancient bug, which leads to non-deleted
>> directories raised the head in 3.16. I don't want to release buggy stuff.
>> So let's work around the stable 3.15 for now..
> Uhm, what relation does that bug have to 3.16? Does it manifest itself more often?
I can reproduce it in 3.10, 3.16.
I can not in 3.11 - 3.15..
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes.
2014-09-08 20:19 ` Edward Shishkin
@ 2014-09-08 21:13 ` Ivan Shapovalov
0 siblings, 0 replies; 8+ messages in thread
From: Ivan Shapovalov @ 2014-09-08 21:13 UTC (permalink / raw)
To: Edward Shishkin; +Cc: reiserfs-devel
[-- Attachment #1: Type: text/plain, Size: 448 bytes --]
On Monday 08 September 2014 at 22:19:35, Edward Shishkin wrote:
> [..]
> > Uhm, what relation does that bug have to 3.16? Does it manifest itself more often?
>
>
> I can reproduce it in 3.10, 3.16.
> I can not in 3.11 - 3.15..
Hm. Never encountered such bug.
That said, do you have any plans on fixing that? ;) Or will we just sit with 3.15
and wait for a kernel when it suddenly stops appearing?
--
Ivan Shapovalov / intelfx /
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-08 21:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-08 18:43 [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 1/3] reiser4: deferred (BA_DEFER) deallocations do not make use of target stage Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 2/3] reiser4: mark final deallocations in wandering log code as deferred Ivan Shapovalov
2014-09-08 18:43 ` [RFC] [PATCHv2 3/3] reiser4: block_alloc: get rid of discard-related hack in reiser4_dealloc_blocks() Ivan Shapovalov
2014-09-08 19:03 ` [RFC] [PATCHv2 0/3] reiser4: block deallocation fixes Edward Shishkin
2014-09-08 19:52 ` Ivan Shapovalov
2014-09-08 20:19 ` Edward Shishkin
2014-09-08 21:13 ` Ivan Shapovalov
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).