diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 21:05:07 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 21:05:07 -0500 |
commit | 693dd321222f03b17668f88ceb0f7d518900191e (patch) | |
tree | b0088ee73f3499e0b3301fc5dcf44c677cfd092d /fs/nilfs2/inode.c | |
parent | 574e6c3145c5754141361c695b58736c294a8ae1 (diff) |
nilfs2: move s_inode_lock and s_dirty_files into nilfs object
Moves s_inode_lock spinlock and s_dirty_files list to nilfs object
from nilfs_sb_info structure.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/inode.c')
-rw-r--r-- | fs/nilfs2/inode.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 22a816ba3621..dd5d6d633ea1 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -807,18 +807,18 @@ int nilfs_permission(struct inode *inode, int mask, unsigned int flags) | |||
807 | 807 | ||
808 | int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh) | 808 | int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh) |
809 | { | 809 | { |
810 | struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb); | 810 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; |
811 | struct nilfs_inode_info *ii = NILFS_I(inode); | 811 | struct nilfs_inode_info *ii = NILFS_I(inode); |
812 | int err; | 812 | int err; |
813 | 813 | ||
814 | spin_lock(&sbi->s_inode_lock); | 814 | spin_lock(&nilfs->ns_inode_lock); |
815 | if (ii->i_bh == NULL) { | 815 | if (ii->i_bh == NULL) { |
816 | spin_unlock(&sbi->s_inode_lock); | 816 | spin_unlock(&nilfs->ns_inode_lock); |
817 | err = nilfs_ifile_get_inode_block(ii->i_root->ifile, | 817 | err = nilfs_ifile_get_inode_block(ii->i_root->ifile, |
818 | inode->i_ino, pbh); | 818 | inode->i_ino, pbh); |
819 | if (unlikely(err)) | 819 | if (unlikely(err)) |
820 | return err; | 820 | return err; |
821 | spin_lock(&sbi->s_inode_lock); | 821 | spin_lock(&nilfs->ns_inode_lock); |
822 | if (ii->i_bh == NULL) | 822 | if (ii->i_bh == NULL) |
823 | ii->i_bh = *pbh; | 823 | ii->i_bh = *pbh; |
824 | else { | 824 | else { |
@@ -829,36 +829,36 @@ int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh) | |||
829 | *pbh = ii->i_bh; | 829 | *pbh = ii->i_bh; |
830 | 830 | ||
831 | get_bh(*pbh); | 831 | get_bh(*pbh); |
832 | spin_unlock(&sbi->s_inode_lock); | 832 | spin_unlock(&nilfs->ns_inode_lock); |
833 | return 0; | 833 | return 0; |
834 | } | 834 | } |
835 | 835 | ||
836 | int nilfs_inode_dirty(struct inode *inode) | 836 | int nilfs_inode_dirty(struct inode *inode) |
837 | { | 837 | { |
838 | struct nilfs_inode_info *ii = NILFS_I(inode); | 838 | struct nilfs_inode_info *ii = NILFS_I(inode); |
839 | struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb); | 839 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; |
840 | int ret = 0; | 840 | int ret = 0; |
841 | 841 | ||
842 | if (!list_empty(&ii->i_dirty)) { | 842 | if (!list_empty(&ii->i_dirty)) { |
843 | spin_lock(&sbi->s_inode_lock); | 843 | spin_lock(&nilfs->ns_inode_lock); |
844 | ret = test_bit(NILFS_I_DIRTY, &ii->i_state) || | 844 | ret = test_bit(NILFS_I_DIRTY, &ii->i_state) || |
845 | test_bit(NILFS_I_BUSY, &ii->i_state); | 845 | test_bit(NILFS_I_BUSY, &ii->i_state); |
846 | spin_unlock(&sbi->s_inode_lock); | 846 | spin_unlock(&nilfs->ns_inode_lock); |
847 | } | 847 | } |
848 | return ret; | 848 | return ret; |
849 | } | 849 | } |
850 | 850 | ||
851 | int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty) | 851 | int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty) |
852 | { | 852 | { |
853 | struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb); | ||
854 | struct nilfs_inode_info *ii = NILFS_I(inode); | 853 | struct nilfs_inode_info *ii = NILFS_I(inode); |
854 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; | ||
855 | 855 | ||
856 | atomic_add(nr_dirty, &sbi->s_nilfs->ns_ndirtyblks); | 856 | atomic_add(nr_dirty, &nilfs->ns_ndirtyblks); |
857 | 857 | ||
858 | if (test_and_set_bit(NILFS_I_DIRTY, &ii->i_state)) | 858 | if (test_and_set_bit(NILFS_I_DIRTY, &ii->i_state)) |
859 | return 0; | 859 | return 0; |
860 | 860 | ||
861 | spin_lock(&sbi->s_inode_lock); | 861 | spin_lock(&nilfs->ns_inode_lock); |
862 | if (!test_bit(NILFS_I_QUEUED, &ii->i_state) && | 862 | if (!test_bit(NILFS_I_QUEUED, &ii->i_state) && |
863 | !test_bit(NILFS_I_BUSY, &ii->i_state)) { | 863 | !test_bit(NILFS_I_BUSY, &ii->i_state)) { |
864 | /* Because this routine may race with nilfs_dispose_list(), | 864 | /* Because this routine may race with nilfs_dispose_list(), |
@@ -866,18 +866,18 @@ int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty) | |||
866 | if (list_empty(&ii->i_dirty) && igrab(inode) == NULL) { | 866 | if (list_empty(&ii->i_dirty) && igrab(inode) == NULL) { |
867 | /* This will happen when somebody is freeing | 867 | /* This will happen when somebody is freeing |
868 | this inode. */ | 868 | this inode. */ |
869 | nilfs_warning(sbi->s_super, __func__, | 869 | nilfs_warning(inode->i_sb, __func__, |
870 | "cannot get inode (ino=%lu)\n", | 870 | "cannot get inode (ino=%lu)\n", |
871 | inode->i_ino); | 871 | inode->i_ino); |
872 | spin_unlock(&sbi->s_inode_lock); | 872 | spin_unlock(&nilfs->ns_inode_lock); |
873 | return -EINVAL; /* NILFS_I_DIRTY may remain for | 873 | return -EINVAL; /* NILFS_I_DIRTY may remain for |
874 | freeing inode */ | 874 | freeing inode */ |
875 | } | 875 | } |
876 | list_del(&ii->i_dirty); | 876 | list_del(&ii->i_dirty); |
877 | list_add_tail(&ii->i_dirty, &sbi->s_dirty_files); | 877 | list_add_tail(&ii->i_dirty, &nilfs->ns_dirty_files); |
878 | set_bit(NILFS_I_QUEUED, &ii->i_state); | 878 | set_bit(NILFS_I_QUEUED, &ii->i_state); |
879 | } | 879 | } |
880 | spin_unlock(&sbi->s_inode_lock); | 880 | spin_unlock(&nilfs->ns_inode_lock); |
881 | return 0; | 881 | return 0; |
882 | } | 882 | } |
883 | 883 | ||