]> git.neil.brown.name Git - LaFS.git/log
LaFS.git
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.

16 years agoDrop excess 'clean2' reference.
NeilBrown [Thu, 3 Sep 2009 05:54:15 +0000 (15:54 +1000)]
Drop excess 'clean2' reference.

16 years agolafs_wait_block fixes
NeilBrown [Thu, 3 Sep 2009 05:46:38 +0000 (15:46 +1000)]
lafs_wait_block fixes

If the block is already Valid, there is no need to wait for
it to be unlocked.
This avoids extra async blocks lying around.

16 years agoAvoid flushing inodes too soon.
NeilBrown [Thu, 3 Sep 2009 05:46:24 +0000 (15:46 +1000)]
Avoid flushing inodes too soon.

I'm not 100% sure of this, but it seems write.  Inode data blocks
don't have PinPending, rather the inode block is Pinned.

16 years agoMultiple improvements to inode dirtying
NeilBrown [Thu, 3 Sep 2009 05:28:22 +0000 (15:28 +1000)]
Multiple improvements to inode dirtying

- in a few places we didn't called dirty_inode when we should have
  done.
- after inode_{inc,dec}_link_count we don't need to dirty the inode
  because it has already been done.
- handle I_Dirty properly rather than unpinning the block
- allocate NCredits for inodes so that I_Dirty can succeed.

16 years agoREADME update
NeilBrown [Thu, 3 Sep 2009 05:28:21 +0000 (15:28 +1000)]
README update

16 years agoFix clearing of PinPending
NeilBrown [Thu, 3 Sep 2009 05:28:21 +0000 (15:28 +1000)]
Fix clearing of PinPending

PinPending must be cleared after marking dirty, not before.

16 years agoAdd support for unattended testing.
NeilBrown [Thu, 3 Sep 2009 05:28:21 +0000 (15:28 +1000)]
Add support for unattended testing.

Make sure the qemu exits when a test completes, and always
capture the kernel output.

16 years agounmount: push orphan handling along.
NeilBrown [Thu, 3 Sep 2009 05:28:21 +0000 (15:28 +1000)]
unmount: push orphan handling along.

Just waiting for the thread to do it doesn't seem to be
enough.

16 years agolafs_find_orphan: always release the lock.
NeilBrown [Thu, 3 Sep 2009 05:28:21 +0000 (15:28 +1000)]
lafs_find_orphan: always release the lock.

Forgot to unlock on the "not found" path.

16 years agoFixed to run_orphans.
NeilBrown [Thu, 3 Sep 2009 05:28:21 +0000 (15:28 +1000)]
Fixed to run_orphans.

We need to hold a reference to the db, as orphan_release
can drop it.
And an unclaimed inode block with no mx is always free to
be orphan_released.

16 years agoMove unmap_dblock closer to map.
NeilBrown [Thu, 3 Sep 2009 05:28:20 +0000 (15:28 +1000)]
Move unmap_dblock closer to map.

As this is an atomic region, keep it as short as possible.

16 years agoFix pruning of orphan file.
NeilBrown [Thu, 3 Sep 2009 05:28:20 +0000 (15:28 +1000)]
Fix pruning of orphan file.

The test for "now beyond EOF" was all wrong.

16 years agoDon't add Credits to Dirty blocks.
NeilBrown [Thu, 3 Sep 2009 05:28:20 +0000 (15:28 +1000)]
Don't add Credits to Dirty blocks.

If the Credit has moved to Dirty, we don't need to add
another one during prealloc.
Doing so means that prealloc can fail on a block which is
already adequately allocated.

16 years agoAdd some more "temp_credits" assignment to improve credit-watch
NeilBrown [Thu, 3 Sep 2009 05:28:20 +0000 (15:28 +1000)]
Add some more "temp_credits" assignment to improve credit-watch

16 years agoClear physaddr when growing an index tree.
NeilBrown [Thu, 3 Sep 2009 05:28:19 +0000 (15:28 +1000)]
Clear physaddr when growing an index tree.

The InoIdx block probably shouldn't have a phys address,
but we must be certainly it doesn't after a grow caused it to
not be an InoIdx block any more, else accounting will get
confused when we allocate it to another block.

16 years agoRelease the orphan status when finished deleting an inode.
NeilBrown [Thu, 3 Sep 2009 05:28:19 +0000 (15:28 +1000)]
Release the orphan status when finished deleting an inode.

and ensure that if the orphan_release fails, a subsequent attempt
has a chance of doing the right thing.

16 years agoBe sure to alway unlock new inodes.
NeilBrown [Thu, 3 Sep 2009 05:28:19 +0000 (15:28 +1000)]
Be sure to alway unlock new inodes.

All error paths must unlock the new inode.
And make sure nlink is 0 so that it will not be cached.

16 years agocorrectly handle attempt to load inode that is being deleted.
NeilBrown [Thu, 3 Sep 2009 05:28:19 +0000 (15:28 +1000)]
correctly handle attempt to load inode that is being deleted.

Make sure to return ENOENT in this case.

16 years agoInitialise empty index block during allocation.
NeilBrown [Thu, 3 Sep 2009 05:28:18 +0000 (15:28 +1000)]
Initialise empty index block during allocation.

I'm still not sure about this handling of empty index blocks,
but leaving it invalid certainly isn't correct.  I have to
initialise it and make it valid.

16 years agoAvoid inadvertently flush blocks that are in middle of a transaction.
NeilBrown [Thu, 3 Sep 2009 05:28:15 +0000 (15:28 +1000)]
Avoid inadvertently flush blocks that are in middle of a transaction.

If a directory block has PinPending, then a transaction is in progress
and flushing the block (e.g. pdflush) would be a bad idea, as we could
lose the credit before the final update.

16 years agoComplete proper pinning dir_handle_orphans.
NeilBrown [Wed, 2 Sep 2009 00:55:20 +0000 (10:55 +1000)]
Complete proper pinning dir_handle_orphans.

If the orphan handler is going to dirty a block, it must
first pin it (and check for errors), and must afterwards remove
the PinPending.
One of the places which caused change did this.  The other didn't.

16 years agoFix orphan flushing in rmdir
NeilBrown [Wed, 2 Sep 2009 00:55:20 +0000 (10:55 +1000)]
Fix orphan flushing in rmdir

lafs_dir_handle_orphan no longer requires drop_orphan,
and can drop the reference to the orphan block.
So we need to hold our own so we can test if it is still
and orphan after handling (in which case we must wait).

16 years agoFix beyond-eof check when cleaning
NeilBrown [Wed, 2 Sep 2009 00:55:20 +0000 (10:55 +1000)]
Fix beyond-eof check when cleaning

special files don't maintain i_size, so we must not compare against
that when cleaning them.

16 years agoRemove incorrect BUG_ON in checkpoint.
NeilBrown [Wed, 2 Sep 2009 00:55:20 +0000 (10:55 +1000)]
Remove incorrect BUG_ON in checkpoint.

It seems that this list can be empty fairly often without
any problems caused - I was afraid of infinite loops as it appears
there is nothing to do.
Maybe it is just the waiting that is needed.

16 years agoRemove incorrect assumption from erase_dblock
NeilBrown [Wed, 2 Sep 2009 00:55:07 +0000 (10:55 +1000)]
Remove incorrect assumption from erase_dblock

When erasing a pinned dblock, it might not be on the leaf list.
The fact that we have it locked can mean that it wasn't put there
yet.
So check leaf list membership explicitly.

Note that it cannot be in write-back, as we should have
waited for any writeback to finish, and won't have started any.

16 years agoAdd alloc_type to lafs_pin_dblock
NeilBrown [Wed, 2 Sep 2009 00:10:04 +0000 (10:10 +1000)]
Add alloc_type to lafs_pin_dblock

This is particularly needed for make_orphan which needs
to allocate new blocks sometimes just to delete files.

16 years agoImprove inode orphan handling.
NeilBrown [Wed, 2 Sep 2009 00:10:03 +0000 (10:10 +1000)]
Improve inode orphan handling.

And inode can be an orphan for an extended period of time and
should not be on the pending_orphans list all that time.
So we need to remove it if nothing needs doing for now, and
add it back on when it requires attention.

16 years agoImprove lafs_run_orphans list handling.
NeilBrown [Wed, 2 Sep 2009 00:10:03 +0000 (10:10 +1000)]
Improve lafs_run_orphans list handling.

Requiring the 'handle' routines to leave the orphan on the list and
then removing it if B_Orphan isn't set is not appropriate as we will
want to remove block while they still have B_Orphan set.
So do the list management differently to still ensure a single pass
through without needing the current block to hold our place.

16 years agoRemove special handling for i_nlink when reading inodes.
NeilBrown [Wed, 2 Sep 2009 00:09:52 +0000 (10:09 +1000)]
Remove special handling for i_nlink when reading inodes.

This was never "right" and is confusing orphan handling.
We should not lose those blocks anymore but if we do we need a better
fix.

16 years agoFlush orphans before failing rmdir due to not being empty.
NeilBrown [Wed, 2 Sep 2009 00:09:51 +0000 (10:09 +1000)]
Flush orphans before failing rmdir due to not being empty.

Before we can be sure if a directory is empty, we need to
flush and orphans that might be holding space in the directory
in use.  Only then can a check on the file size be meaningful.

16 years agoRun orphans from the cleaner thread, not immediately.
NeilBrown [Wed, 2 Sep 2009 00:09:49 +0000 (10:09 +1000)]
Run orphans from the cleaner thread, not immediately.

This involves:

 making dir_handle_orphans and inode_handle_orphans non-blocking.
 removing lots of explicit calls to handle_orphans.

16 years agomake lafs_leaf_find properly async
NeilBrown [Wed, 2 Sep 2009 00:09:07 +0000 (10:09 +1000)]
make lafs_leaf_find properly async

The new iolock_block calls weren't honouring 'async'.
So fix that.

16 years agolafs_make_orphan_nb - non-blocking version.
NeilBrown [Thu, 27 Aug 2009 01:51:03 +0000 (11:51 +1000)]
lafs_make_orphan_nb - non-blocking version.

We will need to in the 'dir' orphan handler which itself
needs to be non-blocking.

16 years agoFurther tidy up for make_orphan
NeilBrown [Thu, 27 Aug 2009 01:46:02 +0000 (11:46 +1000)]
Further tidy up for make_orphan

Move the calls to orphan_abort and orphan_commit into make_orphan
to follow the pattern used elsewhere.
This requires moving the i_mutex lock out into make_orphan,
but otherwise seems to be a good improvement.

16 years agoSplit orphan_commit out from orphan_pin
NeilBrown [Thu, 27 Aug 2009 01:46:01 +0000 (11:46 +1000)]
Split orphan_commit out from orphan_pin

It seems to work better as a separate function.

16 years agoUse orphan_abort in lafs_orphan_release
NeilBrown [Thu, 27 Aug 2009 01:46:00 +0000 (11:46 +1000)]
Use orphan_abort in lafs_orphan_release

lafs_orphan_release currently open-codes all of orphan_abort,
except the i_mutex locking is a bit different.  So change locking
rules for orphan_abort, then use that directly in lafs_orphan_release.

16 years agoGet rid of orphan_info structure.
NeilBrown [Thu, 27 Aug 2009 01:45:59 +0000 (11:45 +1000)]
Get rid of orphan_info structure.

It no longer contains anything really useful...

16 years agoTidy up release_orphan
NeilBrown [Thu, 27 Aug 2009 01:45:58 +0000 (11:45 +1000)]
Tidy up release_orphan

In particular it need to pin the dblocks, be async and get all the
references right.