Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145511
b: refs/heads/master
c: 72a43d6
h: refs/heads/master
i:
  145509: 1cd4587
  145507: c9d1e57
  145503: d2264fc
v: v3
  • Loading branch information
Al Viro committed Jun 6, 2009
1 parent b63b17e commit 19e66b5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 460bcf57b128ce1c0dd553d905fedc097f9955c6
refs/heads/master: 72a43d63cb51057393edfbcfc4596066205ad15d
31 changes: 25 additions & 6 deletions trunk/fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,13 +1053,22 @@ int insert_inode_locked(struct inode *inode)
struct super_block *sb = inode->i_sb;
ino_t ino = inode->i_ino;
struct hlist_head *head = inode_hashtable + hash(sb, ino);
struct inode *old;

inode->i_state |= I_LOCK|I_NEW;
while (1) {
struct hlist_node *node;
struct inode *old = NULL;
spin_lock(&inode_lock);
old = find_inode_fast(sb, head, ino);
if (likely(!old)) {
hlist_for_each_entry(old, node, head, i_hash) {
if (old->i_ino != ino)
continue;
if (old->i_sb != sb)
continue;
if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE))
continue;
break;
}
if (likely(!node)) {
hlist_add_head(&inode->i_hash, head);
spin_unlock(&inode_lock);
return 0;
Expand All @@ -1081,14 +1090,24 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
{
struct super_block *sb = inode->i_sb;
struct hlist_head *head = inode_hashtable + hash(sb, hashval);
struct inode *old;

inode->i_state |= I_LOCK|I_NEW;

while (1) {
struct hlist_node *node;
struct inode *old = NULL;

spin_lock(&inode_lock);
old = find_inode(sb, head, test, data);
if (likely(!old)) {
hlist_for_each_entry(old, node, head, i_hash) {
if (old->i_sb != sb)
continue;
if (!test(old, data))
continue;
if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE))
continue;
break;
}
if (likely(!node)) {
hlist_add_head(&inode->i_hash, head);
spin_unlock(&inode_lock);
return 0;
Expand Down

0 comments on commit 19e66b5

Please sign in to comment.