diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:02 -0400 |
commit | 826843a347cc8fd596a4c73d3fbdf04a1f130b8a (patch) | |
tree | f9511e70a57bd2c6432bdbd8fa6957881121266b /fs/ufs/inode.c | |
parent | 6ef4d6bf86a82965896eaa1a189177239ec2bbab (diff) |
[PATCH] ufs: directory and page cache: install aops
This series of patches finished "bugs fixing" mentioned
here http://lkml.org/lkml/2006/1/31/275 .
The main bugs:
* for i in `seq 1 1000`; do touch $i; done - crash system
* mkdir create directory without "." and ".." entries
The suggested solution is work with page cache instead of straight work
with blocks. Such solution has following advantages
* reduce code size and its complexity
* some global locks go away
* fix bugs
The most part of code is stolen from ext2, because of it has similar
directory structure.
Patches testes with UFS1 and UFS2 file systems.
This patch installs i_mapping->a_ops for directory inodes and removes some
duplicated code.
Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ufs/inode.c')
-rw-r--r-- | fs/ufs/inode.c | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index ea2267316a72..c28b7522c9e7 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -552,6 +552,28 @@ struct address_space_operations ufs_aops = { | |||
552 | .bmap = ufs_bmap | 552 | .bmap = ufs_bmap |
553 | }; | 553 | }; |
554 | 554 | ||
555 | static void ufs_set_inode_ops(struct inode *inode) | ||
556 | { | ||
557 | if (S_ISREG(inode->i_mode)) { | ||
558 | inode->i_op = &ufs_file_inode_operations; | ||
559 | inode->i_fop = &ufs_file_operations; | ||
560 | inode->i_mapping->a_ops = &ufs_aops; | ||
561 | } else if (S_ISDIR(inode->i_mode)) { | ||
562 | inode->i_op = &ufs_dir_inode_operations; | ||
563 | inode->i_fop = &ufs_dir_operations; | ||
564 | inode->i_mapping->a_ops = &ufs_aops; | ||
565 | } else if (S_ISLNK(inode->i_mode)) { | ||
566 | if (!inode->i_blocks) | ||
567 | inode->i_op = &ufs_fast_symlink_inode_operations; | ||
568 | else { | ||
569 | inode->i_op = &page_symlink_inode_operations; | ||
570 | inode->i_mapping->a_ops = &ufs_aops; | ||
571 | } | ||
572 | } else | ||
573 | init_special_inode(inode, inode->i_mode, | ||
574 | ufs_get_inode_dev(inode->i_sb, UFS_I(inode))); | ||
575 | } | ||
576 | |||
555 | void ufs_read_inode (struct inode * inode) | 577 | void ufs_read_inode (struct inode * inode) |
556 | { | 578 | { |
557 | struct ufs_inode_info *ufsi = UFS_I(inode); | 579 | struct ufs_inode_info *ufsi = UFS_I(inode); |
@@ -626,23 +648,7 @@ void ufs_read_inode (struct inode * inode) | |||
626 | } | 648 | } |
627 | ufsi->i_osync = 0; | 649 | ufsi->i_osync = 0; |
628 | 650 | ||
629 | if (S_ISREG(inode->i_mode)) { | 651 | ufs_set_inode_ops(inode); |
630 | inode->i_op = &ufs_file_inode_operations; | ||
631 | inode->i_fop = &ufs_file_operations; | ||
632 | inode->i_mapping->a_ops = &ufs_aops; | ||
633 | } else if (S_ISDIR(inode->i_mode)) { | ||
634 | inode->i_op = &ufs_dir_inode_operations; | ||
635 | inode->i_fop = &ufs_dir_operations; | ||
636 | } else if (S_ISLNK(inode->i_mode)) { | ||
637 | if (!inode->i_blocks) | ||
638 | inode->i_op = &ufs_fast_symlink_inode_operations; | ||
639 | else { | ||
640 | inode->i_op = &page_symlink_inode_operations; | ||
641 | inode->i_mapping->a_ops = &ufs_aops; | ||
642 | } | ||
643 | } else | ||
644 | init_special_inode(inode, inode->i_mode, | ||
645 | ufs_get_inode_dev(sb, ufsi)); | ||
646 | 652 | ||
647 | brelse (bh); | 653 | brelse (bh); |
648 | 654 | ||
@@ -702,23 +708,7 @@ ufs2_inode : | |||
702 | } | 708 | } |
703 | ufsi->i_osync = 0; | 709 | ufsi->i_osync = 0; |
704 | 710 | ||
705 | if (S_ISREG(inode->i_mode)) { | 711 | ufs_set_inode_ops(inode); |
706 | inode->i_op = &ufs_file_inode_operations; | ||
707 | inode->i_fop = &ufs_file_operations; | ||
708 | inode->i_mapping->a_ops = &ufs_aops; | ||
709 | } else if (S_ISDIR(inode->i_mode)) { | ||
710 | inode->i_op = &ufs_dir_inode_operations; | ||
711 | inode->i_fop = &ufs_dir_operations; | ||
712 | } else if (S_ISLNK(inode->i_mode)) { | ||
713 | if (!inode->i_blocks) | ||
714 | inode->i_op = &ufs_fast_symlink_inode_operations; | ||
715 | else { | ||
716 | inode->i_op = &page_symlink_inode_operations; | ||
717 | inode->i_mapping->a_ops = &ufs_aops; | ||
718 | } | ||
719 | } else /* TODO : here ...*/ | ||
720 | init_special_inode(inode, inode->i_mode, | ||
721 | ufs_get_inode_dev(sb, ufsi)); | ||
722 | 712 | ||
723 | brelse(bh); | 713 | brelse(bh); |
724 | 714 | ||