Tao Ma [Tue, 18 Aug 2009 03:44:10 +0000 (11:44 +0800)]
ocfs2: Use proper parameter for some inode operation.
In order to make the original function more suitable for reflink,
we modify the following inode operations. Both are tiny.
1. ocfs2_mknod_locked only use dentry for mlog, so move it to
the caller so that reflink can use it without dentry.
2. ocfs2_prepare_orphan_dir only want inode to get its ip_blkno.
So use ip_blkno instead.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:44:07 +0000 (11:44 +0800)]
ocfs2: Make transaction extend more efficient.
In ocfs2_extend_rotate_transaction, op_credits is the orignal
credits in the handle and we only want to extend the credits
for the rotation, but the old solution always double it. It
is harmless for some minor operations, but for actions like
reflink we may rotate tree many times and cause the credits
increase dramatically. So this patch try to only increase
the desired credits.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:44:03 +0000 (11:44 +0800)]
ocfs2: Don't merge in 1st refcount ops of reflink.
Actually the whole reflink will touch refcount tree 2 times:
1. It will add the clusters in the extent record to the tree if it
isn't refcounted before.
2. It will add 1 refcount to these clusters when it add these
extent records to the tree.
So actually we shouldn't do merge in the 1st operation since the 2nd
one will soon be called and we may have to split it again. Do a merge
first and split soon is a waste of time. So we only merge in the 2nd
round. This is done by adding a new internal __ocfs2_increase_refcount
and call it with "not-merge" for 1st refcount operation in reflink.
This also has a side-effect that we don't need to worry too much about
the metadata allocation in the 2nd round since it will only merge and
no split will happen for those records.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:59 +0000 (11:43 +0800)]
ocfs2: Modify removing xattr process for refcount.
The old xattr value remove is quite simple, it just erase the
tree and free the clusters. But as we have added refcount support,
The process is a little complicated.
We have to lock the refcount tree at the beginning, what's more,
we may split the refcount tree in some cases, so meta/credits are
needed.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:55 +0000 (11:43 +0800)]
ocfs2: Add reflink support for xattr.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:52 +0000 (11:43 +0800)]
ocfs2: Create an xattr indexed block if needed.
With reflink, there is a need that we create a new xattr indexed
block from the very beginning. So add a new parameter for
ocfs2_create_xattr_block.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:49 +0000 (11:43 +0800)]
ocfs2: Call refcount tree remove process properly.
Now with xattr refcount support, we need to check whether
we have xattr refcounted before we remove the refcount tree.
Now the mechanism is:
1) Check whether i_clusters == 0, if no, exit.
2) check whether we have i_xattr_loc in dinode. if yes, exit.
2) Check whether we have inline xattr stored outside, if yes, exit.
4) Remove the tree.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Mon, 21 Sep 2009 05:04:19 +0000 (13:04 +0800)]
ocfs2: Attach xattr clusters to refcount tree.
In ocfs2, when xattr's value is larger than OCFS2_XATTR_INLINE_SIZE,
it will be kept outside of the blocks we store xattr entry. And they
are stored in a b-tree also. So this patch try to attach all these
clusters to refcount tree also.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:42 +0000 (11:43 +0800)]
ocfs2: Abstract ocfs2 xattr tree extend rec iteration process.
Currently we have ocfs2_iterate_xattr_buckets which can receive
a para and a callback to iterate a series of bucket. It is good.
But actually the 2 callers ocfs2_xattr_tree_list_index_block and
ocfs2_delete_xattr_index_block are almost the same. The only
difference is that the latter need to handle the extent record
also. So add a new function named ocfs2_iterate_xattr_index_block.
It can be given func callback which are used for exten record.
So now we only have one iteration function for the xattr index
block. Ane what's more, it is useful for our future reflink
operations.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:24 +0000 (11:43 +0800)]
ocfs2: Abstract the creation of xattr block.
In xattr reflink, we also need to create xattr block, so
abstract the process out.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:21 +0000 (11:43 +0800)]
ocfs2: Remove inode from ocfs2_xattr_bucket_get_name_value.
In ocfs2_xattr_bucket_get_name_value, actually we only use
super_block. So use it.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:43:17 +0000 (11:43 +0800)]
ocfs2: Add CoW support for xattr.
In order to make 2 transcation(xattr and cow) independent with each other,
we CoW the whole xattr out in case we are setting them.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Mon, 24 Aug 2009 06:31:03 +0000 (14:31 +0800)]
ocfs2: Abstract duplicate clusters process in CoW.
We currently use pagecache to duplicate clusters in CoW,
but it isn't suitable for xattr case. So abstract it out
so that the caller can decide which method it use.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:41:57 +0000 (11:41 +0800)]
ocfs2: Return extent flags for xattr value tree.
With the new refcount tree, xattr value can also be refcounted
among multiple files. So return the appropriate extent flags
so that CoW can used it later.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:40:59 +0000 (11:40 +0800)]
ocfs2: handle file attributes issue for reflink.
A reflink creates a snapshot of a file, that means the attributes
must be identical except for three exceptions - nlink, ino, and ctime.
As for time changes, Here is a brief description:
1. Source file:
1) atime: Ignore. Let the lazy atime code handle that.
2) mtime: don't touch.
3) ctime: If we change the tree (adding REFCOUNTED to at least one
extent), update it.
2. Destination file:
1) atime: ignore.
2) mtime: we want it to appear identical to the source.
3) ctime: update.
The idea here is that an ls -l will show the same time for the
src and target - it shows mtime. Backup software like rsync and tar
will treat the new file correctly too.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Sat, 22 Aug 2009 15:54:27 +0000 (23:54 +0800)]
ocfs2: Add normal functions for reflink a normal file's extents.
2 major functions are added in this patch.
ocfs2_attach_refcount_tree will create a new refcount tree to the
old file if it doesn't have one and insert all the extent records
to the tree if they are not refcounted.
ocfs2_create_reflink_node will:
1. set the refcount tree to the new file.
2. call ocfs2_duplicate_extent_list which will iterate all the
extents for the old file, insert it to the new file and increase
the corresponding referennce count.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Wed, 26 Aug 2009 01:47:28 +0000 (09:47 +0800)]
ocfs2: CoW a reflinked cluster when it is truncated.
When we truncate a file to a specific size which resides in a reflinked
cluster, we need to CoW it since ocfs2_zero_range_for_truncate will
zero the space after the size(just another type of write).
So we add a "max_cpos" in ocfs2_refcount_cow so that it will stop when
it hit the max cluster offset.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 25 Aug 2009 00:02:48 +0000 (08:02 +0800)]
ocfs2: Integrate CoW in file write.
When we use mmap, we CoW the refcountd clusters in
ocfs2_write_begin_nolock. While for normal file
io(including directio), we do CoW in
ocfs2_prepare_inode_for_write.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:30:55 +0000 (11:30 +0800)]
ocfs2: CoW refcount tree improvement.
During CoW, if the old extent record is refcounted, we allocate
som new clusters and do CoW. Actually we can have some improvement
here. If the old extent has refcount=1, that means now it is only
used by this file. So we don't need to allocate new clusters, just
remove the refcounted flag and it is OK. We also have to remove
it from the refcount tree while not deleting it.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 25 Aug 2009 00:05:12 +0000 (08:05 +0800)]
ocfs2: Add CoW support.
This patch try CoW support for a refcounted record.
the whole process will be:
1. Calculate how many clusters we need to CoW and where we start.
Extents that are not completely encompassed by the write will
be broken on 1MB boundaries.
2. Do CoW for the clusters with the help of page cache.
3. Change the b-tree structure with the new allocated clusters.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:29:12 +0000 (11:29 +0800)]
ocfs2: Decrement refcount when truncating refcounted extents.
Add 'Decrement refcount for delete' in to the normal truncate
process. So for a refcounted extent record, call refcount rec
decrementation instead of cluster free.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:28:39 +0000 (11:28 +0800)]
ocfs2: Add functions for extents refcounted.
Add function ocfs2_mark_extent_refcounted which can mark
an extent refcounted.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:24:49 +0000 (11:24 +0800)]
ocfs2: Add support of decrementing refcount for delete.
Given a physical cpos and length, decrement the refcount
in the tree. If the refcount for any portion of the extent goes
to zero, that portion is queued for freeing.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 11 Aug 2009 06:33:14 +0000 (14:33 +0800)]
ocfs2: Add support for incrementing refcount in the tree.
Given a physical cpos and length, increment the refcount
in the tree. If the extent has not been seen before, a refcount
record is created for it. Refcount records may be merged or
split by this operation.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:22:34 +0000 (11:22 +0800)]
ocfs2: move tree path functions to alloc.h.
Now fs/ocfs2/alloc.c has more than 7000 lines. It contains our
basic b-tree operation. Although we have already make our b-tree
operation generic, the basic structrue ocfs2_path which is used
to iterate one b-tree branch is still static and limited to only
used in alloc.c. As refcount tree need them and I don't want to
add any more b-tree unrelated code to alloc.c, export them out.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:22:25 +0000 (11:22 +0800)]
ocfs2: Add refcount b-tree as a new extent tree.
Add refcount b-tree as a new extent tree so that it can
use the b-tree to store and maniuplate ocfs2_refcount_rec.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:22:21 +0000 (11:22 +0800)]
ocfs2: Abstract extent split process.
ocfs2_mark_extent_written actually does the following things:
1. check the parameters.
2. initialize the left_path and split_rec.
3. call __ocfs2_mark_extent_written. it will do:
1) check the flags of unwritten
2) do the real split work.
The whole process is packed tightly somehow. So this patch
will abstract 2 different functions so that future b-tree
operation can work with it.
1. __ocfs2_split_extent will accept path and split_rec and do
the real split work.
2. ocfs2_change_extent_flag will accept a new flag and initialize
path and split_rec.
So now ocfs2_mark_extent_written will do:
1. check the parameters.
2. call ocfs2_change_extent_flag.
1) initalize the left_path and split_rec.
2) check whether the new flags conflict with the old one.
3) call __ocfs2_split_extent to do the split.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:22:18 +0000 (11:22 +0800)]
ocfs2: Wrap ocfs2_extent_contig in ocfs2_extent_tree.
Add a new operation eo_ocfs2_extent_contig int the extent tree's
operations vector. So that with the new refcount tree, We want
this so that refcount trees can always return CONTIG_NONE and
prevent extent merging.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Mon, 24 Aug 2009 03:12:02 +0000 (11:12 +0800)]
ocfs2: Basic tree root operation.
Add basic refcount tree root operation.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Mon, 24 Aug 2009 03:13:37 +0000 (11:13 +0800)]
ocfs2: Add refcount tree lock mechanism.
Implement locking around struct ocfs2_refcount_tree. This protects
all read/write operations on refcount trees. ocfs2_refcount_tree
has its own lock and its own caching_info, protecting buffers among
multiple nodes.
User must call ocfs2_lock_refcount_tree before his operation on
the tree and unlock it after that.
ocfs2_refcount_trees are referenced by the block number of the
refcount tree root block, So we create an rb-tree on the ocfs2_super
to look them up.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:21:00 +0000 (11:21 +0800)]
ocfs2: Add caching info for refcount tree.
refcount tree should use its own caching info so that when
we downconvert the refcount tree lock, we can drop all the
cached buffer head.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:19:58 +0000 (11:19 +0800)]
ocfs2: Add new refcount tree lock resource in dlmglue.
refcount tree lock resource is used to protect refcount
tree read/write among multiple nodes.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:19:29 +0000 (11:19 +0800)]
ocfs2: Abstract caching info checkpoint.
In meta downconvert, we need to checkpoint the metadata in an inode.
For refcount tree, we also need it. So abstract the process out.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:19:26 +0000 (11:19 +0800)]
ocfs2: Add ocfs2_read_refcount_block.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:19:20 +0000 (11:19 +0800)]
ocfs2: Add metaecc for ocfs2_refcount_block.
Add metaecc and journal trigger for ocfs2_refcount_block.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tao Ma [Tue, 18 Aug 2009 03:17:49 +0000 (11:17 +0800)]
ocfs2: Define refcount tree structure.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:54:22 +0000 (03:54 -0800)]
ocfs2: Pass ocfs2_caching_info into ocfs_init_*_extent_tree().
With this commit, extent tree operations are divorced from inodes and
rely on ocfs2_caching_info. Phew!
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:45:49 +0000 (03:45 -0800)]
ocfs2: __ocfs2_mark_extent_written() doesn't need struct inode.
We only allow unwritten extents on data, so the toplevel
ocfs2_mark_extent_written() can use an inode all it wants. But the
subfunction isn't even using the inode argument.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Wed, 18 Feb 2009 03:46:04 +0000 (19:46 -0800)]
ocfs2: Teach ocfs2_replace_extent_rec() to use an extent_tree.
Don't use a struct inode anymore.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:43:22 +0000 (03:43 -0800)]
ocfs2: ocfs2_split_and_insert() no longer needs struct inode.
It already has an extent_tree.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:41:26 +0000 (03:41 -0800)]
ocfs2: ocfs2_remove_extent() no longer needs struct inode.
One more generic btree function that is isolated from struct inode.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:34:15 +0000 (03:34 -0800)]
ocfs2: ocfs2_add_clusters_in_btree() no longer needs struct inode.
One more function that doesn't need a struct inode to pass to its
children.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:24:43 +0000 (03:24 -0800)]
ocfs2: ocfs2_insert_extent() no longer needs struct inode.
One more function down, no inode in the entire insert-extent chain.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:18:34 +0000 (03:18 -0800)]
ocfs2: Make extent map insertion an extent_tree_operation.
ocfs2_insert_extent() wants to insert a record into the extent map if
it's an inode data extent. But since many btrees can call that
function, let's make it an op on ocfs2_extent_tree. Other tree types
can leave it empty.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:14:38 +0000 (03:14 -0800)]
ocfs2: ocfs2_figure_insert_type() no longer needs struct inode.
It's not using it, so remove it from the parameter list.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:12:33 +0000 (03:12 -0800)]
ocfs2: Remove inode from ocfs2_figure_extent_contig().
It already has an ocfs2_extent_tree and doesn't need the inode.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:09:54 +0000 (03:09 -0800)]
ocfs2: Swap inode for extent_tree in ocfs2_figure_merge_contig_type().
We don't want struct inode in generic btree operations.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 11:07:09 +0000 (03:07 -0800)]
ocfs2: ocfs2_extent_contig() only requires the superblock.
Don't pass the inode in. We don't want it around for generic btree
operations.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:57:58 +0000 (02:57 -0800)]
ocfs2: ocfs2_do_insert_extent() and ocfs2_insert_path() no longer need an inode.
They aren't using it, so remove it from their parameter lists.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:56:23 +0000 (02:56 -0800)]
ocfs2: Give ocfs2_split_record() an extent_tree instead of an inode.
Another on the way to generic btree functions.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:54:36 +0000 (02:54 -0800)]
ocfs2: ocfs2_insert_at_leaf() doesn't need struct inode.
Give it an ocfs2_extent_tree and it is happy.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:50:12 +0000 (02:50 -0800)]
ocfs2: Make truncating the extent map an extent_tree_operation.
ocfs2_remove_extent() wants to truncate the extent map if it's
truncating an inode data extent. But since many btrees can call that
function, let's make it an op on ocfs2_extent_tree. Other tree types
can leave it empty.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:42:30 +0000 (02:42 -0800)]
ocfs2: ocfs2_truncate_rec() doesn't need struct inode.
It's not using it anymore. Remove it from the parameter list.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:24:10 +0000 (02:24 -0800)]
ocfs2: ocfs2_grow_branch() and ocfs2_append_rec_to_path() lose struct inode.
ocfs2_grow_branch() not really using it other than to pass it to the
subfunctions ocfs2_shift_tree_depth(), ocfs2_find_branch_target(), and
ocfs2_add_branch(). The first two weren't it either, so they drop the
argument. ocfs2_add_branch() only passed it to
ocfs2_adjust_rightmost_branch(), which drops the inode argument and uses
the ocfs2_extent_tree as well.
ocfs2_append_rec_to_path() can be take an ocfs2_extent_tree instead of
the inode. The function ocfs2_adjust_rightmost_records() goes along for
the ride.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:19:11 +0000 (02:19 -0800)]
ocfs2: ocfs2_try_to_merge_extent() doesn't need struct inode.
It's not using it, so remove it from the parameter list.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:16:08 +0000 (02:16 -0800)]
ocfs2: ocfs2_merge_rec_left/right() no longer need struct inode.
Drop it from the parameters - they already have ocfs2_extent_list.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 10:09:31 +0000 (02:09 -0800)]
ocfs2: ocfs2_rotate_tree_left() no longer needs struct inode.
It already gets ocfs2_extent_tree, so we can just use that. This chains
to the same modification for ocfs2_remove_rightmost_path() and
ocfs2_rotate_rightmost_leaf_left().
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:47:43 +0000 (19:47 -0800)]
ocfs2: __ocfs2_rotate_tree_left() doesn't need struct inode.
It already has struct ocfs2_extent_tree, which has the caching info. So
we don't need to pass it struct inode.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:45:28 +0000 (19:45 -0800)]
ocfs2: ocfs2_rotate_subtree_left() doesn't need struct inode.
It already has struct ocfs2_extent_tree, which has the caching info. So
we don't need to pass it struct inode.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:43:57 +0000 (19:43 -0800)]
ocfs2: ocfs2_update_edge_lengths() doesn't need struct inode.
Pass in the extent tree, which is all we need.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:42:08 +0000 (19:42 -0800)]
ocfs2: ocfs2_rotate_tree_right() doesn't need struct inode.
We don't need struct inode in ocfs2_rotate_tree_right() anymore.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:32:43 +0000 (19:32 -0800)]
ocfs2: Drop struct inode from ocfs2_extent_tree_operations.
We can get to the inode from the caching information. Other parent
types don't need it.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:20:13 +0000 (19:20 -0800)]
ocfs2: Pass ocfs2_extent_tree to ocfs2_get_subtree_root()
Get rid of the inode argument. Use extent_tree instead. This means a
few more functions have to pass an extent_tree around.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:10:13 +0000 (19:10 -0800)]
ocfs2: Get inode out of ocfs2_rotate_subtree_root_right().
Pass the ocfs2_extent_list down through ocfs2_rotate_tree_right() and
get rid of struct inode in ocfs2_rotate_subtree_root_right().
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 03:02:36 +0000 (19:02 -0800)]
ocfs2: ocfs2_complete_edge_insert() doesn't need struct inode at all.
Completely unused argument. Get rid of it.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 02:57:52 +0000 (18:57 -0800)]
ocfs2: Pass ocfs2_extent_tree to ocfs2_unlink_path()
ocfs2_unlink_path() doesn't need struct inode, so let's pass it struct
ocfs2_extent_tree.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 02:49:19 +0000 (18:49 -0800)]
ocfs2: ocfs2_create_new_meta_bhs() doesn't need struct inode.
Pass struct ocfs2_extent_tree into ocfs2_create_new_meta_bhs(). It no
longer needs struct inode or ocfs2_super.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 02:08:48 +0000 (18:08 -0800)]
ocfs2: ocfs2_find_path() only needs the caching info
ocfs2_find_path and ocfs2_find_leaf() walk our btrees, reading extent
blocks. They need struct ocfs2_caching_info for that, but not struct
inode.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 01:49:26 +0000 (17:49 -0800)]
ocfs2: Pass ocfs2_caching_info to ocfs2_read_extent_block().
extent blocks belong to btrees on more than just inodes, so we want to
pass the ocfs2_caching_info structure directly to
ocfs2_read_extent_block(). A number of places in alloc.c can now drop
struct inode from their argument list.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 01:32:34 +0000 (17:32 -0800)]
ocfs2: Store the ocfs2_caching_info on ocfs2_extent_tree.
What do we cache? Metadata blocks. What are most of our non-inode metadata
blocks? Extent blocks for our btrees. struct ocfs2_extent_tree is the
main structure for managing those. So let's store the associated
ocfs2_caching_info there.
This means that ocfs2_et_root_journal_access() doesn't need struct inode
anymore, and any place that has an et can refer to et->et_ci instead of
INODE_CACHE(inode).
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Fri, 13 Feb 2009 00:41:25 +0000 (16:41 -0800)]
ocfs2: Pass struct ocfs2_caching_info to the journal functions.
The next step in divorcing metadata I/O management from struct inode is
to pass struct ocfs2_caching_info to the journal functions. Thus the
journal locks a metadata cache with the cache io_lock function. It also
can compare ci_last_trans and ci_created_trans directly.
This is a large patch because of all the places we change
ocfs2_journal_access..(handle, inode, ...) to
ocfs2_journal_access..(handle, INODE_CACHE(inode), ...).
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Thu, 12 Feb 2009 23:41:59 +0000 (15:41 -0800)]
ocfs2: move ip_created_trans to struct ocfs2_caching_info
Similar ip_last_trans, ip_created_trans tracks the creation of a journal
managed inode. This specifically tracks what transaction created the
inode. This is so the code can know if the inode has ever been written
to disk.
This behavior is desirable for any journal managed object. We move it
to struct ocfs2_caching_info as ci_created_trans so that any object
using ocfs2_caching_info can rely on this behavior.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Thu, 12 Feb 2009 23:24:40 +0000 (15:24 -0800)]
ocfs2: move ip_last_trans to struct ocfs2_caching_info
We have the read side of metadata caching isolated to struct
ocfs2_caching_info, now we need the write side. This means the journal
functions. The journal only does a couple of things with struct inode.
This change moves the ip_last_trans field onto struct
ocfs2_caching_info as ci_last_trans. This field tells the journal
whether a pending journal flush is required.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Wed, 11 Feb 2009 04:00:41 +0000 (20:00 -0800)]
ocfs2: Take the inode out of the metadata read/write paths.
We are really passing the inode into the ocfs2_read/write_blocks()
functions to get at the metadata cache. This commit passes the cache
directly into the metadata block functions, divorcing them from the
inode.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Wed, 11 Feb 2009 03:00:37 +0000 (19:00 -0800)]
ocfs2: Change metadata caching locks to an operations structure.
We don't really want to cart around too many new fields on the
ocfs2_caching_info structure. So let's wrap all our access of the
parent object in a set of operations. One pointer on caching_info, and
more flexibility to boot.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Joel Becker [Wed, 11 Feb 2009 00:05:07 +0000 (16:05 -0800)]
ocfs2: Make the ocfs2_caching_info structure self-contained.
We want to use the ocfs2_caching_info structure in places that are not
inodes. To do that, it can no longer rely on referencing the inode
directly.
This patch moves the flags to ocfs2_caching_info->ci_flags, stores
pointers to the parent's locks on the ocfs2_caching_info, and renames
the constants and flags to reflect its independant state.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Sunil Mushran [Fri, 4 Sep 2009 18:12:01 +0000 (11:12 -0700)]
ocfs2: ocfs2_write_begin_nolock() should handle len=0
Bug introduced by mainline commit
e7432675f8ca868a4af365759a8d4c3779a3d922
The bug causes ocfs2_write_begin_nolock() to oops when len=0.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Cc: stable@kernel.org
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Tao Ma [Thu, 27 Aug 2009 06:46:56 +0000 (14:46 +0800)]
ocfs2: invalidate dentry if its dentry_lock isn't initialized.
In commit
a5a0a630922a2f6a774b6dac19f70cb5abd86bb0, when
ocfs2_attch_dentry_lock fails, we call an extra iput and reset
dentry->d_fsdata to NULL. This resolve a bug, but it isn't
completed and the dentry is still there. When we want to use
it again, ocfs2_dentry_revalidate doesn't catch it and return
true. That make future ocfs2_dentry_lock panic out.
One bug is http://oss.oracle.com/bugzilla/show_bug.cgi?id=1162.
The resolution is to add a check for dentry->d_fsdata in
revalidate process and return false if dentry->d_fsdata is NULL,
so that a new ocfs2_lookup will be called again.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Goldwyn Rodrigues [Thu, 20 Aug 2009 18:43:19 +0000 (13:43 -0500)]
ocfs2/dlm: Wait on lockres instead of erroring cancel requests
In case a downconvert is queued, and a flock receives a signal,
BUG_ON(lockres->l_action != OCFS2_AST_INVALID) is triggered
because a lock cancel triggers a dlmunlock while an AST is
scheduled.
To avoid this, allow a LKM_CANCEL to pass through, and let it
wait on __dlm_wait_on_lockres().
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
Acked-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Thu, 20 Aug 2009 16:26:52 +0000 (18:26 +0200)]
ocfs2: Add missing lock name
There is missing name for NFSSync cluster lock. This makes lockdep unhappy
because we end up passing NULL to lockdep when initializing lock key. Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Thu, 30 Jul 2009 15:01:53 +0000 (17:01 +0200)]
ocfs2: Don't oops in ocfs2_kill_sb on a failed mount
If we fail to mount the filesystem, we have to be careful not to dereference
uninitialized structures in ocfs2_kill_sb.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Tao Ma [Wed, 12 Aug 2009 06:42:47 +0000 (14:42 +0800)]
ocfs2: release the buffer head in ocfs2_do_truncate.
In ocfs2_do_truncate, we forget to release last_eb_bh which
will cause memleak. So call brelse in the end.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Mon, 3 Aug 2009 16:24:21 +0000 (18:24 +0200)]
ocfs2: Handle quota file corruption more gracefully
ocfs2_read_virt_blocks() does BUG when we try to read a block from a file
beyond its end. Since this can happen due to filesystem corruption, it
is not really an appropriate answer. Make ocfs2_read_quota_block() check
the condition and handle it by calling ocfs2_error() and returning EIO.
[ Modified to print ip_blkno in the error - Joel ]
Reported-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Thu, 6 Aug 2009 21:29:34 +0000 (23:29 +0200)]
ocfs2: Fix possible deadlock when extending quota file
In OCFS2, allocator locks rank above transaction start. Thus we
cannot extend quota file from inside a transaction less we could
deadlock.
We solve the problem by starting transaction not already in
ocfs2_acquire_dquot() but only in ocfs2_local_read_dquot() and
ocfs2_global_read_dquot() and we allocate blocks to quota files before starting
the transaction. In case we crash, quota files will just have a few blocks
more but that's no problem since we just use them next time we extend the
quota file.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Roel Kluin [Thu, 6 Aug 2009 23:07:50 +0000 (16:07 -0700)]
ocfs2: keep index within status_map[]
Do not exceed array status_map[]
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Sunil Mushran [Thu, 6 Aug 2009 23:12:58 +0000 (16:12 -0700)]
ocfs2: Initialize the cluster we're writing to in a non-sparse extend
In a non-sparse extend, we correctly allocate (and zero) the clusters between
the old_i_size and pos, but we don't zero the portions of the cluster we're
writing to outside of pos<->len.
It handles clustersize > pagesize and blocksize < pagesize.
[Cleaned up by Joel Becker.]
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Goldwyn Rodrigues [Fri, 31 Jul 2009 19:28:02 +0000 (14:28 -0500)]
ocfs2: Remove redundant BUG_ON in __dlm_queue_ast()
We BUG_ON() the same thing twice.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Tao Ma [Thu, 30 Jul 2009 08:07:10 +0000 (16:07 +0800)]
ocfs2/quota: Release lock for error in ocfs2_quota_write.
ocfs2_quota_write needs to release the lock if it fails to
read quota block. So use "goto out" instead of "return err".
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Wed, 22 Jul 2009 11:17:21 +0000 (13:17 +0200)]
ocfs2: Define credit counts for quota operations
Numbers of needed credits for some quota operations were written
as raw numbers. Create appropriate defines instead.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Wed, 22 Jul 2009 11:17:20 +0000 (13:17 +0200)]
ocfs2: Remove syncjiff field from quota info
syncjiff is just a converted value of syncms. Some places which
are updating syncms forgot to update syncjiff as well. Since the
conversion is just a simple division / multiplication and it does
not happen frequently, just remove the syncjiff field to avoid
forgotten conversions.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Wed, 22 Jul 2009 11:17:19 +0000 (13:17 +0200)]
ocfs2: Fix initialization of blockcheck stats
We just set blockcheck stats to zeros but we should also
properly initialize the spinlock there.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Wed, 22 Jul 2009 11:17:18 +0000 (13:17 +0200)]
ocfs2: Zero out padding of on disk dquot structure
Padding fields of on-disk dquot structure were not zeroed. Zero them
so that it's easier to use them later.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Wed, 22 Jul 2009 11:17:17 +0000 (13:17 +0200)]
ocfs2: Initialize blocks allocated to local quota file
When we extend local quota file, we should initialize data
in newly allocated block. Firstly because on recovery we could
parse bogus data, secondly so that block checksums are properly
computed.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Wed, 22 Jul 2009 11:17:16 +0000 (13:17 +0200)]
ocfs2: Mark buffer uptodate before calling ocfs2_journal_access_dq()
In a code path extending local quota files we marked new header
buffer uptodate only after calling ocfs2_journal_access_dq() which
triggers a bug. Fix it and also call ocfs2 variant of the function
marking buffer uptodate.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Wed, 22 Jul 2009 11:17:15 +0000 (13:17 +0200)]
ocfs2: Make global quota files blocksize aligned
Change i_size of global quota files so that it always remains aligned to block
size. This is mainly because the end of quota block may contain checksum (if
checksumming is enabled) and it's a bit awkward for it to be "outside" of quota
file (and it makes life harder for ocfs2-tools).
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Tao Ma [Thu, 23 Jul 2009 00:12:58 +0000 (08:12 +0800)]
ocfs2: Use ocfs2_rec_clusters in ocfs2_adjust_adjacent_records.
In ocfs2_adjust_adjacent_records, we will adjust adjacent records
according to the extent_list in the lower level. But actually
the lower level tree will either be a leaf or a branch. If we only
use ocfs2_is_empty_extent we will meet with some problem if the lower
tree is a branch (tree_depth > 1). So use !ocfs2_rec_clusters instead.
And actually only the leaf record can have holes. So add a BUG_ON
for non-leaf branch.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Jan Kara [Mon, 20 Jul 2009 10:12:36 +0000 (12:12 +0200)]
ocfs2: Fix deadlock on umount
In commit
ea455f8ab68338ba69f5d3362b342c115bea8e13, we moved the dentry lock
put process into ocfs2_wq. This causes problems during umount because ocfs2_wq
can drop references to inodes while they are being invalidated by
invalidate_inodes() causing all sorts of nasty things (invalidate_inodes()
ending in an infinite loop, "Busy inodes after umount" messages etc.).
We fix the problem by stopping ocfs2_wq from doing any further releasing of
inode references on the superblock being unmounted, wait until it finishes
the current round of releasing and finally cleaning up all the references in
dentry_lock_list from ocfs2_put_super().
The issue was tracked down by Tao Ma <tao.ma@oracle.com>.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Tao Ma [Tue, 21 Jul 2009 07:42:05 +0000 (15:42 +0800)]
ocfs2: Add extra credits and access the modified bh in update_edge_lengths.
In normal tree rotation left process, we will never touch the tree
branch above subtree_index and ocfs2_extend_rotate_transaction doesn't
reserve the credits for them either.
But when we want to delete the rightmost extent block, we have to update
the rightmost records for all the rightmost branch(See
ocfs2_update_edge_lengths), so we have to allocate extra credits for them.
What's more, we have to access them also.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Wengang Wang [Mon, 13 Jul 2009 03:38:58 +0000 (11:38 +0800)]
ocfs2: Fail ocfs2_get_block() immediately when a block needs allocation
ocfs2_get_block() does no allocation. Hole filling for writes should
have happened farther up in the call chain. We detect this case and
print an error, but we then continue with the function. We should be
exiting immediately.
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Wengang Wang [Mon, 13 Jul 2009 03:38:23 +0000 (11:38 +0800)]
ocfs2: Fix error return in ocfs2_write_cluster()
A typo caused ocfs2_write_cluster() to return 0 in some error cases.
Fix it.
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
This page took 0.045459 seconds and 5 git commands to generate.