diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:04 -0400 |
commit | ee3ffd6c126323693b3b32a71a1f1acfce30bd66 (patch) | |
tree | 942b653ebc46c5c4f246ddee8a89b154122f1493 /fs/ufs/balloc.c | |
parent | 577a82752f95a5680d7c14569ffd3fd630d9fb22 (diff) |
[PATCH] ufs: make fsck -f happy
ufs super block contains some statistic about file systems, like amount of
directories, free blocks, inodes and so on.
UFS1 hold this information in one location and uses 32bit integers for such
information, UFS2 hold statistic in another location and uses 64bit integers.
There is transition variant, if UFS1 has type 44BSD and flags field in super
block has some special value this mean that we work with statistic like UFS2
does. and this also means that nobody care about old(UFS1) statistic.
So if start fsck against such file system, after usage linux ufs driver, it
found error: at now only UFS1 like statistic is updated.
This patch should fix this. Also it contains some minor cleanup: CodingSytle
and remove unused variables.
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/balloc.c')
-rw-r--r-- | fs/ufs/balloc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 99d881812ad8..cb36d2dadef5 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -83,7 +83,7 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count) | |||
83 | 83 | ||
84 | 84 | ||
85 | fs32_add(sb, &ucg->cg_cs.cs_nffree, count); | 85 | fs32_add(sb, &ucg->cg_cs.cs_nffree, count); |
86 | fs32_add(sb, &usb1->fs_cstotal.cs_nffree, count); | 86 | uspi->cs_total.cs_nffree += count; |
87 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); | 87 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); |
88 | blkmap = ubh_blkmap (UCPI_UBH(ucpi), ucpi->c_freeoff, bbase); | 88 | blkmap = ubh_blkmap (UCPI_UBH(ucpi), ucpi->c_freeoff, bbase); |
89 | ufs_fragacct(sb, blkmap, ucg->cg_frsum, 1); | 89 | ufs_fragacct(sb, blkmap, ucg->cg_frsum, 1); |
@@ -94,12 +94,12 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count) | |||
94 | blkno = ufs_fragstoblks (bbase); | 94 | blkno = ufs_fragstoblks (bbase); |
95 | if (ubh_isblockset(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno)) { | 95 | if (ubh_isblockset(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno)) { |
96 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, uspi->s_fpb); | 96 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, uspi->s_fpb); |
97 | fs32_sub(sb, &usb1->fs_cstotal.cs_nffree, uspi->s_fpb); | 97 | uspi->cs_total.cs_nffree -= uspi->s_fpb; |
98 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, uspi->s_fpb); | 98 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, uspi->s_fpb); |
99 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) | 99 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) |
100 | ufs_clusteracct (sb, ucpi, blkno, 1); | 100 | ufs_clusteracct (sb, ucpi, blkno, 1); |
101 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); | 101 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); |
102 | fs32_add(sb, &usb1->fs_cstotal.cs_nbfree, 1); | 102 | uspi->cs_total.cs_nbfree++; |
103 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nbfree, 1); | 103 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nbfree, 1); |
104 | cylno = ufs_cbtocylno (bbase); | 104 | cylno = ufs_cbtocylno (bbase); |
105 | fs16_add(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(bbase)), 1); | 105 | fs16_add(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(bbase)), 1); |
@@ -185,7 +185,7 @@ do_more: | |||
185 | DQUOT_FREE_BLOCK(inode, uspi->s_fpb); | 185 | DQUOT_FREE_BLOCK(inode, uspi->s_fpb); |
186 | 186 | ||
187 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); | 187 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); |
188 | fs32_add(sb, &usb1->fs_cstotal.cs_nbfree, 1); | 188 | uspi->cs_total.cs_nbfree++; |
189 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nbfree, 1); | 189 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nbfree, 1); |
190 | cylno = ufs_cbtocylno(i); | 190 | cylno = ufs_cbtocylno(i); |
191 | fs16_add(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(i)), 1); | 191 | fs16_add(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(i)), 1); |
@@ -372,7 +372,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment, | |||
372 | /* | 372 | /* |
373 | * There is not enough space for user on the device | 373 | * There is not enough space for user on the device |
374 | */ | 374 | */ |
375 | if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(usb1, UFS_MINFREE) <= 0) { | 375 | if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { |
376 | unlock_super (sb); | 376 | unlock_super (sb); |
377 | UFSD("EXIT (FAILED)\n"); | 377 | UFSD("EXIT (FAILED)\n"); |
378 | return 0; | 378 | return 0; |
@@ -418,8 +418,8 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment, | |||
418 | switch (fs32_to_cpu(sb, usb1->fs_optim)) { | 418 | switch (fs32_to_cpu(sb, usb1->fs_optim)) { |
419 | case UFS_OPTSPACE: | 419 | case UFS_OPTSPACE: |
420 | request = newcount; | 420 | request = newcount; |
421 | if (uspi->s_minfree < 5 || fs32_to_cpu(sb, usb1->fs_cstotal.cs_nffree) | 421 | if (uspi->s_minfree < 5 || uspi->cs_total.cs_nffree |
422 | > uspi->s_dsize * uspi->s_minfree / (2 * 100) ) | 422 | > uspi->s_dsize * uspi->s_minfree / (2 * 100)) |
423 | break; | 423 | break; |
424 | usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); | 424 | usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); |
425 | break; | 425 | break; |
@@ -428,7 +428,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment, | |||
428 | 428 | ||
429 | case UFS_OPTTIME: | 429 | case UFS_OPTTIME: |
430 | request = uspi->s_fpb; | 430 | request = uspi->s_fpb; |
431 | if (fs32_to_cpu(sb, usb1->fs_cstotal.cs_nffree) < uspi->s_dsize * | 431 | if (uspi->cs_total.cs_nffree < uspi->s_dsize * |
432 | (uspi->s_minfree - 2) / 100) | 432 | (uspi->s_minfree - 2) / 100) |
433 | break; | 433 | break; |
434 | usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); | 434 | usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); |
@@ -516,7 +516,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment, | |||
516 | 516 | ||
517 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); | 517 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); |
518 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); | 518 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); |
519 | fs32_sub(sb, &usb1->fs_cstotal.cs_nffree, count); | 519 | uspi->cs_total.cs_nffree -= count; |
520 | 520 | ||
521 | ubh_mark_buffer_dirty (USPI_UBH(uspi)); | 521 | ubh_mark_buffer_dirty (USPI_UBH(uspi)); |
522 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); | 522 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); |
@@ -618,7 +618,7 @@ cg_found: | |||
618 | DQUOT_FREE_BLOCK(inode, i); | 618 | DQUOT_FREE_BLOCK(inode, i); |
619 | 619 | ||
620 | fs32_add(sb, &ucg->cg_cs.cs_nffree, i); | 620 | fs32_add(sb, &ucg->cg_cs.cs_nffree, i); |
621 | fs32_add(sb, &usb1->fs_cstotal.cs_nffree, i); | 621 | uspi->cs_total.cs_nffree += i; |
622 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, i); | 622 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, i); |
623 | fs32_add(sb, &ucg->cg_frsum[i], 1); | 623 | fs32_add(sb, &ucg->cg_frsum[i], 1); |
624 | goto succed; | 624 | goto succed; |
@@ -635,7 +635,7 @@ cg_found: | |||
635 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); | 635 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); |
636 | 636 | ||
637 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); | 637 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); |
638 | fs32_sub(sb, &usb1->fs_cstotal.cs_nffree, count); | 638 | uspi->cs_total.cs_nffree -= count; |
639 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); | 639 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); |
640 | fs32_sub(sb, &ucg->cg_frsum[allocsize], 1); | 640 | fs32_sub(sb, &ucg->cg_frsum[allocsize], 1); |
641 | 641 | ||
@@ -703,7 +703,7 @@ gotit: | |||
703 | } | 703 | } |
704 | 704 | ||
705 | fs32_sub(sb, &ucg->cg_cs.cs_nbfree, 1); | 705 | fs32_sub(sb, &ucg->cg_cs.cs_nbfree, 1); |
706 | fs32_sub(sb, &usb1->fs_cstotal.cs_nbfree, 1); | 706 | uspi->cs_total.cs_nbfree--; |
707 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(ucpi->c_cgx).cs_nbfree, 1); | 707 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(ucpi->c_cgx).cs_nbfree, 1); |
708 | cylno = ufs_cbtocylno(result); | 708 | cylno = ufs_cbtocylno(result); |
709 | fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(result)), 1); | 709 | fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(result)), 1); |