All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 03/15] Abstract ocfs2_extent_tree in	b-tree operations.
Date: Thu, 14 Aug 2008 12:55:22 -0700	[thread overview]
Message-ID: <20080814195522.GA28875@mail.oracle.com> (raw)
In-Reply-To: <1218061894-7693-3-git-send-email-tao.ma@oracle.com>

On Thu, Aug 07, 2008 at 06:31:25AM +0800, Tao Ma wrote:
> In the old extent tree operation, we take the hypothesis that we
> are using the ocfs2_extent_list in ocfs2_dinode as the tree root.
> As xattr will also use ocfs2_extent_list to store large value
> for a xattr entry, we refactor the tree operation so that xattr
> can use it directly.
> 
> The refactoring includes 4 steps:
> 1. Abstract set/get of last_eb_blk and update_clusters since they may
>    be stored in different location for dinode and xattr.
> 2. Add a new structure named ocfs2_extent_tree to indicate the
>    extent tree the operation will work on.
> 3. Remove all the use of fe_bh and di, use root_bh and root_el in
>    extent tree instead. So now all the fe_bh is replaced with
>    et->root_bh, el with root_el accordingly.
> 4. Make ocfs2_lock_allocators generic. Now it is limited to be only used
>    in file extend allocation. But the whole function is useful when we want
>    to store large EAs.
> 
> Note: This patch hasn't touch the code of ocfs2_commit_truncate since
> it isn't has been modified with the new tree operation.
> So all the truncating code deem that the tree root is ocfs2_dinode.

	Ok, I love this patch.  I just have a couple questions.

> +struct ocfs2_extent_tree_operations {
> +	void (*set_last_eb_blk) (struct ocfs2_extent_tree *et, u64 blkno);
> +	u64 (*get_last_eb_blk) (struct ocfs2_extent_tree *et);
> +	void (*update_clusters) (struct inode *inode,
> +				 struct ocfs2_extent_tree *et,
> +				 u32 new_clusters);
> +	int (*sanity_check) (struct inode *inode, struct ocfs2_extent_tree *et);
> +};

	Can we please prefix these?  et_set_last_eb_blk,
et_update_clusters, etc.

> +struct ocfs2_extent_tree {
> +	enum ocfs2_extent_tree_type type;
> +	struct ocfs2_extent_tree_operations *eops;
> +	struct buffer_head *root_bh;
> +	struct ocfs2_extent_list *root_el;
> +};

	And these too?  et_type, et_ops, et_root_bh, et_root_el.

>  int ocfs2_num_free_extents(struct ocfs2_super *osb,
>  			   struct inode *inode,
> -			   struct buffer_head *bh)
> +			   struct buffer_head *root_bh,
> +			   enum ocfs2_extent_tree_type type)
>  {
>  	int retval;
> -	struct ocfs2_extent_list *el;
> +	struct ocfs2_extent_list *el = NULL;
>  	struct ocfs2_extent_block *eb;
>  	struct buffer_head *eb_bh = NULL;
> -	struct ocfs2_dinode *fe = (struct ocfs2_dinode *)bh->b_data;
> +	u64 last_eb_blk = 0;
>  
>  	mlog_entry_void();
>  
> -	if (!OCFS2_IS_VALID_DINODE(fe)) {
> -		OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe);
> -		retval = -EIO;
> -		goto bail;
> +	if (type == OCFS2_DINODE_EXTENT) {
> +		struct ocfs2_dinode *fe =
> +				(struct ocfs2_dinode *)root_bh->b_data;
> +		if (!OCFS2_IS_VALID_DINODE(fe)) {
> +			OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe);
> +			retval = -EIO;
> +			goto bail;
> +		}
> +
> +		if (fe->i_last_eb_blk)
> +			last_eb_blk = le64_to_cpu(fe->i_last_eb_blk);
> +		el = &fe->id2.i_list;

	Why isn't this using ocfs2_new_extent_tree() and then
ocfs2_get_last_eb_lock()?  You do that every other place, and it keeps
you from having to special case each type here.


Joel

-- 

"Maybe the time has drawn the faces I recall.
 But things in this life change very slowly,
 If they ever change at all."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2008-08-14 19:55 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-07  6:23 [Ocfs2-devel] [PATCH 0/15] ocfs2: Add extended attributes for ocfs2. V3 Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 01/15] Modify ocfs2_num_free_extents for future xattr usage Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 02/15] Use ocfs2_extent_list instead of ocfs2_dinode Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 03/15] Abstract ocfs2_extent_tree in b-tree operations Tao Ma
2008-08-14 19:55   ` Joel Becker [this message]
2008-08-15  7:17     ` Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 04/15] Make extend allocation generic Tao Ma
2008-08-14 20:01   ` Joel Becker
2008-08-15  7:14     ` Tao Ma
2008-08-14 23:47       ` Joel Becker
2008-08-15  8:44         ` Tao Ma
2008-08-15  6:26           ` Joel Becker
2008-08-15 15:43             ` Tao Ma
2008-08-15 17:59               ` Mark Fasheh
2008-08-15 19:18                 ` Joel Becker
2008-08-16  9:39                 ` Tao Ma
2008-08-15 19:23               ` Joel Becker
2008-08-16  9:49                 ` Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 05/15] Add xattr header in ocfs2. v3 Tao Ma
2008-08-11  0:03   ` Mark Fasheh
2008-08-10 16:49     ` [Ocfs2-devel] [PATCH 05/15] Add xattr header in ocfs2.v3 revised Tao Ma
2008-08-11  1:23       ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 06/15] Add helper function in uptodate for removing xattr clusters.V3 Tao Ma
2008-08-11  1:22   ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 07/15] Add extent tree operation for xattr value.v3 Tao Ma
2008-08-16  2:18   ` Joel Becker
2008-08-16  3:29     ` Joel Becker
2008-08-18 12:52       ` TaoMa
2008-08-16 10:40     ` TaoMa
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 10/15] Add xattr tree operations in ocfs2_extent_tree.v3 Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 11/15] Add xattr bucket iteration for large numbers of EAs.v11 Tao Ma
2008-08-12 21:22   ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 12/15] Add xattr find process for xattr index btree.v3 Tao Ma
2008-08-12 21:42   ` Mark Fasheh
2008-08-13 17:28     ` Tao Ma
2008-08-13 18:11       ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 13/15] Enable xattr set in index btree. v3 Tao Ma
2008-08-12  0:11   ` Mark Fasheh
2008-08-12  1:09     ` Tao Ma
2008-08-12 20:52       ` Mark Fasheh
2008-08-13 17:33         ` [Ocfs2-devel] [PATCH] Refactor ocfs2_insert_extent for not-merging Tao Ma
2008-08-13 20:32           ` Mark Fasheh
2008-08-14  1:13             ` Tao Ma
2008-08-14  2:04               ` Mark Fasheh
2008-08-14 16:22                 ` [Ocfs2-devel] [PATCH] Refactor ocfs2_insert_extent for not-merging. Revised Tao Ma
2008-08-15  3:09                   ` Mark Fasheh
2008-08-12 23:17   ` [Ocfs2-devel] [PATCH 13/15] Enable xattr set in index btree. v3 Mark Fasheh
2008-08-13  0:13     ` Tao Ma
2008-08-13  0:30       ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 14/15] Delete all xattr buckets in inode removal.v3 Tao Ma
2008-08-07  7:11 ` [Ocfs2-devel] [PATCH 08/15] ocfs2: reserve inline space for extended attribute Tiger Yang
2008-08-11  1:18   ` Mark Fasheh
2008-08-11  2:15     ` Tiger Yang
2008-08-07  7:11 ` [Ocfs2-devel] [PATCH 09/15] ocfs2: Add extended attribute support v3 Tiger Yang
2008-08-12  0:19   ` Mark Fasheh
2008-08-07  7:12 ` [Ocfs2-devel] [PATCH 15/15] ocfs2: Add incompatible flag for extended attribute v3 Tiger Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080814195522.GA28875@mail.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.