]> git.neil.brown.name Git - LaFS.git/log
LaFS.git
15 years agoMinor updates to 'go' script.
NeilBrown [Fri, 25 Jun 2010 05:59:39 +0000 (15:59 +1000)]
Minor updates to 'go' script.

Trigger a global stack trace if we block at unmount.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoClean up final check of leafs lists.
NeilBrown [Fri, 25 Jun 2010 05:57:52 +0000 (15:57 +1000)]
Clean up final check of leafs lists.

Clearing the Pinned bit just confused the following
printout, so skip that.
And check that clean_leafs is empty too.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoStop using AOP_WRITEPAGE_ACTIVATE
NeilBrown [Wed, 23 Jun 2010 02:34:35 +0000 (12:34 +1000)]
Stop using AOP_WRITEPAGE_ACTIVATE

This is the wrong thing to do.
I need to redirty and unlock the page.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDon't allow memory flush to write out segusage blocks.
NeilBrown [Wed, 23 Jun 2010 02:29:57 +0000 (12:29 +1000)]
Don't allow memory flush to write out segusage blocks.

We always write these after a checkpoint, and there is little to be
gained by writing them earlier, and doing so causes their
dirty status to be lost, which is bad.

They should be treated much like PinPending blocks, but they
are not PinPending as they are written later in the checkpoint.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix inode_orphan_handler issues.
NeilBrown [Wed, 23 Jun 2010 02:23:50 +0000 (12:23 +1000)]
Fix inode_orphan_handler issues.

1/ a stray ';' caused a while loop not to work.

2/ If the for loop finds a block with a 'primary' reference,
  just incorporating it won't help.  We need to find the last
  block so we know it has not primary reference, so it will
  get unpinned by the lafs_cluster_allocate call, and so
  will remove the primary reference.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agolafs_refile: fix nextparent handing.
NeilBrown [Wed, 23 Jun 2010 02:14:34 +0000 (12:14 +1000)]
lafs_refile: fix nextparent handing.

It is now possible that 'nextparent' is already a sibling of
the current block (inoidx vs ino data).  So handle that, and
generally clean up the code.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoCheck we haven't allocated too many flags.
NeilBrown [Wed, 23 Jun 2010 01:53:40 +0000 (11:53 +1000)]
Check we haven't allocated too many flags.

Simple compile-time checking that we haven't
allocated too many B_* flags.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agolafs_space_alloc - avoid underflow of unsigned numbers
NeilBrown [Wed, 23 Jun 2010 01:52:00 +0000 (11:52 +1000)]
lafs_space_alloc - avoid underflow of unsigned numbers

As the numbers in the calc are unsigned, use only additions
to avoid anything going negative.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoEnsure InoIdx block is really empty before erasing it.
NeilBrown [Wed, 23 Jun 2010 01:48:28 +0000 (11:48 +1000)]
Ensure InoIdx block is really empty before erasing it.

We we missing the test for non-empty children.
So move the block of code to after that test.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoincorporate_internal: remove unnecessary setting of 'buf'
NeilBrown [Wed, 23 Jun 2010 01:46:22 +0000 (11:46 +1000)]
incorporate_internal: remove unnecessary setting of 'buf'

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agofix leaf_lookup for indirect blocks.
NeilBrown [Wed, 23 Jun 2010 01:44:34 +0000 (11:44 +1000)]
fix leaf_lookup for indirect blocks.

If the space was an exact multiple of 6 bytes, we would not consider
the final entry as a possible 'next'.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agowalk_index: fix "found end of addresses" detection.
NeilBrown [Wed, 23 Jun 2010 01:41:21 +0000 (11:41 +1000)]
walk_index: fix "found end of addresses" detection.

As phys was being overloaded slightly, this was broken.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoleaf_lookup: fix mis-handling of addressed before first entry.
NeilBrown [Wed, 23 Jun 2010 01:38:43 +0000 (11:38 +1000)]
leaf_lookup: fix mis-handling of addressed before first entry.

If target < addr, then the first entry should be returned
a 'next', not consumed and ignored.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoleaf_lookup: simplify.
NeilBrown [Wed, 23 Jun 2010 01:36:55 +0000 (11:36 +1000)]
leaf_lookup: simplify.

Make decodeX calls more uniform, and avoid some
unnecessary arithmetic.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoleaf_lookup - avoid variable shadowing.
NeilBrown [Wed, 23 Jun 2010 01:30:31 +0000 (11:30 +1000)]
leaf_lookup - avoid variable shadowing.

Two vars in same scope called 'len'.
Second we should really use 'elen' for.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoWhen cluster_allocate and EmptyIndex block, clear Dirty flags
NeilBrown [Wed, 23 Jun 2010 01:27:40 +0000 (11:27 +1000)]
When cluster_allocate and EmptyIndex block, clear Dirty flags

Because that is what cluster allocate is supposed to do...

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoPin inode data blocks when dirtying them.
NeilBrown [Wed, 23 Jun 2010 01:25:17 +0000 (11:25 +1000)]
Pin inode data blocks when dirtying them.

Two places we were dirtying an inode data block that might
not have been pinned.  Fix them.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agospace_alloc is being called badly.
NeilBrown [Tue, 22 Jun 2010 21:01:52 +0000 (07:01 +1000)]
space_alloc is being called badly.

The is/then/else structure in both these cases is just wrong.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoSet EmptyIndex where appropriate.
NeilBrown [Tue, 22 Jun 2010 06:08:51 +0000 (16:08 +1000)]
Set EmptyIndex where appropriate.

When an index block becomes empty during incorp, mark it as
Empty.
All that other special handling we had now seems to be over-kill.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAllow EmptyIndex blocks to be written
NeilBrown [Tue, 22 Jun 2010 05:42:49 +0000 (15:42 +1000)]
Allow EmptyIndex blocks to be written

They are stored as phys address 0.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAllow empty index blocks to be loaded.
NeilBrown [Tue, 22 Jun 2010 05:36:37 +0000 (15:36 +1000)]
Allow empty index blocks to be loaded.

If physaddr is 0, then just create a clean index block.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoHonour EmptyIndex during index lookup.
NeilBrown [Tue, 22 Jun 2010 05:32:05 +0000 (15:32 +1000)]
Honour EmptyIndex during index lookup.

If we find an EmptyIndex that isn't first in the parent, we must
choose an earlier block.
We must check EmptyIndex after getting the lock.
If we have to drop a lock to do IO, and the unlocked block has a
->parent pointer, then we need to retry from the top.
'next' needs special care as it is could point to an
EmptyIndex block, so it is possible for leafs earlier in the tree to
have higher fileaddr (unlikely but possible).

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAdd EmptyIndex flag.
NeilBrown [Tue, 22 Jun 2010 02:35:32 +0000 (12:35 +1000)]
Add EmptyIndex flag.

This signals that an index block is known to be empty and
should normally be ignored.

It may never be set on an InoIdx block.
Normally it stays set once set.  However for the first index block
in a parent, it can be cleared again if any children appear.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFilter empty block from uninc change before incorporation.
NeilBrown [Tue, 22 Jun 2010 02:32:07 +0000 (12:32 +1000)]
Filter empty block from uninc change before incorporation.

It is possible (though unusual) for an uninc chain to have
two block with the same fileaddr, one that is empty and being ignored,
and one that is newly split off and needs to be incorporated.
We need to detect this possibility after sorting and discard the
empty block so it doesn't confuse further incorporation.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDelay hashing of index blocks until they are incorporated.
NeilBrown [Tue, 22 Jun 2010 02:13:45 +0000 (12:13 +1000)]
Delay hashing of index blocks until they are incorporated.

We don't need an index block in the hash table until its
address is in the parent, as until then we will never try a lookup.

And it is good to delay it as it is possible for there to be two
blocks with the same address, one that is empty and thus ignored
mostly, and one that has since split of an earlier child.
While this is unlikely, we don't want that split-off block to
appear in the hash table until both have been incorporated.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRevert a21596e51b872635c7cb0683a21fff981f5d3716
NeilBrown [Tue, 22 Jun 2010 02:05:12 +0000 (12:05 +1000)]
Revert a21596e51b872635c7cb0683a21fff981f5d3716

As index block don't change addresses after all, this isn't needed.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRevert 7cfdec7d8156a8961c3413cca8e92340768c5b97
NeilBrown [Tue, 22 Jun 2010 01:50:49 +0000 (11:50 +1000)]
Revert 7cfdec7d8156a8961c3413cca8e92340768c5b97

Undo that format change.  It turned out to be a bad idea.
Index blocks should never change address, it is too confusing
and not needed.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRevert 1736b5f072c4f89cc641fb0a1991d9c145c411ec
NeilBrown [Tue, 22 Jun 2010 01:36:33 +0000 (11:36 +1000)]
Revert 1736b5f072c4f89cc641fb0a1991d9c145c411ec

... well, most of it.

Turns out this was a bad idea.  An index block should never
change address, so we can never try to incorp stuff before the start
of an indirect block.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agointroduce lafs_iolock_block_async
NeilBrown [Mon, 21 Jun 2010 05:40:40 +0000 (15:40 +1000)]
introduce lafs_iolock_block_async

In several places we want this an open code it.
Just write the real code.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoallocate_block fixes.
NeilBrown [Mon, 21 Jun 2010 04:55:26 +0000 (14:55 +1000)]
allocate_block fixes.

Try to set up slightly new rules....

1/ Adding an address as unincorporated requires just a spinlock,
    the inode private_lock
2/ The block with an address being added is not iolock, but is
    Writebehind
3/ incorporation happens under iolock,  removing the list of
    pending addresses also happens here.  so under iolock
    addresses can be added to list but not removed (unless I'm doing
    the removing).

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRevise rule for inode data blocks as leafs.
NeilBrown [Mon, 21 Jun 2010 03:40:16 +0000 (13:40 +1000)]
Revise rule for inode data blocks as leafs.

We cannot process an inode data block as a leaf before processing
the InoIdx block.

Previously we would unpin an inode data block if the InoIdx block
should take priority.  But that is problematic.
Instead we simply take the inode data block off the leaf list.

This means we have to put it back on when the InoIdx gets unpinned
or phase-flipped.

At same time, tidy up determination of 'is a leaf' as this is used
both when adding something to a leaf list, and when taking something
off.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoChange lafs_phase_flip to take an indexblock
NeilBrown [Mon, 21 Jun 2010 01:32:12 +0000 (11:32 +1000)]
Change lafs_phase_flip to take an indexblock

As lafs_phase_flip is only ever passed an indexblock, make that
explicit in the signature, and remove any tests for B_Index and
they will always be True.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoBetter tracking of whether orphan handling is running.
NeilBrown [Mon, 21 Jun 2010 01:05:15 +0000 (11:05 +1000)]
Better tracking of whether orphan handling is running.

At unmount we need to wait for all orphan handling to
complete.
Just checking the list of orphan blocks is not enough
as it is empty while the handling is actually happening.
So add a state flag to help out.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoprealloc extra space for directory blocks.
NeilBrown [Mon, 21 Jun 2010 00:57:43 +0000 (10:57 +1000)]
prealloc extra space for directory blocks.

We need double space when preallocing for a transaction,
so that included Directories as well.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoincorporate: don't remove children prematurely.
NeilBrown [Mon, 21 Jun 2010 00:56:28 +0000 (10:56 +1000)]
incorporate: don't remove children prematurely.

We cannot just remove a child.  So to get it out of the PrimaryRef
chain, move it to the end of the child list.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDon't treat leaf-index blocks with children as empty.
NeilBrown [Mon, 21 Jun 2010 00:50:06 +0000 (10:50 +1000)]
Don't treat leaf-index blocks with children as empty.

They might be now, but they won't be soon.  Probably.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDon't let writepage spoil a transaction.
NeilBrown [Mon, 21 Jun 2010 00:39:00 +0000 (10:39 +1000)]
Don't let writepage spoil a transaction.

If a block is involved in a transaction (e.g. dir update) we
mustn't allow writepage to flush the page until the transaction
completes.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoEnsure that umount gets woken when a checkpoint completes.
NeilBrown [Mon, 21 Jun 2010 00:33:44 +0000 (10:33 +1000)]
Ensure that umount gets woken when a checkpoint completes.

We really need to call wake_up when ->checkpointing becomes 0.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoWait for segment-scan to finish before unmount.
NeilBrown [Mon, 21 Jun 2010 00:19:25 +0000 (10:19 +1000)]
Wait for segment-scan to finish before unmount.

It might be best to come up with a way to abort the scan,
but we won't want it to be running when we unmount, so wait
for it to complete and ensure it doesn't restart.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDisable cleaner earlier at unmount.
NeilBrown [Mon, 21 Jun 2010 00:23:01 +0000 (10:23 +1000)]
Disable cleaner earlier at unmount.

We need to disable the cleaner a little earlier or it can run after we
have waited for it to finish.
So create a new flag.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoTemp fix for delaying youth updates.
NeilBrown [Mon, 21 Jun 2010 00:11:33 +0000 (10:11 +1000)]
Temp fix for delaying youth updates.

When we allocate a new segment during checkpoint we need to
delay the youth block update, possibly until the roll-forward.

This is just a simple hack to avoid the worst of the problem
but we need to properly delay it at some stage.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoSmall tidy up for lafs_seg_ref_block
NeilBrown [Mon, 21 Jun 2010 00:05:10 +0000 (10:05 +1000)]
Small tidy up for  lafs_seg_ref_block

Slight doco improvement, make local variables more local etc.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoSegRef fixes.
NeilBrown [Sun, 20 Jun 2010 23:41:51 +0000 (09:41 +1000)]
SegRef fixes.

We mustn't hold a SegRef for blocks which aren't going to be accounted
in any segment usage counts.

This means we should never hold SegRef on the Root block, and if we
decide not to account certain block during unmount - as roll-forward
will account them - we should drop SegRef promptly.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAdd casts to shifts which should change type width.
NeilBrown [Sun, 20 Jun 2010 23:33:18 +0000 (09:33 +1000)]
Add casts to shifts which should change type width.

Sometimes when we left-shift a value it is possible that the
new value will require more bits to represent.
In those cases we first need to cast the value to the appropriately
sized type.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agocleaner: when erasing a datablock, cancel any pending cleaning.
NeilBrown [Fri, 18 Jun 2010 12:32:29 +0000 (22:32 +1000)]
cleaner: when erasing a datablock, cancel any pending cleaning.

This requires a bit of locking, but ensure that after erase_dblock,
the block is no longer in use, so truncate orphan handling doesn't
find children that it doesn't expect.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agounmount: clean up waiting for things.
NeilBrown [Fri, 18 Jun 2010 11:58:34 +0000 (21:58 +1000)]
unmount: clean up waiting for things.

 The unmount thread should run any orphans.  That should be
 left to the cleaner thread.
 It might be useful to wait for the cleaner to finish up.
 An alternate might be to release all pending-for-clean blocks.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoIncorp: improve setting of address after split.
NeilBrown [Fri, 18 Jun 2010 11:47:27 +0000 (21:47 +1000)]
Incorp: improve setting of address after split.

When we split a block, the address of the second half should be the
first address that won't fit in the original block.
Currently it is the first address that didn't fit.  If we end up
adding blocks in reverse address order, this could cause each new
block to require a split.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomodify: avoid breaking an PrimaryRef chain
NeilBrown [Fri, 18 Jun 2010 11:29:20 +0000 (21:29 +1000)]
modify: avoid breaking an PrimaryRef chain

When we insert a new block into a PrimaryRef chain, we need to take
the new refcnt on the new block (which is now primary for the
following block) rather than than the block from which we split (on
which a primary_ref is already held).

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agosegments: fix array sizes.
NeilBrown [Fri, 18 Jun 2010 11:15:25 +0000 (21:15 +1000)]
segments: fix array sizes.

Heights range from 0 up, so the array must be sized
one larger than that maximum height.  So defined
SEG_NUM_HEIGHTS instead of SEG_MAX_HEIGHT, and make it one more.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoREADME update
NeilBrown [Sun, 13 Jun 2010 23:16:46 +0000 (09:16 +1000)]
README update

15 years agoRemove sort_uninc
NeilBrown [Sun, 13 Jun 2010 10:19:38 +0000 (20:19 +1000)]
Remove sort_uninc

We now keep the uninc table sorted, so we don't need to
sort it.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoHandle extents getting added before an indirect block.
NeilBrown [Sun, 13 Jun 2010 10:11:56 +0000 (20:11 +1000)]
Handle extents getting added before an indirect block.

Now that indirect blocks are 'mobile' and can have a
start address, it is possible that an extent in uninc_table
starts before the indirect addresses.
In this case the logic that assured us there was room for all
the addresses fall down.

So detect that case earlier and force the indirect block
to either start at the start of the uninc bloc, or become
an extent block.  Possibly it will split as part of this.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix handling of extents during incorporation.
NeilBrown [Sun, 13 Jun 2010 09:24:17 +0000 (19:24 +1000)]
Fix handling of extents during incorporation.

Modifying the indexblock in walk_extent is bad.
We could be using walk_extent just to examine the block,
so making changes causes corruption.
Also, there were two other places where we weren't making changes,
but later assumed we had.

So don't make any changes, and don't assume any changes
have been made.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agowalk_extent bug fixes.
NeilBrown [Sun, 13 Jun 2010 08:19:30 +0000 (18:19 +1000)]
walk_extent bug fixes.

If walk_extent aborts, it needs to update the current extent from
the index block as it might....
No, that is bad - we might be checking, so an update is not wanted!

15 years agoImprove prune_some call sequence.
NeilBrown [Sun, 13 Jun 2010 08:02:21 +0000 (18:02 +1000)]
Improve prune_some call sequence.

We only need to use prune_some rather than prune if there
are addresses that will remain untouched, and we can easily
check for that.

Also, only dirty the block if prune_some actually makes a change.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoWhen incorp empty child out of parent, remove from uninc list.
NeilBrown [Sun, 13 Jun 2010 07:54:43 +0000 (17:54 +1000)]
When incorp empty child out of parent, remove from uninc list.

When we notice that an index block is empty and so remove
it from the parent, we need to remove it from the uninc list
and also clear any Dirty bit.

Also, the check for children turns out to be pointless.  I
was confused by the uninc list I think.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoBetter handling of upward recursive empty index deletion.
NeilBrown [Sun, 13 Jun 2010 07:51:00 +0000 (17:51 +1000)]
Better handling of upward recursive empty index deletion.

When an empty index blocks makes the parent empty, we recurse
up.
When we do that, we need to again perform the check for there
being children, and for this being an InoIdx block.
So jump further back, and tidy up the exit path to ensure we still
unlock properly.

This makes the extra check for InoIdx pointless.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRemove last trace of setting depth to zero for empty index blocks.
NeilBrown [Sun, 13 Jun 2010 07:40:18 +0000 (17:40 +1000)]
Remove last trace of setting depth to zero for empty index blocks.

This turned out to be a bad idea, but bits were still hanging around.
All cleaned up now.
Only the InoIdx block can be depth==0, and only when data is stored
in there rather than indexes.
As it is not hashed, changing its depth is safe.  Changing the depth
of any other index block is not safe, and is now not done.

As part of this, clean up usage of lafs_clear_index.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agounhash iblock when it becomes empty.
NeilBrown [Sun, 13 Jun 2010 07:16:30 +0000 (17:16 +1000)]
unhash iblock when it becomes empty.

Our handling of empty iblocks was flawed - when they become empty they
stayed in the hash table and could be found again - bad.

So unhash them.
To keep things tidy, always use hlist_del_init to removing things from
the hash table, and assert that they are present before removing, and
that they aren't before adding.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoincorporate: don't leave ->depth at 0
NeilBrown [Thu, 10 Jun 2010 06:37:03 +0000 (16:37 +1000)]
incorporate: don't leave ->depth at 0

When we incorporate a block make sure the depth
doesn't stay 0 unless it really is empty.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agotruncate: when we clear an InoIdx block set the set.
NeilBrown [Thu, 10 Jun 2010 06:34:28 +0000 (16:34 +1000)]
truncate: when we clear an InoIdx block set the set.

We use depth == 0 to saw the index block is empty.
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agolafs_incorporate InoIdx: avoid depth change when children present.
NeilBrown [Thu, 10 Jun 2010 06:32:39 +0000 (16:32 +1000)]
lafs_incorporate InoIdx: avoid depth change when children present.

If an InoIdx block appear empty but still has children we don't
want to change the depth as that can be confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoinode_orphan: convert do-while to a normal while.
NeilBrown [Thu, 10 Jun 2010 06:24:05 +0000 (16:24 +1000)]
inode_orphan: convert do-while to a normal while.

The justification for the do-while has long since gone,
so use a more natural while loop.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoREADME update
NeilBrown [Thu, 10 Jun 2010 06:15:45 +0000 (16:15 +1000)]
README update

15 years agoinclude iolock info in strblk
NeilBrown [Thu, 10 Jun 2010 06:12:49 +0000 (16:12 +1000)]
include iolock info in strblk

Also make sure info is useful when iolock_written is used.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agogrow_index_tree: handle B_Root correctly
NeilBrown [Thu, 10 Jun 2010 06:02:14 +0000 (16:02 +1000)]
grow_index_tree: handle B_Root correctly

When a grow the index tree for the root inode, the B_Root
bit needs to be moved to the new block.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoEnsure indexblock is clean when truncate finished.
NeilBrown [Thu, 10 Jun 2010 05:57:07 +0000 (15:57 +1000)]
Ensure indexblock is clean when truncate finished.

When truncate finishes and we are about to delete the inode,
we need to have the index block clean and unpinned so it can disappear
cleanly.
lafs_cluster_allocate nicely does this for us.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAvoid deadlock between orphan-truncate and cluster-write
NeilBrown [Thu, 10 Jun 2010 05:52:45 +0000 (15:52 +1000)]
Avoid deadlock between orphan-truncate and cluster-write

If, during truncate, we find an index block in writeback,
we need to give up on the orphan and return back up
to the cleaner thread so that the writeback can be
properly handled.
Otherwise the cleaner thread is blocked waiting for the cleaner thread
to make progress.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agocorrect arg to kfree in refile
NeilBrown [Thu, 10 Jun 2010 05:39:38 +0000 (15:39 +1000)]
correct arg to kfree in refile

'b' is a struct-block, technically a virtual type.
Need to get container_of - dblk in this case - before calling
kfree.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agolafs_iblock_alloc: remove duplicate assignment
NeilBrown [Thu, 10 Jun 2010 05:38:22 +0000 (15:38 +1000)]
lafs_iblock_alloc: remove duplicate assignment

Signed-off-by: <neilb@suse.de>
15 years agoCheck still dirty before calling cluster_allocate
NeilBrown [Thu, 10 Jun 2010 05:36:55 +0000 (15:36 +1000)]
Check still dirty before calling cluster_allocate

If we wait (iolock) before calling cluster_allocate we need to check
again if it is dirty, as cluster_allocate only likes dirty/realloc
blocks.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoIntroduce constants for 'sync' and 'adopt' flags.
NeilBrown [Wed, 9 Jun 2010 03:55:00 +0000 (13:55 +1000)]
Introduce constants for 'sync' and 'adopt' flags.

This is much better than having '0' and '1' and arguments in hard to
remember places.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoSet PrimaryRef in do_incorporate_internal
NeilBrown [Wed, 9 Jun 2010 03:45:05 +0000 (13:45 +1000)]
Set PrimaryRef in do_incorporate_internal

Add primaryref handling in do_incorporate_internal to
match do_incorporate_leaf.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix Primary Ref counting when removing an unincorporated block.
NeilBrown [Wed, 9 Jun 2010 03:40:07 +0000 (13:40 +1000)]
Fix Primary Ref counting when removing an unincorporated block.

incorp_index did the wrong thing here, and we didn't differentiate
where in a primary_ref chain we were.
Fixed now I hope.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix handling of empty index blocks during incorporation.
NeilBrown [Wed, 9 Jun 2010 03:23:14 +0000 (13:23 +1000)]
Fix handling of empty index blocks during incorporation.

If an index block becomes empty we incorporate the address space into
the next index block, and so need to update the address of the leading
children and fix the indexes in the parent properly.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix problem with mobility of internal index blocks.
NeilBrown [Wed, 9 Jun 2010 02:14:07 +0000 (12:14 +1000)]
Fix problem with mobility of internal index blocks.

As index blocks can change address if they are or become the first
block in the parent, we must not put too much weight on the first
address stored in an internal index block - it must always be treated
as the same as the address of that internal index block.

So pass around the current block's address where needed, and use it in
preference to the first address recorded in the block.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agolafs_incorporate: bug on not dirty.
NeilBrown [Tue, 8 Jun 2010 08:25:18 +0000 (18:25 +1000)]
lafs_incorporate: bug on not dirty.

We already had some of these, but a few more doesn't hurt :-)

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoremove_from_index: various fixes.
NeilBrown [Tue, 8 Jun 2010 08:22:39 +0000 (18:22 +1000)]
remove_from_index: various fixes.

1/ Skip offset for InoIdx
2/ when moving address down, clear the space at the end
3/ stop when we find the last address.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agolafs_walk_leaf_index
NeilBrown [Tue, 8 Jun 2010 08:18:59 +0000 (18:18 +1000)]
lafs_walk_leaf_index

remove stray handler initialisation.
Both walk_indirect and walk_extent do an initialisation
so there is no point doing another one.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agowalk_extent: don't keep walking past the end of the list of addresses
NeilBrown [Tue, 8 Jun 2010 08:15:54 +0000 (18:15 +1000)]
walk_extent:  don't keep walking past the end of the list of addresses

Once we find a len of 0, there is nothing more worth finding.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoadd_extent fixes.
NeilBrown [Tue, 8 Jun 2010 08:13:13 +0000 (18:13 +1000)]
add_extent fixes.

add_extent tries to detect consecutive extents being added
and merges them.  But it got it wrong.
So change last* to actually refer to the "next" and get it right.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agotruncate: fixes for pruning addresses.
NeilBrown [Tue, 8 Jun 2010 08:10:37 +0000 (18:10 +1000)]
truncate: fixes for pruning addresses.

1/ after pruning addresses, we need to clear the index block
2/ InoIdx blocks don't follow the rule that physaddr==0 means empty.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agotruncate: can only safely lafs_incorporate dirty blocks.
NeilBrown [Tue, 8 Jun 2010 08:07:59 +0000 (18:07 +1000)]
truncate: can only safely lafs_incorporate dirty blocks.

So if the block isn't dirty, don't try.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoSet depth to 0 when InoIdx becomes empty.
NeilBrown [Tue, 8 Jun 2010 07:49:04 +0000 (17:49 +1000)]
Set depth to 0 when InoIdx becomes empty.

The code set depth to zero always, which is clearly broken.

We don't incrementally reduce the height of an indexing tree as it
shrinks.  Rather the high remains at the max until it is completely
empty, then it suddenly becomes zero.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoClear B_OnFree when removing from freelist.
NeilBrown [Tue, 8 Jun 2010 07:32:57 +0000 (17:32 +1000)]
Clear B_OnFree when removing from freelist.

This isn't strictly necessary as if refile want to use the
LRU for something else, it will clear this bit.
However clearing it both places makes for more consistency and less
confusing data structures.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoREADME sync
NeilBrown [Mon, 7 Jun 2010 03:23:59 +0000 (13:23 +1000)]
README sync

and typo fix

15 years agoRemove stray test is inode_handle_orphan
NeilBrown [Mon, 7 Jun 2010 03:20:08 +0000 (13:20 +1000)]
Remove stray test is inode_handle_orphan

As we no longer clear B_Valid on empty index blocks,
there is no point or need to test for it.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoBUG_ON in lafs_allocated_block.
NeilBrown [Mon, 7 Jun 2010 03:18:43 +0000 (13:18 +1000)]
BUG_ON in lafs_allocated_block.

We never allocate an InoIdx block - on the data block.
So add a BUG check.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix a BUG_ON in lafs_erase_dblock
NeilBrown [Mon, 7 Jun 2010 03:16:45 +0000 (13:16 +1000)]
Fix a BUG_ON  in lafs_erase_dblock

As we no longer clear the Valid flag on index blocks when
they become empty, we can no longer trigger a bug if it
is still set.
However depth should definitely be 0, so test for that.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAdd some error checking to lafs_mount
NeilBrown [Mon, 7 Jun 2010 03:13:54 +0000 (13:13 +1000)]
Add some error checking to lafs_mount

i.e. just return the error code if there is one.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMake sure find_block loads data from inode.
NeilBrown [Mon, 7 Jun 2010 01:30:48 +0000 (11:30 +1000)]
Make sure find_block loads data from inode.

lafs_load_block expects not to need to read block 0
of a depth==0 inode as lafs_find_block is expected to
load that.
However there is a case where find_block (called from lafs_find_block)
skips the load.  So remove that case.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix compile warning / incorrect test.
NeilBrown [Mon, 7 Jun 2010 01:27:33 +0000 (11:27 +1000)]
Fix compile warning / incorrect test.

New compiler noticed this...

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDon't clear B_Valid when index block is empty
NeilBrown [Mon, 28 Sep 2009 02:32:48 +0000 (12:32 +1000)]
Don't clear B_Valid when index block is empty

This overloading just caused problem. Invent a new flag instead.

16 years agoincorporate: handle empty block correctly.
NeilBrown [Mon, 28 Sep 2009 02:26:29 +0000 (12:26 +1000)]
incorporate: handle empty block correctly.

When a block becomes empty, we need to remove it from the
indexing tree, causing the next block to take over the address
space if possible, else maybe the previous block.

16 years agoFORMAT CHANGE - include start address explicitly in indirect blocks.
NeilBrown [Mon, 28 Sep 2009 00:16:17 +0000 (10:16 +1000)]
FORMAT CHANGE - include start address explicitly in indirect blocks.

By storing the address of the first block in an indirect block,
that block can be relocated in the index tree with no adverse effects.
This makes it easier to handle blocks that have become empty.

So an indirect block now contains:
   u16 0x01   'indirect' indicator
   u32 addr   virtual address of first indexed block
   u48 paddr  physical address of first indexblock block
   u48 paddr2 next block ... etc

16 years agoREADME notes for changes to index management.
NeilBrown [Mon, 28 Sep 2009 00:16:15 +0000 (10:16 +1000)]
README notes for changes to index management.

16 years agoHandle index blocks becoming empty better.
NeilBrown [Mon, 28 Sep 2009 00:16:13 +0000 (10:16 +1000)]
Handle index blocks becoming empty better.

MORE TEXT HERE

16 years agoDon't lose path to index blocks that haven't been incorporated
NeilBrown [Mon, 28 Sep 2009 00:16:02 +0000 (10:16 +1000)]
Don't lose path to index blocks that haven't been incorporated

Before a new index block is incorporated, we can find it only by
finding a sibling and walking the sibling list.
If that primary sibling gets released, the new block becomes
unfindable.
So hold a reference to such primaries until incorporation,
and ensure that there is always a primary in the same parent
by incorporating more promptly after a split.

16 years agoGroup B_ flags by which sort of block they apply to.
NeilBrown [Sun, 13 Sep 2009 23:47:59 +0000 (09:47 +1000)]
Group B_ flags by which sort of block they apply to.

This will allow us to overlap the 'Data' and 'Index' groups
later if that proves necessary.

16 years agodir: replace wrong constant with correct symbolic version.
NeilBrown [Thu, 3 Sep 2009 06:07:45 +0000 (16:07 +1000)]
dir: replace wrong constant with correct symbolic version.