aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
authorAlex Elder <aelder@sgi.com>2010-04-20 03:09:59 -0400
committerAlex Elder <aelder@sgi.com>2010-05-19 10:58:15 -0400
commit69ce58f08a3c455ff74cfcde90e9ab267d67f636 (patch)
tree0a5a8be3222d8138f382b492b96888c61041dd76 /fs/xfs/xfs_log.c
parent1414a6046ab402ac21545522270c32c576327eb9 (diff)
xfs: record log sector size rather than log2(that)
Change struct log so it keeps track of the size (in basic blocks) of a log sector in l_sectBBsize rather than the log-base-2 of that value (previously, l_sectbb_log). The name was chosen for consistency with the other fields in the structure that represent a number of basic blocks. (Updated so that a variable used in computing and verifying a log's sector size is named "log2_size". Also added the "BB" to the structure field name, based on feedback from Eric Sandeen. Also dropped some superfluous parentheses.) Signed-off-by: Alex Elder <aelder@sgi.com> Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c33
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