diff options
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r-- | fs/xfs/xfs_log.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 77593c2ead4d..36e09e362f7f 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -1039,6 +1039,7 @@ xlog_alloc_log(xfs_mount_t *mp, | |||
1039 | int i; | 1039 | int i; |
1040 | int iclogsize; | 1040 | int iclogsize; |
1041 | int error = ENOMEM; | 1041 | int error = ENOMEM; |
1042 | uint log2_size = 0; | ||
1042 | 1043 | ||
1043 | log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL); | 1044 | log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL); |
1044 | if (!log) { | 1045 | if (!log) { |
@@ -1064,29 +1065,31 @@ xlog_alloc_log(xfs_mount_t *mp, | |||
1064 | 1065 | ||
1065 | error = EFSCORRUPTED; | 1066 | error = EFSCORRUPTED; |
1066 | if (xfs_sb_version_hassector(&mp->m_sb)) { | 1067 | if (xfs_sb_version_hassector(&mp->m_sb)) { |
1067 | log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT; | 1068 | log2_size = mp->m_sb.sb_logsectlog; |
1068 | if (log->l_sectbb_log < 0 || | 1069 | if (log2_size < BBSHIFT) { |
1069 | log->l_sectbb_log > mp->m_sectbb_log) { | 1070 | xlog_warn("XFS: Log sector size too small " |
1070 | xlog_warn("XFS: Log sector size (0x%x) out of range.", | 1071 | "(0x%x < 0x%x)", log2_size, BBSHIFT); |
1071 | log->l_sectbb_log); | ||
1072 | goto out_free_log; | 1072 | goto out_free_log; |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | /* for larger sector sizes, must have v2 or external log */ | 1075 | log2_size -= BBSHIFT; |
1076 | if (log->l_sectbb_log != 0 && | 1076 | if (log2_size > mp->m_sectbb_log) { |
1077 | (log->l_logBBstart != 0 && | 1077 | xlog_warn("XFS: Log sector size too large " |
1078 | !xfs_sb_version_haslogv2(&mp->m_sb))) { | 1078 | "(0x%x > 0x%x)", log2_size, mp->m_sectbb_log); |
1079 | xlog_warn("XFS: log sector size (0x%x) invalid " | ||
1080 | "for configuration.", log->l_sectbb_log); | ||
1081 | goto out_free_log; | 1079 | goto out_free_log; |
1082 | } | 1080 | } |
1083 | if (mp->m_sb.sb_logsectlog < BBSHIFT) { | 1081 | |
1084 | xlog_warn("XFS: Log sector log (0x%x) too small.", | 1082 | /* for larger sector sizes, must have v2 or external log */ |
1085 | mp->m_sb.sb_logsectlog); | 1083 | if (log2_size && log->l_logBBstart > 0 && |
1084 | !xfs_sb_version_haslogv2(&mp->m_sb)) { | ||
1085 | |||
1086 | xlog_warn("XFS: log sector size (0x%x) invalid " | ||
1087 | "for configuration.", log2_size); | ||
1086 | goto out_free_log; | 1088 | goto out_free_log; |
1087 | } | 1089 | } |
1088 | } | 1090 | } |
1089 | log->l_sectbb_mask = (1 << log->l_sectbb_log) - 1; | 1091 | log->l_sectBBsize = 1 << log2_size; |
1092 | log->l_sectbb_mask = log->l_sectBBsize - 1; | ||
1090 | 1093 | ||
1091 | xlog_get_iclog_buffer_size(mp, log); | 1094 | xlog_get_iclog_buffer_size(mp, log); |
1092 | 1095 | ||