ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: tristan <tristan.ye@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/2] Ocfs2: Add a new code 'OCFS2_INFO_FREEINODE' for o2info ioctl.
Date: Thu, 04 Nov 2010 16:10:50 +0800	[thread overview]
Message-ID: <4CD26A8A.6080307@oracle.com> (raw)
In-Reply-To: <20101104062836.GB22663@mail.oracle.com>

Joel Becker wrote:
> On Thu, Nov 04, 2010 at 10:27:01AM +0800, tristan wrote:
>> Joel Becker wrote:
>>> On Wed, Nov 03, 2010 at 07:02:05PM +0800, Tristan Ye wrote:
>>>> The new code is dedicated to calculate free inodes number of all inode_allocs,
>>>> then return the info to userpace in terms of an array.
>>>>
>>>> Specially, flag 'OCFS2_INFO_FL_NON_COHERENT', manipulated by '--cluster-coherent'
>>>> from userspace, is now going to be involved. setting the flag on means no cluster
>>>> coherency considered, usually, userspace tools choose none-coherency strategy by
>>>> default for the sake of performace.
>>> 	This looks pretty straightforward.  Note that any non-cached
>>> allocator is going to lock, regardless of the coherency flag.  Do we
>>> want to use ocfs2_ilookup() instead?
>> A bit confused here, did you mean we use 'ocfs2_ilookup' instead of 
>> 'ocfs2_get_system_file_inode' here?
>
> 	I do.  ocfs2_get_system_file_inode() calls ocfs2_iget(), which
> will read and lock the inode if it is not in the inode cache.  Now, the
> cache-coherent case obviously wants this.
> 	But in the non-coherent case we have the following conditions:
>
> 1) We have an inode in the inode cache, we can use it to look up the
>    blkno.
> 2) We have no inode in the cache, and we have to go get it.
>
> 	Case (1) is fast.  Case (2) is not, especially because it locks
> the inode.  Why not merely look up blkno via
> ocfs2_lookup_ino_from_name() and go from there?  Note that
> ocfs2_ilookup() isn't even needed, unless you have a faster way to get
> to the blkno.
>

    Yep, you're correct, other than the operation we read inode block, 
the lookup
of blkno/inode should also be treated differently according to coherency 
flag, I
guess following logic could help:

if (cluster_coherent) {
    alloc_inode = ocfs2_get_system_file_inode();
    ocfs2_inode_lock(alloc_inode, &bh);
} else {
    ocfs2_lookup_ino_from_name("global_bitmap", &blkno);
    ocfs2_read_blocks(blkno, 1, &bh);
}
...

Above logic guarantee the performance for none-coherency case.


>> coherency flag refers to a cluster-aware lock, while 
>> ocfs2_get_system_file_inode will use iget_locked() to get
>> the inode if it didn't exist in cache, does iget_locked() also refer to 
>> a cluster-aware lock somehow?
>
> 	Yes.  If an inode is not in cache, it will eventually call
> ocfs2_read_inode_locked().
>
> Joel
>

  reply	other threads:[~2010-11-04  8:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-03 11:02 [Ocfs2-devel] [PATCH 1/2] Ocfs2: Add a new code 'OCFS2_INFO_FREEINODE' for o2info ioctl Tristan Ye
2010-11-03 11:02 ` [Ocfs2-devel] [PATCH 2/2] Ocfs2: Add a new code 'OCFS2_INFO_FREEFRAG' " Tristan Ye
2010-11-04  1:29   ` Joel Becker
2010-11-04  2:56     ` tristan
2010-11-04  4:47       ` tristan
2010-11-04  6:32       ` Joel Becker
2010-11-04  7:05         ` tristan
2010-12-07  0:46           ` Joel Becker
2010-11-04  1:18 ` [Ocfs2-devel] [PATCH 1/2] Ocfs2: Add a new code 'OCFS2_INFO_FREEINODE' " Joel Becker
2010-11-04  2:27   ` tristan
2010-11-04  6:28     ` Joel Becker
2010-11-04  8:10       ` tristan [this message]
2010-11-04 21:24         ` Joel Becker

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=4CD26A8A.6080307@oracle.com \
    --to=tristan.ye@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).