lkml.org 
[lkml]   [2002]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[BK-PATCH 3/3] Introduce fs/inode.c::ilookup().
Date
From
Linus,

And this is the third patch, moving the inode hash calculation from
iget{,5}_locked() to get_new_inode{_fast}().

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/

===================================================================

This will update the following files:

fs/inode.c | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)

through these ChangeSets:

<aia21@cantab.net> (02/09/07 1.624)
Cleanup: Move inode hash calculation from fs/inode.c::iget_locked()
and iget5_locked() into get_new_inode_fast() and get_new_inode(),
respectively.


diff -Nru a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c Sat Sep 7 14:52:45 2002
+++ b/fs/inode.c Sat Sep 7 14:52:45 2002
@@ -538,15 +538,27 @@
}
EXPORT_SYMBOL(unlock_new_inode);

+static inline unsigned long hash(struct super_block *sb, unsigned long hashval)
+{
+ unsigned long tmp = hashval + ((unsigned long) sb / L1_CACHE_BYTES);
+ tmp = tmp + (tmp >> I_HASHBITS);
+ return tmp & I_HASHMASK;
+}
+
+/* Yeah, I know about quadratic hash. Maybe, later. */
+
/*
* This is called without the inode lock held.. Be careful.
*
* We no longer cache the sb_flags in i_flags - see fs.h
* -- rmk@arm.uk.linux.org
*/
-static struct inode * get_new_inode(struct super_block *sb, struct list_head *head, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *data)
+static inline struct inode *get_new_inode(struct super_block *sb,
+ unsigned long hashval, int (*test)(struct inode *, void *),
+ int (*set)(struct inode *, void *), void *data)
{
- struct inode * inode;
+ struct list_head *head = inode_hashtable + hash(sb, hashval);
+ struct inode *inode;

inode = alloc_inode(sb);
if (inode) {
@@ -594,9 +606,11 @@
* get_new_inode_fast is the fast path version of get_new_inode, see the
* comment at iget_locked for details.
*/
-static struct inode * get_new_inode_fast(struct super_block *sb, struct list_head *head, unsigned long ino)
+static inline struct inode *get_new_inode_fast(struct super_block *sb,
+ unsigned long ino)
{
- struct inode * inode;
+ struct list_head *head = inode_hashtable + hash(sb, ino);
+ struct inode *inode;

inode = alloc_inode(sb);
if (inode) {
@@ -633,15 +647,6 @@
return inode;
}

-static inline unsigned long hash(struct super_block *sb, unsigned long hashval)
-{
- unsigned long tmp = hashval + ((unsigned long) sb / L1_CACHE_BYTES);
- tmp = tmp + (tmp >> I_HASHBITS);
- return tmp & I_HASHMASK;
-}
-
-/* Yeah, I know about quadratic hash. Maybe, later. */
-
/**
* iunique - get a unique inode number
* @sb: superblock
@@ -787,7 +792,6 @@
int (*test)(struct inode *, void *),
int (*set)(struct inode *, void *), void *data)
{
- struct list_head *head = inode_hashtable + hash(sb, hashval);
struct inode *inode;

inode = ilookup5(sb, hashval, test, data);
@@ -797,7 +801,7 @@
* get_new_inode() will do the right thing, re-trying the search
* in case it had to block at any point.
*/
- return get_new_inode(sb, head, test, set, data);
+ return get_new_inode(sb, hashval, test, set, data);
}
EXPORT_SYMBOL(iget5_locked);

@@ -818,7 +822,6 @@
*/
struct inode *iget_locked(struct super_block *sb, unsigned long ino)
{
- struct list_head *head = inode_hashtable + hash(sb, ino);
struct inode *inode;

inode = ilookup(sb, ino);
@@ -828,7 +831,7 @@
* get_new_inode_fast() will do the right thing, re-trying the search
* in case it had to block at any point.
*/
- return get_new_inode_fast(sb, head, ino);
+ return get_new_inode_fast(sb, ino);
}
EXPORT_SYMBOL(iget_locked);

===================================================================
This BitKeeper patch contains the following changesets:
1.624
## Wrapped with gzip_uu ##


begin 664 bkpatch2667
M'XL(`*T$>CT``^5676^C1A1]9G[%E5:J;`?##&"^(D>;.%%C[4:-DMV'E2JA
M`28Q"F9<9G`:E?[W#H-CKYVD^Z&^U;:XUMQ[#_>><[#\#CX+5L<&+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e from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.042 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site