diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 171 |
1 files changed, 53 insertions, 118 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 80938c736c2..758df94690e 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
| @@ -25,14 +25,11 @@ | |||
| 25 | #include "xfs_ag.h" | 25 | #include "xfs_ag.h" |
| 26 | #include "xfs_dir2.h" | 26 | #include "xfs_dir2.h" |
| 27 | #include "xfs_alloc.h" | 27 | #include "xfs_alloc.h" |
| 28 | #include "xfs_dmapi.h" | ||
| 29 | #include "xfs_quota.h" | 28 | #include "xfs_quota.h" |
| 30 | #include "xfs_mount.h" | 29 | #include "xfs_mount.h" |
| 31 | #include "xfs_bmap_btree.h" | 30 | #include "xfs_bmap_btree.h" |
| 32 | #include "xfs_alloc_btree.h" | 31 | #include "xfs_alloc_btree.h" |
| 33 | #include "xfs_ialloc_btree.h" | 32 | #include "xfs_ialloc_btree.h" |
| 34 | #include "xfs_dir2_sf.h" | ||
| 35 | #include "xfs_attr_sf.h" | ||
| 36 | #include "xfs_dinode.h" | 33 | #include "xfs_dinode.h" |
| 37 | #include "xfs_inode.h" | 34 | #include "xfs_inode.h" |
| 38 | #include "xfs_btree.h" | 35 | #include "xfs_btree.h" |
| @@ -43,7 +40,6 @@ | |||
| 43 | #include "xfs_error.h" | 40 | #include "xfs_error.h" |
| 44 | #include "xfs_itable.h" | 41 | #include "xfs_itable.h" |
| 45 | #include "xfs_fsops.h" | 42 | #include "xfs_fsops.h" |
| 46 | #include "xfs_rw.h" | ||
| 47 | #include "xfs_attr.h" | 43 | #include "xfs_attr.h" |
| 48 | #include "xfs_buf_item.h" | 44 | #include "xfs_buf_item.h" |
| 49 | #include "xfs_utils.h" | 45 | #include "xfs_utils.h" |
| @@ -94,7 +90,6 @@ mempool_t *xfs_ioend_pool; | |||
| 94 | #define MNTOPT_BARRIER "barrier" /* use writer barriers for log write and | 90 | #define MNTOPT_BARRIER "barrier" /* use writer barriers for log write and |
| 95 | * unwritten extent conversion */ | 91 | * unwritten extent conversion */ |
| 96 | #define MNTOPT_NOBARRIER "nobarrier" /* .. disable */ | 92 | #define MNTOPT_NOBARRIER "nobarrier" /* .. disable */ |
| 97 | #define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */ | ||
| 98 | #define MNTOPT_64BITINODE "inode64" /* inodes can be allocated anywhere */ | 93 | #define MNTOPT_64BITINODE "inode64" /* inodes can be allocated anywhere */ |
| 99 | #define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */ | 94 | #define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */ |
| 100 | #define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */ | 95 | #define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */ |
| @@ -116,9 +111,6 @@ mempool_t *xfs_ioend_pool; | |||
| 116 | #define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */ | 111 | #define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */ |
| 117 | #define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */ | 112 | #define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */ |
| 118 | #define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */ | 113 | #define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */ |
| 119 | #define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */ | ||
| 120 | #define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */ | ||
| 121 | #define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */ | ||
| 122 | #define MNTOPT_DELAYLOG "delaylog" /* Delayed loging enabled */ | 114 | #define MNTOPT_DELAYLOG "delaylog" /* Delayed loging enabled */ |
| 123 | #define MNTOPT_NODELAYLOG "nodelaylog" /* Delayed loging disabled */ | 115 | #define MNTOPT_NODELAYLOG "nodelaylog" /* Delayed loging disabled */ |
| 124 | 116 | ||
| @@ -172,15 +164,13 @@ suffix_strtoul(char *s, char **endp, unsigned int base) | |||
| 172 | STATIC int | 164 | STATIC int |
| 173 | xfs_parseargs( | 165 | xfs_parseargs( |
| 174 | struct xfs_mount *mp, | 166 | struct xfs_mount *mp, |
| 175 | char *options, | 167 | char *options) |
| 176 | char **mtpt) | ||
| 177 | { | 168 | { |
| 178 | struct super_block *sb = mp->m_super; | 169 | struct super_block *sb = mp->m_super; |
| 179 | char *this_char, *value, *eov; | 170 | char *this_char, *value, *eov; |
| 180 | int dsunit = 0; | 171 | int dsunit = 0; |
| 181 | int dswidth = 0; | 172 | int dswidth = 0; |
| 182 | int iosize = 0; | 173 | int iosize = 0; |
| 183 | int dmapi_implies_ikeep = 1; | ||
| 184 | __uint8_t iosizelog = 0; | 174 | __uint8_t iosizelog = 0; |
| 185 | 175 | ||
| 186 | /* | 176 | /* |
| @@ -243,15 +233,10 @@ xfs_parseargs( | |||
| 243 | if (!mp->m_logname) | 233 | if (!mp->m_logname) |
| 244 | return ENOMEM; | 234 | return ENOMEM; |
| 245 | } else if (!strcmp(this_char, MNTOPT_MTPT)) { | 235 | } else if (!strcmp(this_char, MNTOPT_MTPT)) { |
| 246 | if (!value || !*value) { | 236 | cmn_err(CE_WARN, |
| 247 | cmn_err(CE_WARN, | 237 | "XFS: %s option not allowed on this system", |
| 248 | "XFS: %s option requires an argument", | 238 | this_char); |
| 249 | this_char); | 239 | return EINVAL; |
| 250 | return EINVAL; | ||
| 251 | } | ||
| 252 | *mtpt = kstrndup(value, MAXNAMELEN, GFP_KERNEL); | ||
| 253 | if (!*mtpt) | ||
| 254 | return ENOMEM; | ||
| 255 | } else if (!strcmp(this_char, MNTOPT_RTDEV)) { | 240 | } else if (!strcmp(this_char, MNTOPT_RTDEV)) { |
| 256 | if (!value || !*value) { | 241 | if (!value || !*value) { |
| 257 | cmn_err(CE_WARN, | 242 | cmn_err(CE_WARN, |
| @@ -288,8 +273,6 @@ xfs_parseargs( | |||
| 288 | mp->m_flags &= ~XFS_MOUNT_GRPID; | 273 | mp->m_flags &= ~XFS_MOUNT_GRPID; |
| 289 | } else if (!strcmp(this_char, MNTOPT_WSYNC)) { | 274 | } else if (!strcmp(this_char, MNTOPT_WSYNC)) { |
| 290 | mp->m_flags |= XFS_MOUNT_WSYNC; | 275 | mp->m_flags |= XFS_MOUNT_WSYNC; |
| 291 | } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) { | ||
| 292 | mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC; | ||
| 293 | } else if (!strcmp(this_char, MNTOPT_NORECOVERY)) { | 276 | } else if (!strcmp(this_char, MNTOPT_NORECOVERY)) { |
| 294 | mp->m_flags |= XFS_MOUNT_NORECOVERY; | 277 | mp->m_flags |= XFS_MOUNT_NORECOVERY; |
| 295 | } else if (!strcmp(this_char, MNTOPT_NOALIGN)) { | 278 | } else if (!strcmp(this_char, MNTOPT_NOALIGN)) { |
| @@ -329,7 +312,6 @@ xfs_parseargs( | |||
| 329 | } else if (!strcmp(this_char, MNTOPT_IKEEP)) { | 312 | } else if (!strcmp(this_char, MNTOPT_IKEEP)) { |
| 330 | mp->m_flags |= XFS_MOUNT_IKEEP; | 313 | mp->m_flags |= XFS_MOUNT_IKEEP; |
| 331 | } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) { | 314 | } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) { |
| 332 | dmapi_implies_ikeep = 0; | ||
| 333 | mp->m_flags &= ~XFS_MOUNT_IKEEP; | 315 | mp->m_flags &= ~XFS_MOUNT_IKEEP; |
| 334 | } else if (!strcmp(this_char, MNTOPT_LARGEIO)) { | 316 | } else if (!strcmp(this_char, MNTOPT_LARGEIO)) { |
| 335 | mp->m_flags &= ~XFS_MOUNT_COMPAT_IOSIZE; | 317 | mp->m_flags &= ~XFS_MOUNT_COMPAT_IOSIZE; |
| @@ -370,12 +352,6 @@ xfs_parseargs( | |||
| 370 | } else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) { | 352 | } else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) { |
| 371 | mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); | 353 | mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); |
| 372 | mp->m_qflags &= ~XFS_OQUOTA_ENFD; | 354 | mp->m_qflags &= ~XFS_OQUOTA_ENFD; |
| 373 | } else if (!strcmp(this_char, MNTOPT_DMAPI)) { | ||
| 374 | mp->m_flags |= XFS_MOUNT_DMAPI; | ||
| 375 | } else if (!strcmp(this_char, MNTOPT_XDSM)) { | ||
| 376 | mp->m_flags |= XFS_MOUNT_DMAPI; | ||
| 377 | } else if (!strcmp(this_char, MNTOPT_DMI)) { | ||
| 378 | mp->m_flags |= XFS_MOUNT_DMAPI; | ||
| 379 | } else if (!strcmp(this_char, MNTOPT_DELAYLOG)) { | 355 | } else if (!strcmp(this_char, MNTOPT_DELAYLOG)) { |
| 380 | mp->m_flags |= XFS_MOUNT_DELAYLOG; | 356 | mp->m_flags |= XFS_MOUNT_DELAYLOG; |
| 381 | cmn_err(CE_WARN, | 357 | cmn_err(CE_WARN, |
| @@ -387,9 +363,11 @@ xfs_parseargs( | |||
| 387 | cmn_err(CE_WARN, | 363 | cmn_err(CE_WARN, |
| 388 | "XFS: ihashsize no longer used, option is deprecated."); | 364 | "XFS: ihashsize no longer used, option is deprecated."); |
| 389 | } else if (!strcmp(this_char, "osyncisdsync")) { | 365 | } else if (!strcmp(this_char, "osyncisdsync")) { |
| 390 | /* no-op, this is now the default */ | ||
| 391 | cmn_err(CE_WARN, | 366 | cmn_err(CE_WARN, |
| 392 | "XFS: osyncisdsync is now the default, option is deprecated."); | 367 | "XFS: osyncisdsync has no effect, option is deprecated."); |
| 368 | } else if (!strcmp(this_char, "osyncisosync")) { | ||
| 369 | cmn_err(CE_WARN, | ||
| 370 | "XFS: osyncisosync has no effect, option is deprecated."); | ||
| 393 | } else if (!strcmp(this_char, "irixsgid")) { | 371 | } else if (!strcmp(this_char, "irixsgid")) { |
| 394 | cmn_err(CE_WARN, | 372 | cmn_err(CE_WARN, |
| 395 | "XFS: irixsgid is now a sysctl(2) variable, option is deprecated."); | 373 | "XFS: irixsgid is now a sysctl(2) variable, option is deprecated."); |
| @@ -430,12 +408,6 @@ xfs_parseargs( | |||
| 430 | return EINVAL; | 408 | return EINVAL; |
| 431 | } | 409 | } |
| 432 | 410 | ||
| 433 | if ((mp->m_flags & XFS_MOUNT_DMAPI) && (!*mtpt || *mtpt[0] == '\0')) { | ||
| 434 | printk("XFS: %s option needs the mount point option as well\n", | ||
| 435 | MNTOPT_DMAPI); | ||
| 436 | return EINVAL; | ||
| 437 | } | ||
| 438 | |||
| 439 | if ((dsunit && !dswidth) || (!dsunit && dswidth)) { | 411 | if ((dsunit && !dswidth) || (!dsunit && dswidth)) { |
| 440 | cmn_err(CE_WARN, | 412 | cmn_err(CE_WARN, |
| 441 | "XFS: sunit and swidth must be specified together"); | 413 | "XFS: sunit and swidth must be specified together"); |
| @@ -449,18 +421,6 @@ xfs_parseargs( | |||
| 449 | return EINVAL; | 421 | return EINVAL; |
| 450 | } | 422 | } |
| 451 | 423 | ||
| 452 | /* | ||
| 453 | * Applications using DMI filesystems often expect the | ||
| 454 | * inode generation number to be monotonically increasing. | ||
| 455 | * If we delete inode chunks we break this assumption, so | ||
| 456 | * keep unused inode chunks on disk for DMI filesystems | ||
| 457 | * until we come up with a better solution. | ||
| 458 | * Note that if "ikeep" or "noikeep" mount options are | ||
| 459 | * supplied, then they are honored. | ||
| 460 | */ | ||
| 461 | if ((mp->m_flags & XFS_MOUNT_DMAPI) && dmapi_implies_ikeep) | ||
| 462 | mp->m_flags |= XFS_MOUNT_IKEEP; | ||
| 463 | |||
| 464 | done: | 424 | done: |
| 465 | if (!(mp->m_flags & XFS_MOUNT_NOALIGN)) { | 425 | if (!(mp->m_flags & XFS_MOUNT_NOALIGN)) { |
| 466 | /* | 426 | /* |
| @@ -539,10 +499,8 @@ xfs_showargs( | |||
| 539 | { XFS_MOUNT_SWALLOC, "," MNTOPT_SWALLOC }, | 499 | { XFS_MOUNT_SWALLOC, "," MNTOPT_SWALLOC }, |
| 540 | { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID }, | 500 | { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID }, |
| 541 | { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY }, | 501 | { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY }, |
| 542 | { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC }, | ||
| 543 | { XFS_MOUNT_ATTR2, "," MNTOPT_ATTR2 }, | 502 | { XFS_MOUNT_ATTR2, "," MNTOPT_ATTR2 }, |
| 544 | { XFS_MOUNT_FILESTREAMS, "," MNTOPT_FILESTREAM }, | 503 | { XFS_MOUNT_FILESTREAMS, "," MNTOPT_FILESTREAM }, |
| 545 | { XFS_MOUNT_DMAPI, "," MNTOPT_DMAPI }, | ||
| 546 | { XFS_MOUNT_GRPID, "," MNTOPT_GRPID }, | 504 | { XFS_MOUNT_GRPID, "," MNTOPT_GRPID }, |
| 547 | { XFS_MOUNT_DELAYLOG, "," MNTOPT_DELAYLOG }, | 505 | { XFS_MOUNT_DELAYLOG, "," MNTOPT_DELAYLOG }, |
| 548 | { 0, NULL } | 506 | { 0, NULL } |
| @@ -947,7 +905,7 @@ xfs_fs_destroy_inode( | |||
| 947 | { | 905 | { |
| 948 | struct xfs_inode *ip = XFS_I(inode); | 906 | struct xfs_inode *ip = XFS_I(inode); |
| 949 | 907 | ||
| 950 | xfs_itrace_entry(ip); | 908 | trace_xfs_destroy_inode(ip); |
| 951 | 909 | ||
| 952 | XFS_STATS_INC(vn_reclaim); | 910 | XFS_STATS_INC(vn_reclaim); |
| 953 | 911 | ||
| @@ -1063,10 +1021,8 @@ xfs_log_inode( | |||
| 1063 | * an inode in another recent transaction. So we play it safe and | 1021 | * an inode in another recent transaction. So we play it safe and |
| 1064 | * fire off the transaction anyway. | 1022 | * fire off the transaction anyway. |
| 1065 | */ | 1023 | */ |
| 1066 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 1024 | xfs_trans_ijoin(tp, ip); |
| 1067 | xfs_trans_ihold(tp, ip); | ||
| 1068 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 1025 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
| 1069 | xfs_trans_set_sync(tp); | ||
| 1070 | error = xfs_trans_commit(tp, 0); | 1026 | error = xfs_trans_commit(tp, 0); |
| 1071 | xfs_ilock_demote(ip, XFS_ILOCK_EXCL); | 1027 | xfs_ilock_demote(ip, XFS_ILOCK_EXCL); |
| 1072 | 1028 | ||
| @@ -1082,27 +1038,18 @@ xfs_fs_write_inode( | |||
| 1082 | struct xfs_mount *mp = ip->i_mount; | 1038 | struct xfs_mount *mp = ip->i_mount; |
| 1083 | int error = EAGAIN; | 1039 | int error = EAGAIN; |
| 1084 | 1040 | ||
| 1085 | xfs_itrace_entry(ip); | 1041 | trace_xfs_write_inode(ip); |
| 1086 | 1042 | ||
| 1087 | if (XFS_FORCED_SHUTDOWN(mp)) | 1043 | if (XFS_FORCED_SHUTDOWN(mp)) |
| 1088 | return XFS_ERROR(EIO); | 1044 | return XFS_ERROR(EIO); |
| 1089 | 1045 | ||
| 1090 | if (wbc->sync_mode == WB_SYNC_ALL) { | 1046 | if (wbc->sync_mode == WB_SYNC_ALL) { |
| 1091 | /* | 1047 | /* |
| 1092 | * Make sure the inode has hit stable storage. By using the | 1048 | * Make sure the inode has made it it into the log. Instead |
| 1093 | * log and the fsync transactions we reduce the IOs we have | 1049 | * of forcing it all the way to stable storage using a |
| 1094 | * to do here from two (log and inode) to just the log. | 1050 | * synchronous transaction we let the log force inside the |
| 1095 | * | 1051 | * ->sync_fs call do that for thus, which reduces the number |
| 1096 | * Note: We still need to do a delwri write of the inode after | 1052 | * of synchronous log foces dramatically. |
| 1097 | * this to flush it to the backing buffer so that bulkstat | ||
| 1098 | * works properly if this is the first time the inode has been | ||
| 1099 | * written. Because we hold the ilock atomically over the | ||
| 1100 | * transaction commit and the inode flush we are guaranteed | ||
| 1101 | * that the inode is not pinned when it returns. If the flush | ||
| 1102 | * lock is already held, then the inode has already been | ||
| 1103 | * flushed once and we don't need to flush it again. Hence | ||
| 1104 | * the code will only flush the inode if it isn't already | ||
| 1105 | * being flushed. | ||
| 1106 | */ | 1053 | */ |
| 1107 | xfs_ioend_wait(ip); | 1054 | xfs_ioend_wait(ip); |
| 1108 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 1055 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
| @@ -1116,27 +1063,29 @@ xfs_fs_write_inode( | |||
| 1116 | * We make this non-blocking if the inode is contended, return | 1063 | * We make this non-blocking if the inode is contended, return |
| 1117 | * EAGAIN to indicate to the caller that they did not succeed. | 1064 | * EAGAIN to indicate to the caller that they did not succeed. |
| 1118 | * This prevents the flush path from blocking on inodes inside | 1065 | * This prevents the flush path from blocking on inodes inside |
| 1119 | * another operation right now, they get caught later by xfs_sync. | 1066 | * another operation right now, they get caught later by |
| 1067 | * xfs_sync. | ||
| 1120 | */ | 1068 | */ |
| 1121 | if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) | 1069 | if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) |
| 1122 | goto out; | 1070 | goto out; |
| 1123 | } | ||
| 1124 | 1071 | ||
| 1125 | if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip)) | 1072 | if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip)) |
| 1126 | goto out_unlock; | 1073 | goto out_unlock; |
| 1127 | 1074 | ||
| 1128 | /* | 1075 | /* |
| 1129 | * Now we have the flush lock and the inode is not pinned, we can check | 1076 | * Now we have the flush lock and the inode is not pinned, we |
| 1130 | * if the inode is really clean as we know that there are no pending | 1077 | * can check if the inode is really clean as we know that |
| 1131 | * transaction completions, it is not waiting on the delayed write | 1078 | * there are no pending transaction completions, it is not |
| 1132 | * queue and there is no IO in progress. | 1079 | * waiting on the delayed write queue and there is no IO in |
| 1133 | */ | 1080 | * progress. |
| 1134 | if (xfs_inode_clean(ip)) { | 1081 | */ |
| 1135 | xfs_ifunlock(ip); | 1082 | if (xfs_inode_clean(ip)) { |
| 1136 | error = 0; | 1083 | xfs_ifunlock(ip); |
| 1137 | goto out_unlock; | 1084 | error = 0; |
| 1085 | goto out_unlock; | ||
| 1086 | } | ||
| 1087 | error = xfs_iflush(ip, 0); | ||
| 1138 | } | 1088 | } |
| 1139 | error = xfs_iflush(ip, 0); | ||
| 1140 | 1089 | ||
| 1141 | out_unlock: | 1090 | out_unlock: |
| 1142 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | 1091 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
| @@ -1156,7 +1105,8 @@ xfs_fs_clear_inode( | |||
| 1156 | { | 1105 | { |
| 1157 | xfs_inode_t *ip = XFS_I(inode); | 1106 | xfs_inode_t *ip = XFS_I(inode); |
| 1158 | 1107 | ||
| 1159 | xfs_itrace_entry(ip); | 1108 | trace_xfs_clear_inode(ip); |
| 1109 | |||
| 1160 | XFS_STATS_INC(vn_rele); | 1110 | XFS_STATS_INC(vn_rele); |
| 1161 | XFS_STATS_INC(vn_remove); | 1111 | XFS_STATS_INC(vn_remove); |
| 1162 | XFS_STATS_DEC(vn_active); | 1112 | XFS_STATS_DEC(vn_active); |
| @@ -1193,22 +1143,13 @@ xfs_fs_put_super( | |||
| 1193 | { | 1143 | { |
| 1194 | struct xfs_mount *mp = XFS_M(sb); | 1144 | struct xfs_mount *mp = XFS_M(sb); |
| 1195 | 1145 | ||
| 1146 | /* | ||
| 1147 | * Unregister the memory shrinker before we tear down the mount | ||
| 1148 | * structure so we don't have memory reclaim racing with us here. | ||
| 1149 | */ | ||
| 1150 | xfs_inode_shrinker_unregister(mp); | ||
| 1196 | xfs_syncd_stop(mp); | 1151 | xfs_syncd_stop(mp); |
| 1197 | 1152 | ||
| 1198 | if (!(sb->s_flags & MS_RDONLY)) { | ||
| 1199 | /* | ||
| 1200 | * XXX(hch): this should be SYNC_WAIT. | ||
| 1201 | * | ||
| 1202 | * Or more likely not needed at all because the VFS is already | ||
| 1203 | * calling ->sync_fs after shutting down all filestem | ||
| 1204 | * operations and just before calling ->put_super. | ||
| 1205 | */ | ||
| 1206 | xfs_sync_data(mp, 0); | ||
| 1207 | xfs_sync_attr(mp, 0); | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | XFS_SEND_PREUNMOUNT(mp); | ||
| 1211 | |||
| 1212 | /* | 1153 | /* |
| 1213 | * Blow away any referenced inode in the filestreams cache. | 1154 | * Blow away any referenced inode in the filestreams cache. |
| 1214 | * This can and will cause log traffic as inodes go inactive | 1155 | * This can and will cause log traffic as inodes go inactive |
| @@ -1218,14 +1159,10 @@ xfs_fs_put_super( | |||
| 1218 | 1159 | ||
| 1219 | XFS_bflush(mp->m_ddev_targp); | 1160 | XFS_bflush(mp->m_ddev_targp); |
| 1220 | 1161 | ||
| 1221 | XFS_SEND_UNMOUNT(mp); | ||
| 1222 | |||
| 1223 | xfs_unmountfs(mp); | 1162 | xfs_unmountfs(mp); |
| 1224 | xfs_freesb(mp); | 1163 | xfs_freesb(mp); |
| 1225 | xfs_inode_shrinker_unregister(mp); | ||
| 1226 | xfs_icsb_destroy_counters(mp); | 1164 | xfs_icsb_destroy_counters(mp); |
| 1227 | xfs_close_devices(mp); | 1165 | xfs_close_devices(mp); |
| 1228 | xfs_dmops_put(mp); | ||
| 1229 | xfs_free_fsname(mp); | 1166 | xfs_free_fsname(mp); |
| 1230 | kfree(mp); | 1167 | kfree(mp); |
| 1231 | } | 1168 | } |
| @@ -1543,7 +1480,6 @@ xfs_fs_fill_super( | |||
| 1543 | struct inode *root; | 1480 | struct inode *root; |
| 1544 | struct xfs_mount *mp = NULL; | 1481 | struct xfs_mount *mp = NULL; |
| 1545 | int flags = 0, error = ENOMEM; | 1482 | int flags = 0, error = ENOMEM; |
| 1546 | char *mtpt = NULL; | ||
| 1547 | 1483 | ||
| 1548 | mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL); | 1484 | mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL); |
| 1549 | if (!mp) | 1485 | if (!mp) |
| @@ -1559,7 +1495,7 @@ xfs_fs_fill_super( | |||
| 1559 | mp->m_super = sb; | 1495 | mp->m_super = sb; |
| 1560 | sb->s_fs_info = mp; | 1496 | sb->s_fs_info = mp; |
| 1561 | 1497 | ||
| 1562 | error = xfs_parseargs(mp, (char *)data, &mtpt); | 1498 | error = xfs_parseargs(mp, (char *)data); |
| 1563 | if (error) | 1499 | if (error) |
| 1564 | goto out_free_fsname; | 1500 | goto out_free_fsname; |
| 1565 | 1501 | ||
| @@ -1571,16 +1507,12 @@ xfs_fs_fill_super( | |||
| 1571 | #endif | 1507 | #endif |
| 1572 | sb->s_op = &xfs_super_operations; | 1508 | sb->s_op = &xfs_super_operations; |
| 1573 | 1509 | ||
| 1574 | error = xfs_dmops_get(mp); | ||
| 1575 | if (error) | ||
| 1576 | goto out_free_fsname; | ||
| 1577 | |||
| 1578 | if (silent) | 1510 | if (silent) |
| 1579 | flags |= XFS_MFSI_QUIET; | 1511 | flags |= XFS_MFSI_QUIET; |
| 1580 | 1512 | ||
| 1581 | error = xfs_open_devices(mp); | 1513 | error = xfs_open_devices(mp); |
| 1582 | if (error) | 1514 | if (error) |
| 1583 | goto out_put_dmops; | 1515 | goto out_free_fsname; |
| 1584 | 1516 | ||
| 1585 | if (xfs_icsb_init_counters(mp)) | 1517 | if (xfs_icsb_init_counters(mp)) |
| 1586 | mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB; | 1518 | mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB; |
| @@ -1608,8 +1540,6 @@ xfs_fs_fill_super( | |||
| 1608 | if (error) | 1540 | if (error) |
| 1609 | goto out_filestream_unmount; | 1541 | goto out_filestream_unmount; |
| 1610 | 1542 | ||
| 1611 | XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, mtpt, mp->m_fsname); | ||
| 1612 | |||
| 1613 | sb->s_magic = XFS_SB_MAGIC; | 1543 | sb->s_magic = XFS_SB_MAGIC; |
| 1614 | sb->s_blocksize = mp->m_sb.sb_blocksize; | 1544 | sb->s_blocksize = mp->m_sb.sb_blocksize; |
| 1615 | sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; | 1545 | sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; |
| @@ -1638,7 +1568,6 @@ xfs_fs_fill_super( | |||
| 1638 | 1568 | ||
| 1639 | xfs_inode_shrinker_register(mp); | 1569 | xfs_inode_shrinker_register(mp); |
| 1640 | 1570 | ||
| 1641 | kfree(mtpt); | ||
| 1642 | return 0; | 1571 | return 0; |
| 1643 | 1572 | ||
| 1644 | out_filestream_unmount: | 1573 | out_filestream_unmount: |
| @@ -1648,11 +1577,8 @@ xfs_fs_fill_super( | |||
| 1648 | out_destroy_counters: | 1577 | out_destroy_counters: |
| 1649 | xfs_icsb_destroy_counters(mp); | 1578 | xfs_icsb_destroy_counters(mp); |
| 1650 | xfs_close_devices(mp); | 1579 | xfs_close_devices(mp); |
| 1651 | out_put_dmops: | ||
| 1652 | xfs_dmops_put(mp); | ||
| 1653 | out_free_fsname: | 1580 | out_free_fsname: |
| 1654 | xfs_free_fsname(mp); | 1581 | xfs_free_fsname(mp); |
| 1655 | kfree(mtpt); | ||
| 1656 | kfree(mp); | 1582 | kfree(mp); |
| 1657 | out: | 1583 | out: |
| 1658 | return -error; | 1584 | return -error; |
| @@ -1759,6 +1685,12 @@ xfs_init_zones(void) | |||
| 1759 | if (!xfs_trans_zone) | 1685 | if (!xfs_trans_zone) |
| 1760 | goto out_destroy_ifork_zone; | 1686 | goto out_destroy_ifork_zone; |
| 1761 | 1687 | ||
| 1688 | xfs_log_item_desc_zone = | ||
| 1689 | kmem_zone_init(sizeof(struct xfs_log_item_desc), | ||
| 1690 | "xfs_log_item_desc"); | ||
| 1691 | if (!xfs_log_item_desc_zone) | ||
| 1692 | goto out_destroy_trans_zone; | ||
| 1693 | |||
| 1762 | /* | 1694 | /* |
| 1763 | * The size of the zone allocated buf log item is the maximum | 1695 | * The size of the zone allocated buf log item is the maximum |
| 1764 | * size possible under XFS. This wastes a little bit of memory, | 1696 | * size possible under XFS. This wastes a little bit of memory, |
| @@ -1768,7 +1700,7 @@ xfs_init_zones(void) | |||
| 1768 | (((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / | 1700 | (((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / |
| 1769 | NBWORD) * sizeof(int))), "xfs_buf_item"); | 1701 | NBWORD) * sizeof(int))), "xfs_buf_item"); |
| 1770 | if (!xfs_buf_item_zone) | 1702 | if (!xfs_buf_item_zone) |
| 1771 | goto out_destroy_trans_zone; | 1703 | goto out_destroy_log_item_desc_zone; |
| 1772 | 1704 | ||
| 1773 | xfs_efd_zone = kmem_zone_init((sizeof(xfs_efd_log_item_t) + | 1705 | xfs_efd_zone = kmem_zone_init((sizeof(xfs_efd_log_item_t) + |
| 1774 | ((XFS_EFD_MAX_FAST_EXTENTS - 1) * | 1706 | ((XFS_EFD_MAX_FAST_EXTENTS - 1) * |
| @@ -1805,6 +1737,8 @@ xfs_init_zones(void) | |||
| 1805 | kmem_zone_destroy(xfs_efd_zone); | 1737 | kmem_zone_destroy(xfs_efd_zone); |
| 1806 | out_destroy_buf_item_zone: | 1738 | out_destroy_buf_item_zone: |
| 1807 | kmem_zone_destroy(xfs_buf_item_zone); | 1739 | kmem_zone_destroy(xfs_buf_item_zone); |
| 1740 | out_destroy_log_item_desc_zone: | ||
| 1741 | kmem_zone_destroy(xfs_log_item_desc_zone); | ||
| 1808 | out_destroy_trans_zone: | 1742 | out_destroy_trans_zone: |
| 1809 | kmem_zone_destroy(xfs_trans_zone); | 1743 | kmem_zone_destroy(xfs_trans_zone); |
| 1810 | out_destroy_ifork_zone: | 1744 | out_destroy_ifork_zone: |
| @@ -1835,6 +1769,7 @@ xfs_destroy_zones(void) | |||
| 1835 | kmem_zone_destroy(xfs_efi_zone); | 1769 | kmem_zone_destroy(xfs_efi_zone); |
| 1836 | kmem_zone_destroy(xfs_efd_zone); | 1770 | kmem_zone_destroy(xfs_efd_zone); |
| 1837 | kmem_zone_destroy(xfs_buf_item_zone); | 1771 | kmem_zone_destroy(xfs_buf_item_zone); |
| 1772 | kmem_zone_destroy(xfs_log_item_desc_zone); | ||
| 1838 | kmem_zone_destroy(xfs_trans_zone); | 1773 | kmem_zone_destroy(xfs_trans_zone); |
| 1839 | kmem_zone_destroy(xfs_ifork_zone); | 1774 | kmem_zone_destroy(xfs_ifork_zone); |
| 1840 | kmem_zone_destroy(xfs_dabuf_zone); | 1775 | kmem_zone_destroy(xfs_dabuf_zone); |
