diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 15:13:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 15:13:56 -0400 |
commit | 78609a812e9afa87202631d128018361f68c44a9 (patch) | |
tree | 8c2d4b924ade170c69776d6cc39bec4dff3c8574 /fs/ocfs2/inode.c | |
parent | 133e2a3164771454aa326859c2b293687189b553 (diff) | |
parent | 9140db04ef185f934acf2b1b15b3dd5e6a6bfc22 (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2: (32 commits)
ocfs2: recover orphans in offline slots during recovery and mount
ocfs2: Pagecache usage optimization on ocfs2
ocfs2: fix rare stale inode errors when exporting via nfs
ocfs2/dlm: Tweak mle_state output
ocfs2/dlm: Do not purge lockres that is being migrated dlm_purge_lockres()
ocfs2/dlm: Remove struct dlm_lock_name in struct dlm_master_list_entry
ocfs2/dlm: Show the number of lockres/mles in dlm_state
ocfs2/dlm: dlm_set_lockres_owner() and dlm_change_lockres_owner() inlined
ocfs2/dlm: Improve lockres counts
ocfs2/dlm: Track number of mles
ocfs2/dlm: Indent dlm_cleanup_master_list()
ocfs2/dlm: Activate dlm->master_hash for master list entries
ocfs2/dlm: Create and destroy the dlm->master_hash
ocfs2/dlm: Refactor dlm_clean_master_list()
ocfs2/dlm: Clean up struct dlm_lock_name
ocfs2/dlm: Encapsulate adding and removing of mle from dlm->master_list
ocfs2: Optimize inode group allocation by recording last used group.
ocfs2: Allocate inode groups from global_bitmap.
ocfs2: Optimize inode allocation by remembering last group
ocfs2: fix leaf start calculation in ocfs2_dx_dir_rebalance()
...
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r-- | fs/ocfs2/inode.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 229e707bc050..10e1fa87396a 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "ocfs2.h" | 38 | #include "ocfs2.h" |
39 | 39 | ||
40 | #include "alloc.h" | 40 | #include "alloc.h" |
41 | #include "dir.h" | ||
41 | #include "blockcheck.h" | 42 | #include "blockcheck.h" |
42 | #include "dlmglue.h" | 43 | #include "dlmglue.h" |
43 | #include "extent_map.h" | 44 | #include "extent_map.h" |
@@ -112,6 +113,17 @@ void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi) | |||
112 | oi->ip_attr |= OCFS2_DIRSYNC_FL; | 113 | oi->ip_attr |= OCFS2_DIRSYNC_FL; |
113 | } | 114 | } |
114 | 115 | ||
116 | struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno) | ||
117 | { | ||
118 | struct ocfs2_find_inode_args args; | ||
119 | |||
120 | args.fi_blkno = blkno; | ||
121 | args.fi_flags = 0; | ||
122 | args.fi_ino = ino_from_blkno(sb, blkno); | ||
123 | args.fi_sysfile_type = 0; | ||
124 | |||
125 | return ilookup5(sb, blkno, ocfs2_find_actor, &args); | ||
126 | } | ||
115 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, | 127 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, |
116 | int sysfile_type) | 128 | int sysfile_type) |
117 | { | 129 | { |
@@ -275,7 +287,7 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | |||
275 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 287 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
276 | (unsigned long long)le64_to_cpu(fe->i_blkno)); | 288 | (unsigned long long)le64_to_cpu(fe->i_blkno)); |
277 | 289 | ||
278 | inode->i_nlink = le16_to_cpu(fe->i_links_count); | 290 | inode->i_nlink = ocfs2_read_links_count(fe); |
279 | 291 | ||
280 | if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) { | 292 | if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) { |
281 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SYSTEM_FILE; | 293 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SYSTEM_FILE; |
@@ -351,6 +363,8 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | |||
351 | 363 | ||
352 | ocfs2_set_inode_flags(inode); | 364 | ocfs2_set_inode_flags(inode); |
353 | 365 | ||
366 | OCFS2_I(inode)->ip_last_used_slot = 0; | ||
367 | OCFS2_I(inode)->ip_last_used_group = 0; | ||
354 | mlog_exit_void(); | 368 | mlog_exit_void(); |
355 | } | 369 | } |
356 | 370 | ||
@@ -606,7 +620,7 @@ static int ocfs2_remove_inode(struct inode *inode, | |||
606 | } | 620 | } |
607 | 621 | ||
608 | handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS + | 622 | handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS + |
609 | ocfs2_quota_trans_credits(inode->i_sb)); | 623 | ocfs2_quota_trans_credits(inode->i_sb)); |
610 | if (IS_ERR(handle)) { | 624 | if (IS_ERR(handle)) { |
611 | status = PTR_ERR(handle); | 625 | status = PTR_ERR(handle); |
612 | mlog_errno(status); | 626 | mlog_errno(status); |
@@ -740,6 +754,15 @@ static int ocfs2_wipe_inode(struct inode *inode, | |||
740 | goto bail_unlock_dir; | 754 | goto bail_unlock_dir; |
741 | } | 755 | } |
742 | 756 | ||
757 | /* Remove any dir index tree */ | ||
758 | if (S_ISDIR(inode->i_mode)) { | ||
759 | status = ocfs2_dx_dir_truncate(inode, di_bh); | ||
760 | if (status) { | ||
761 | mlog_errno(status); | ||
762 | goto bail_unlock_dir; | ||
763 | } | ||
764 | } | ||
765 | |||
743 | /*Free extended attribute resources associated with this inode.*/ | 766 | /*Free extended attribute resources associated with this inode.*/ |
744 | status = ocfs2_xattr_remove(inode, di_bh); | 767 | status = ocfs2_xattr_remove(inode, di_bh); |
745 | if (status < 0) { | 768 | if (status < 0) { |
@@ -949,6 +972,17 @@ void ocfs2_delete_inode(struct inode *inode) | |||
949 | goto bail; | 972 | goto bail; |
950 | } | 973 | } |
951 | 974 | ||
975 | /* | ||
976 | * Synchronize us against ocfs2_get_dentry. We take this in | ||
977 | * shared mode so that all nodes can still concurrently | ||
978 | * process deletes. | ||
979 | */ | ||
980 | status = ocfs2_nfs_sync_lock(OCFS2_SB(inode->i_sb), 0); | ||
981 | if (status < 0) { | ||
982 | mlog(ML_ERROR, "getting nfs sync lock(PR) failed %d\n", status); | ||
983 | ocfs2_cleanup_delete_inode(inode, 0); | ||
984 | goto bail_unblock; | ||
985 | } | ||
952 | /* Lock down the inode. This gives us an up to date view of | 986 | /* Lock down the inode. This gives us an up to date view of |
953 | * it's metadata (for verification), and allows us to | 987 | * it's metadata (for verification), and allows us to |
954 | * serialize delete_inode on multiple nodes. | 988 | * serialize delete_inode on multiple nodes. |
@@ -962,7 +996,7 @@ void ocfs2_delete_inode(struct inode *inode) | |||
962 | if (status != -ENOENT) | 996 | if (status != -ENOENT) |
963 | mlog_errno(status); | 997 | mlog_errno(status); |
964 | ocfs2_cleanup_delete_inode(inode, 0); | 998 | ocfs2_cleanup_delete_inode(inode, 0); |
965 | goto bail_unblock; | 999 | goto bail_unlock_nfs_sync; |
966 | } | 1000 | } |
967 | 1001 | ||
968 | /* Query the cluster. This will be the final decision made | 1002 | /* Query the cluster. This will be the final decision made |
@@ -1005,6 +1039,10 @@ void ocfs2_delete_inode(struct inode *inode) | |||
1005 | bail_unlock_inode: | 1039 | bail_unlock_inode: |
1006 | ocfs2_inode_unlock(inode, 1); | 1040 | ocfs2_inode_unlock(inode, 1); |
1007 | brelse(di_bh); | 1041 | brelse(di_bh); |
1042 | |||
1043 | bail_unlock_nfs_sync: | ||
1044 | ocfs2_nfs_sync_unlock(OCFS2_SB(inode->i_sb), 0); | ||
1045 | |||
1008 | bail_unblock: | 1046 | bail_unblock: |
1009 | status = sigprocmask(SIG_SETMASK, &oldset, NULL); | 1047 | status = sigprocmask(SIG_SETMASK, &oldset, NULL); |
1010 | if (status < 0) | 1048 | if (status < 0) |
@@ -1205,7 +1243,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle, | |||
1205 | spin_unlock(&OCFS2_I(inode)->ip_lock); | 1243 | spin_unlock(&OCFS2_I(inode)->ip_lock); |
1206 | 1244 | ||
1207 | fe->i_size = cpu_to_le64(i_size_read(inode)); | 1245 | fe->i_size = cpu_to_le64(i_size_read(inode)); |
1208 | fe->i_links_count = cpu_to_le16(inode->i_nlink); | 1246 | ocfs2_set_links_count(fe, inode->i_nlink); |
1209 | fe->i_uid = cpu_to_le32(inode->i_uid); | 1247 | fe->i_uid = cpu_to_le32(inode->i_uid); |
1210 | fe->i_gid = cpu_to_le32(inode->i_gid); | 1248 | fe->i_gid = cpu_to_le32(inode->i_gid); |
1211 | fe->i_mode = cpu_to_le16(inode->i_mode); | 1249 | fe->i_mode = cpu_to_le16(inode->i_mode); |
@@ -1242,7 +1280,7 @@ void ocfs2_refresh_inode(struct inode *inode, | |||
1242 | OCFS2_I(inode)->ip_dyn_features = le16_to_cpu(fe->i_dyn_features); | 1280 | OCFS2_I(inode)->ip_dyn_features = le16_to_cpu(fe->i_dyn_features); |
1243 | ocfs2_set_inode_flags(inode); | 1281 | ocfs2_set_inode_flags(inode); |
1244 | i_size_write(inode, le64_to_cpu(fe->i_size)); | 1282 | i_size_write(inode, le64_to_cpu(fe->i_size)); |
1245 | inode->i_nlink = le16_to_cpu(fe->i_links_count); | 1283 | inode->i_nlink = ocfs2_read_links_count(fe); |
1246 | inode->i_uid = le32_to_cpu(fe->i_uid); | 1284 | inode->i_uid = le32_to_cpu(fe->i_uid); |
1247 | inode->i_gid = le32_to_cpu(fe->i_gid); | 1285 | inode->i_gid = le32_to_cpu(fe->i_gid); |
1248 | inode->i_mode = le16_to_cpu(fe->i_mode); | 1286 | inode->i_mode = le16_to_cpu(fe->i_mode); |