diff options
Diffstat (limited to 'fs/ufs/cylinder.c')
-rw-r--r-- | fs/ufs/cylinder.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/fs/ufs/cylinder.c b/fs/ufs/cylinder.c index 14abb8b835f7..09c39e5e6386 100644 --- a/fs/ufs/cylinder.c +++ b/fs/ufs/cylinder.c | |||
@@ -20,15 +20,6 @@ | |||
20 | #include "swab.h" | 20 | #include "swab.h" |
21 | #include "util.h" | 21 | #include "util.h" |
22 | 22 | ||
23 | #undef UFS_CYLINDER_DEBUG | ||
24 | |||
25 | #ifdef UFS_CYLINDER_DEBUG | ||
26 | #define UFSD(x) printk("(%s, %d), %s:", __FILE__, __LINE__, __FUNCTION__); printk x; | ||
27 | #else | ||
28 | #define UFSD(x) | ||
29 | #endif | ||
30 | |||
31 | |||
32 | /* | 23 | /* |
33 | * Read cylinder group into cache. The memory space for ufs_cg_private_info | 24 | * Read cylinder group into cache. The memory space for ufs_cg_private_info |
34 | * structure is already allocated during ufs_read_super. | 25 | * structure is already allocated during ufs_read_super. |
@@ -42,19 +33,19 @@ static void ufs_read_cylinder (struct super_block * sb, | |||
42 | struct ufs_cylinder_group * ucg; | 33 | struct ufs_cylinder_group * ucg; |
43 | unsigned i, j; | 34 | unsigned i, j; |
44 | 35 | ||
45 | UFSD(("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr)) | 36 | UFSD("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr); |
46 | uspi = sbi->s_uspi; | 37 | uspi = sbi->s_uspi; |
47 | ucpi = sbi->s_ucpi[bitmap_nr]; | 38 | ucpi = sbi->s_ucpi[bitmap_nr]; |
48 | ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data; | 39 | ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data; |
49 | 40 | ||
50 | UCPI_UBH->fragment = ufs_cgcmin(cgno); | 41 | UCPI_UBH(ucpi)->fragment = ufs_cgcmin(cgno); |
51 | UCPI_UBH->count = uspi->s_cgsize >> sb->s_blocksize_bits; | 42 | UCPI_UBH(ucpi)->count = uspi->s_cgsize >> sb->s_blocksize_bits; |
52 | /* | 43 | /* |
53 | * We have already the first fragment of cylinder group block in buffer | 44 | * We have already the first fragment of cylinder group block in buffer |
54 | */ | 45 | */ |
55 | UCPI_UBH->bh[0] = sbi->s_ucg[cgno]; | 46 | UCPI_UBH(ucpi)->bh[0] = sbi->s_ucg[cgno]; |
56 | for (i = 1; i < UCPI_UBH->count; i++) | 47 | for (i = 1; i < UCPI_UBH(ucpi)->count; i++) |
57 | if (!(UCPI_UBH->bh[i] = sb_bread(sb, UCPI_UBH->fragment + i))) | 48 | if (!(UCPI_UBH(ucpi)->bh[i] = sb_bread(sb, UCPI_UBH(ucpi)->fragment + i))) |
58 | goto failed; | 49 | goto failed; |
59 | sbi->s_cgno[bitmap_nr] = cgno; | 50 | sbi->s_cgno[bitmap_nr] = cgno; |
60 | 51 | ||
@@ -73,7 +64,7 @@ static void ufs_read_cylinder (struct super_block * sb, | |||
73 | ucpi->c_clustersumoff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clustersumoff); | 64 | ucpi->c_clustersumoff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clustersumoff); |
74 | ucpi->c_clusteroff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clusteroff); | 65 | ucpi->c_clusteroff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clusteroff); |
75 | ucpi->c_nclusterblks = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_nclusterblks); | 66 | ucpi->c_nclusterblks = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_nclusterblks); |
76 | UFSD(("EXIT\n")) | 67 | UFSD("EXIT\n"); |
77 | return; | 68 | return; |
78 | 69 | ||
79 | failed: | 70 | failed: |
@@ -95,15 +86,15 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr) | |||
95 | struct ufs_cylinder_group * ucg; | 86 | struct ufs_cylinder_group * ucg; |
96 | unsigned i; | 87 | unsigned i; |
97 | 88 | ||
98 | UFSD(("ENTER, bitmap_nr %u\n", bitmap_nr)) | 89 | UFSD("ENTER, bitmap_nr %u\n", bitmap_nr); |
99 | 90 | ||
100 | uspi = sbi->s_uspi; | 91 | uspi = sbi->s_uspi; |
101 | if (sbi->s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) { | 92 | if (sbi->s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) { |
102 | UFSD(("EXIT\n")) | 93 | UFSD("EXIT\n"); |
103 | return; | 94 | return; |
104 | } | 95 | } |
105 | ucpi = sbi->s_ucpi[bitmap_nr]; | 96 | ucpi = sbi->s_ucpi[bitmap_nr]; |
106 | ucg = ubh_get_ucg(UCPI_UBH); | 97 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); |
107 | 98 | ||
108 | if (uspi->s_ncg > UFS_MAX_GROUP_LOADED && bitmap_nr >= sbi->s_cg_loaded) { | 99 | if (uspi->s_ncg > UFS_MAX_GROUP_LOADED && bitmap_nr >= sbi->s_cg_loaded) { |
109 | ufs_panic (sb, "ufs_put_cylinder", "internal error"); | 100 | ufs_panic (sb, "ufs_put_cylinder", "internal error"); |
@@ -116,13 +107,13 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr) | |||
116 | ucg->cg_rotor = cpu_to_fs32(sb, ucpi->c_rotor); | 107 | ucg->cg_rotor = cpu_to_fs32(sb, ucpi->c_rotor); |
117 | ucg->cg_frotor = cpu_to_fs32(sb, ucpi->c_frotor); | 108 | ucg->cg_frotor = cpu_to_fs32(sb, ucpi->c_frotor); |
118 | ucg->cg_irotor = cpu_to_fs32(sb, ucpi->c_irotor); | 109 | ucg->cg_irotor = cpu_to_fs32(sb, ucpi->c_irotor); |
119 | ubh_mark_buffer_dirty (UCPI_UBH); | 110 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); |
120 | for (i = 1; i < UCPI_UBH->count; i++) { | 111 | for (i = 1; i < UCPI_UBH(ucpi)->count; i++) { |
121 | brelse (UCPI_UBH->bh[i]); | 112 | brelse (UCPI_UBH(ucpi)->bh[i]); |
122 | } | 113 | } |
123 | 114 | ||
124 | sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY; | 115 | sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY; |
125 | UFSD(("EXIT\n")) | 116 | UFSD("EXIT\n"); |
126 | } | 117 | } |
127 | 118 | ||
128 | /* | 119 | /* |
@@ -139,7 +130,7 @@ struct ufs_cg_private_info * ufs_load_cylinder ( | |||
139 | struct ufs_cg_private_info * ucpi; | 130 | struct ufs_cg_private_info * ucpi; |
140 | unsigned cg, i, j; | 131 | unsigned cg, i, j; |
141 | 132 | ||
142 | UFSD(("ENTER, cgno %u\n", cgno)) | 133 | UFSD("ENTER, cgno %u\n", cgno); |
143 | 134 | ||
144 | uspi = sbi->s_uspi; | 135 | uspi = sbi->s_uspi; |
145 | if (cgno >= uspi->s_ncg) { | 136 | if (cgno >= uspi->s_ncg) { |
@@ -150,7 +141,7 @@ struct ufs_cg_private_info * ufs_load_cylinder ( | |||
150 | * Cylinder group number cg it in cache and it was last used | 141 | * Cylinder group number cg it in cache and it was last used |
151 | */ | 142 | */ |
152 | if (sbi->s_cgno[0] == cgno) { | 143 | if (sbi->s_cgno[0] == cgno) { |
153 | UFSD(("EXIT\n")) | 144 | UFSD("EXIT\n"); |
154 | return sbi->s_ucpi[0]; | 145 | return sbi->s_ucpi[0]; |
155 | } | 146 | } |
156 | /* | 147 | /* |
@@ -160,16 +151,16 @@ struct ufs_cg_private_info * ufs_load_cylinder ( | |||
160 | if (sbi->s_cgno[cgno] != UFS_CGNO_EMPTY) { | 151 | if (sbi->s_cgno[cgno] != UFS_CGNO_EMPTY) { |
161 | if (sbi->s_cgno[cgno] != cgno) { | 152 | if (sbi->s_cgno[cgno] != cgno) { |
162 | ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache"); | 153 | ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache"); |
163 | UFSD(("EXIT (FAILED)\n")) | 154 | UFSD("EXIT (FAILED)\n"); |
164 | return NULL; | 155 | return NULL; |
165 | } | 156 | } |
166 | else { | 157 | else { |
167 | UFSD(("EXIT\n")) | 158 | UFSD("EXIT\n"); |
168 | return sbi->s_ucpi[cgno]; | 159 | return sbi->s_ucpi[cgno]; |
169 | } | 160 | } |
170 | } else { | 161 | } else { |
171 | ufs_read_cylinder (sb, cgno, cgno); | 162 | ufs_read_cylinder (sb, cgno, cgno); |
172 | UFSD(("EXIT\n")) | 163 | UFSD("EXIT\n"); |
173 | return sbi->s_ucpi[cgno]; | 164 | return sbi->s_ucpi[cgno]; |
174 | } | 165 | } |
175 | } | 166 | } |
@@ -204,6 +195,6 @@ struct ufs_cg_private_info * ufs_load_cylinder ( | |||
204 | sbi->s_ucpi[0] = ucpi; | 195 | sbi->s_ucpi[0] = ucpi; |
205 | ufs_read_cylinder (sb, cgno, 0); | 196 | ufs_read_cylinder (sb, cgno, 0); |
206 | } | 197 | } |
207 | UFSD(("EXIT\n")) | 198 | UFSD("EXIT\n"); |
208 | return sbi->s_ucpi[0]; | 199 | return sbi->s_ucpi[0]; |
209 | } | 200 | } |