aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/ialloc.c
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 08:47:22 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:01:02 -0400
commit9695ef16ed4e00b59303f39f9a4a422a2c6a3b89 (patch)
treefba8946e86a523a5d53936cf5ec9e0a150037f73 /fs/ufs/ialloc.c
parentb71034e5e67d1577424cebe7bbb7d0ce134a4cd8 (diff)
[PATCH] ufs: wrong type cast
There are two ugly macros in ufs code: #define UCPI_UBH ((struct ufs_buffer_head *)ucpi) #define USPI_UBH ((struct ufs_buffer_head *)uspi) when uspi looks like struct { struct ufs_buffer_head ; } and USPI_UBH has some sence, ucpi looks like struct { struct not_ufs_buffer_head; } To prevent bugs in future, this patch convert macros to inline function and fix "ucpi" structure. Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ufs/ialloc.c')
-rw-r--r--fs/ufs/ialloc.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index c7a47ed4f430..2da0ffda82cc 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -91,7 +91,7 @@ void ufs_free_inode (struct inode * inode)
91 unlock_super (sb); 91 unlock_super (sb);
92 return; 92 return;
93 } 93 }
94 ucg = ubh_get_ucg(UCPI_UBH); 94 ucg = ubh_get_ucg(UCPI_UBH(ucpi));
95 if (!ufs_cg_chkmagic(sb, ucg)) 95 if (!ufs_cg_chkmagic(sb, ucg))
96 ufs_panic (sb, "ufs_free_fragments", "internal error, bad cg magic number"); 96 ufs_panic (sb, "ufs_free_fragments", "internal error, bad cg magic number");
97 97
@@ -104,10 +104,10 @@ void ufs_free_inode (struct inode * inode)
104 104
105 clear_inode (inode); 105 clear_inode (inode);
106 106
107 if (ubh_isclr (UCPI_UBH, ucpi->c_iusedoff, bit)) 107 if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit))
108 ufs_error(sb, "ufs_free_inode", "bit already cleared for inode %u", ino); 108 ufs_error(sb, "ufs_free_inode", "bit already cleared for inode %u", ino);
109 else { 109 else {
110 ubh_clrbit (UCPI_UBH, ucpi->c_iusedoff, bit); 110 ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit);
111 if (ino < ucpi->c_irotor) 111 if (ino < ucpi->c_irotor)
112 ucpi->c_irotor = ino; 112 ucpi->c_irotor = ino;
113 fs32_add(sb, &ucg->cg_cs.cs_nifree, 1); 113 fs32_add(sb, &ucg->cg_cs.cs_nifree, 1);
@@ -121,11 +121,11 @@ void ufs_free_inode (struct inode * inode)
121 } 121 }
122 } 122 }
123 123
124 ubh_mark_buffer_dirty (USPI_UBH); 124 ubh_mark_buffer_dirty (USPI_UBH(uspi));
125 ubh_mark_buffer_dirty (UCPI_UBH); 125 ubh_mark_buffer_dirty (UCPI_UBH(ucpi));
126 if (sb->s_flags & MS_SYNCHRONOUS) { 126 if (sb->s_flags & MS_SYNCHRONOUS) {
127 ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **) &ucpi); 127 ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **) &ucpi);
128 ubh_wait_on_buffer (UCPI_UBH); 128 ubh_wait_on_buffer (UCPI_UBH(ucpi));
129 } 129 }
130 130
131 sb->s_dirt = 1; 131 sb->s_dirt = 1;
@@ -213,14 +213,14 @@ cg_found:
213 ucpi = ufs_load_cylinder (sb, cg); 213 ucpi = ufs_load_cylinder (sb, cg);
214 if (!ucpi) 214 if (!ucpi)
215 goto failed; 215 goto failed;
216 ucg = ubh_get_ucg(UCPI_UBH); 216 ucg = ubh_get_ucg(UCPI_UBH(ucpi));
217 if (!ufs_cg_chkmagic(sb, ucg)) 217 if (!ufs_cg_chkmagic(sb, ucg))
218 ufs_panic (sb, "ufs_new_inode", "internal error, bad cg magic number"); 218 ufs_panic (sb, "ufs_new_inode", "internal error, bad cg magic number");
219 219
220 start = ucpi->c_irotor; 220 start = ucpi->c_irotor;
221 bit = ubh_find_next_zero_bit (UCPI_UBH, ucpi->c_iusedoff, uspi->s_ipg, start); 221 bit = ubh_find_next_zero_bit (UCPI_UBH(ucpi), ucpi->c_iusedoff, uspi->s_ipg, start);
222 if (!(bit < uspi->s_ipg)) { 222 if (!(bit < uspi->s_ipg)) {
223 bit = ubh_find_first_zero_bit (UCPI_UBH, ucpi->c_iusedoff, start); 223 bit = ubh_find_first_zero_bit (UCPI_UBH(ucpi), ucpi->c_iusedoff, start);
224 if (!(bit < start)) { 224 if (!(bit < start)) {
225 ufs_error (sb, "ufs_new_inode", 225 ufs_error (sb, "ufs_new_inode",
226 "cylinder group %u corrupted - error in inode bitmap\n", cg); 226 "cylinder group %u corrupted - error in inode bitmap\n", cg);
@@ -228,8 +228,8 @@ cg_found:
228 } 228 }
229 } 229 }
230 UFSD(("start = %u, bit = %u, ipg = %u\n", start, bit, uspi->s_ipg)) 230 UFSD(("start = %u, bit = %u, ipg = %u\n", start, bit, uspi->s_ipg))
231 if (ubh_isclr (UCPI_UBH, ucpi->c_iusedoff, bit)) 231 if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit))
232 ubh_setbit (UCPI_UBH, ucpi->c_iusedoff, bit); 232 ubh_setbit (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit);
233 else { 233 else {
234 ufs_panic (sb, "ufs_new_inode", "internal error"); 234 ufs_panic (sb, "ufs_new_inode", "internal error");
235 goto failed; 235 goto failed;
@@ -245,11 +245,11 @@ cg_found:
245 fs32_add(sb, &sbi->fs_cs(cg).cs_ndir, 1); 245 fs32_add(sb, &sbi->fs_cs(cg).cs_ndir, 1);
246 } 246 }
247 247
248 ubh_mark_buffer_dirty (USPI_UBH); 248 ubh_mark_buffer_dirty (USPI_UBH(uspi));
249 ubh_mark_buffer_dirty (UCPI_UBH); 249 ubh_mark_buffer_dirty (UCPI_UBH(ucpi));
250 if (sb->s_flags & MS_SYNCHRONOUS) { 250 if (sb->s_flags & MS_SYNCHRONOUS) {
251 ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **) &ucpi); 251 ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **) &ucpi);
252 ubh_wait_on_buffer (UCPI_UBH); 252 ubh_wait_on_buffer (UCPI_UBH(ucpi));
253 } 253 }
254 sb->s_dirt = 1; 254 sb->s_dirt = 1;
255 255