diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/fs/inode.c b/fs/inode.c index 5abb097ab1b0..df2ef15d03d2 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -213,8 +213,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
213 | { | 213 | { |
214 | struct inode * inode = (struct inode *) foo; | 214 | struct inode * inode = (struct inode *) foo; |
215 | 215 | ||
216 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 216 | if (flags & SLAB_CTOR_CONSTRUCTOR) |
217 | SLAB_CTOR_CONSTRUCTOR) | ||
218 | inode_init_once(inode); | 217 | inode_init_once(inode); |
219 | } | 218 | } |
220 | 219 | ||
@@ -251,7 +250,7 @@ void clear_inode(struct inode *inode) | |||
251 | BUG_ON(inode->i_state & I_CLEAR); | 250 | BUG_ON(inode->i_state & I_CLEAR); |
252 | wait_on_inode(inode); | 251 | wait_on_inode(inode); |
253 | DQUOT_DROP(inode); | 252 | DQUOT_DROP(inode); |
254 | if (inode->i_sb && inode->i_sb->s_op->clear_inode) | 253 | if (inode->i_sb->s_op->clear_inode) |
255 | inode->i_sb->s_op->clear_inode(inode); | 254 | inode->i_sb->s_op->clear_inode(inode); |
256 | if (S_ISBLK(inode->i_mode) && inode->i_bdev) | 255 | if (S_ISBLK(inode->i_mode) && inode->i_bdev) |
257 | bd_forget(inode); | 256 | bd_forget(inode); |
@@ -276,7 +275,7 @@ static void dispose_list(struct list_head *head) | |||
276 | while (!list_empty(head)) { | 275 | while (!list_empty(head)) { |
277 | struct inode *inode; | 276 | struct inode *inode; |
278 | 277 | ||
279 | inode = list_entry(head->next, struct inode, i_list); | 278 | inode = list_first_entry(head, struct inode, i_list); |
280 | list_del(&inode->i_list); | 279 | list_del(&inode->i_list); |
281 | 280 | ||
282 | if (inode->i_data.nrpages) | 281 | if (inode->i_data.nrpages) |
@@ -525,7 +524,12 @@ repeat: | |||
525 | */ | 524 | */ |
526 | struct inode *new_inode(struct super_block *sb) | 525 | struct inode *new_inode(struct super_block *sb) |
527 | { | 526 | { |
528 | static unsigned long last_ino; | 527 | /* |
528 | * On a 32bit, non LFS stat() call, glibc will generate an EOVERFLOW | ||
529 | * error if st_ino won't fit in target struct field. Use 32bit counter | ||
530 | * here to attempt to avoid that. | ||
531 | */ | ||
532 | static unsigned int last_ino; | ||
529 | struct inode * inode; | 533 | struct inode * inode; |
530 | 534 | ||
531 | spin_lock_prefetch(&inode_lock); | 535 | spin_lock_prefetch(&inode_lock); |
@@ -684,27 +688,28 @@ static unsigned long hash(struct super_block *sb, unsigned long hashval) | |||
684 | */ | 688 | */ |
685 | ino_t iunique(struct super_block *sb, ino_t max_reserved) | 689 | ino_t iunique(struct super_block *sb, ino_t max_reserved) |
686 | { | 690 | { |
687 | static ino_t counter; | 691 | /* |
692 | * On a 32bit, non LFS stat() call, glibc will generate an EOVERFLOW | ||
693 | * error if st_ino won't fit in target struct field. Use 32bit counter | ||
694 | * here to attempt to avoid that. | ||
695 | */ | ||
696 | static unsigned int counter; | ||
688 | struct inode *inode; | 697 | struct inode *inode; |
689 | struct hlist_head * head; | 698 | struct hlist_head *head; |
690 | ino_t res; | 699 | ino_t res; |
700 | |||
691 | spin_lock(&inode_lock); | 701 | spin_lock(&inode_lock); |
692 | retry: | 702 | do { |
693 | if (counter > max_reserved) { | 703 | if (counter <= max_reserved) |
694 | head = inode_hashtable + hash(sb,counter); | 704 | counter = max_reserved + 1; |
695 | res = counter++; | 705 | res = counter++; |
706 | head = inode_hashtable + hash(sb, res); | ||
696 | inode = find_inode_fast(sb, head, res); | 707 | inode = find_inode_fast(sb, head, res); |
697 | if (!inode) { | 708 | } while (inode != NULL); |
698 | spin_unlock(&inode_lock); | 709 | spin_unlock(&inode_lock); |
699 | return res; | ||
700 | } | ||
701 | } else { | ||
702 | counter = max_reserved + 1; | ||
703 | } | ||
704 | goto retry; | ||
705 | |||
706 | } | ||
707 | 710 | ||
711 | return res; | ||
712 | } | ||
708 | EXPORT_SYMBOL(iunique); | 713 | EXPORT_SYMBOL(iunique); |
709 | 714 | ||
710 | struct inode *igrab(struct inode *inode) | 715 | struct inode *igrab(struct inode *inode) |
@@ -1041,7 +1046,7 @@ static void generic_forget_inode(struct inode *inode) | |||
1041 | if (!(inode->i_state & (I_DIRTY|I_LOCK))) | 1046 | if (!(inode->i_state & (I_DIRTY|I_LOCK))) |
1042 | list_move(&inode->i_list, &inode_unused); | 1047 | list_move(&inode->i_list, &inode_unused); |
1043 | inodes_stat.nr_unused++; | 1048 | inodes_stat.nr_unused++; |
1044 | if (!sb || (sb->s_flags & MS_ACTIVE)) { | 1049 | if (sb->s_flags & MS_ACTIVE) { |
1045 | spin_unlock(&inode_lock); | 1050 | spin_unlock(&inode_lock); |
1046 | return; | 1051 | return; |
1047 | } | 1052 | } |