X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fufs%2Fballoc.c;h=3ada9dcf55b8bd86046a95812d6ad918b9a00f2f;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=4209eb7f238d6afc59376dd1d18a0441e93b365c;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 4209eb7f2..3ada9dcf5 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c @@ -13,8 +13,9 @@ #include #include #include +#include #include -#include +#include #include #include "swab.h" @@ -28,12 +29,12 @@ #define UFSD(x) #endif -unsigned ufs_add_fragments (struct inode *, unsigned, unsigned, unsigned, int *); -unsigned ufs_alloc_fragments (struct inode *, unsigned, unsigned, unsigned, int *); -unsigned ufs_alloccg_block (struct inode *, struct ufs_cg_private_info *, unsigned, int *); -unsigned ufs_bitmap_search (struct super_block *, struct ufs_cg_private_info *, unsigned, unsigned); +static unsigned ufs_add_fragments (struct inode *, unsigned, unsigned, unsigned, int *); +static unsigned ufs_alloc_fragments (struct inode *, unsigned, unsigned, unsigned, int *); +static unsigned ufs_alloccg_block (struct inode *, struct ufs_cg_private_info *, unsigned, int *); +static unsigned ufs_bitmap_search (struct super_block *, struct ufs_cg_private_info *, unsigned, unsigned); static unsigned char ufs_fragtable_8fpb[], ufs_fragtable_other[]; -void ufs_clusteracct(struct super_block *, struct ufs_cg_private_info *, unsigned, int); +static void ufs_clusteracct(struct super_block *, struct ufs_cg_private_info *, unsigned, int); /* * Free 'count' fragments from fragment number 'fragment' @@ -48,7 +49,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count sb = inode->i_sb; uspi = UFS_SB(sb)->s_uspi; - usb1 = ubh_get_usb_first(USPI_UBH); + usb1 = ubh_get_usb_first(uspi); UFSD(("ENTER, fragment %u, count %u\n", fragment, count)) @@ -80,8 +81,9 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count for (i = bit; i < end_bit; i++) { if (ubh_isclr (UCPI_UBH, ucpi->c_freeoff, i)) ubh_setbit (UCPI_UBH, ucpi->c_freeoff, i); - else ufs_error (sb, "ufs_free_fragments", - "bit already cleared for fragment %u", i); + else + ufs_error (sb, "ufs_free_fragments", + "bit already cleared for fragment %u", i); } DQUOT_FREE_BLOCK (inode, count); @@ -114,8 +116,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count ubh_mark_buffer_dirty (USPI_UBH); ubh_mark_buffer_dirty (UCPI_UBH); if (sb->s_flags & MS_SYNCHRONOUS) { - ubh_wait_on_buffer (UCPI_UBH); - ubh_ll_rw_block (WRITE, 1, (struct ufs_buffer_head **)&ucpi); + ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **)&ucpi); ubh_wait_on_buffer (UCPI_UBH); } sb->s_dirt = 1; @@ -143,7 +144,7 @@ void ufs_free_blocks (struct inode * inode, unsigned fragment, unsigned count) { sb = inode->i_sb; uspi = UFS_SB(sb)->s_uspi; - usb1 = ubh_get_usb_first(USPI_UBH); + usb1 = ubh_get_usb_first(uspi); UFSD(("ENTER, fragment %u, count %u\n", fragment, count)) @@ -200,8 +201,7 @@ do_more: ubh_mark_buffer_dirty (USPI_UBH); ubh_mark_buffer_dirty (UCPI_UBH); if (sb->s_flags & MS_SYNCHRONOUS) { - ubh_wait_on_buffer (UCPI_UBH); - ubh_ll_rw_block (WRITE, 1, (struct ufs_buffer_head **)&ucpi); + ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **)&ucpi); ubh_wait_on_buffer (UCPI_UBH); } @@ -235,7 +235,7 @@ failed: brelse (bh); \ } -unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment, +unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment, unsigned goal, unsigned count, int * err ) { struct super_block * sb; @@ -248,7 +248,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment, sb = inode->i_sb; uspi = UFS_SB(sb)->s_uspi; - usb1 = ubh_get_usb_first(USPI_UBH); + usb1 = ubh_get_usb_first(uspi); *err = -ENOSPC; lock_super (sb); @@ -371,6 +371,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment, else { printk(KERN_ERR "ufs_new_fragments: bread fail\n"); + unlock_super(sb); return 0; } } @@ -392,8 +393,9 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment, return 0; } -unsigned ufs_add_fragments (struct inode * inode, unsigned fragment, - unsigned oldcount, unsigned newcount, int * err) +static unsigned +ufs_add_fragments (struct inode * inode, unsigned fragment, + unsigned oldcount, unsigned newcount, int * err) { struct super_block * sb; struct ufs_sb_private_info * uspi; @@ -406,11 +408,11 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment, sb = inode->i_sb; uspi = UFS_SB(sb)->s_uspi; - usb1 = ubh_get_usb_first (USPI_UBH); + usb1 = ubh_get_usb_first (uspi); count = newcount - oldcount; cgno = ufs_dtog(fragment); - if (UFS_SB(sb)->fs_cs(cgno).cs_nffree < count) + if (fs32_to_cpu(sb, UFS_SB(sb)->fs_cs(cgno).cs_nffree) < count) return 0; if ((ufs_fragnum (fragment) + newcount) > uspi->s_fpb) return 0; @@ -457,8 +459,7 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment, ubh_mark_buffer_dirty (USPI_UBH); ubh_mark_buffer_dirty (UCPI_UBH); if (sb->s_flags & MS_SYNCHRONOUS) { - ubh_wait_on_buffer (UCPI_UBH); - ubh_ll_rw_block (WRITE, 1, (struct ufs_buffer_head **)&ucpi); + ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **)&ucpi); ubh_wait_on_buffer (UCPI_UBH); } sb->s_dirt = 1; @@ -476,7 +477,7 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment, if (fs32_to_cpu(sb, ucg->cg_frsum[k])) \ goto cg_found; -unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno, +static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno, unsigned goal, unsigned count, int * err) { struct super_block * sb; @@ -490,7 +491,7 @@ unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno, sb = inode->i_sb; uspi = UFS_SB(sb)->s_uspi; - usb1 = ubh_get_usb_first(USPI_UBH); + usb1 = ubh_get_usb_first(uspi); oldcg = cgno; /* @@ -583,8 +584,7 @@ succed: ubh_mark_buffer_dirty (USPI_UBH); ubh_mark_buffer_dirty (UCPI_UBH); if (sb->s_flags & MS_SYNCHRONOUS) { - ubh_wait_on_buffer (UCPI_UBH); - ubh_ll_rw_block (WRITE, 1, (struct ufs_buffer_head **)&ucpi); + ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **)&ucpi); ubh_wait_on_buffer (UCPI_UBH); } sb->s_dirt = 1; @@ -594,7 +594,7 @@ succed: return result; } -unsigned ufs_alloccg_block (struct inode * inode, +static unsigned ufs_alloccg_block (struct inode * inode, struct ufs_cg_private_info * ucpi, unsigned goal, int * err) { struct super_block * sb; @@ -607,7 +607,7 @@ unsigned ufs_alloccg_block (struct inode * inode, sb = inode->i_sb; uspi = UFS_SB(sb)->s_uspi; - usb1 = ubh_get_usb_first(USPI_UBH); + usb1 = ubh_get_usb_first(uspi); ucg = ubh_get_ucg(UCPI_UBH); if (goal == 0) { @@ -652,7 +652,7 @@ gotit: return result; } -unsigned ufs_bitmap_search (struct super_block * sb, +static unsigned ufs_bitmap_search (struct super_block * sb, struct ufs_cg_private_info * ucpi, unsigned goal, unsigned count) { struct ufs_sb_private_info * uspi; @@ -664,7 +664,7 @@ unsigned ufs_bitmap_search (struct super_block * sb, UFSD(("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count)) uspi = UFS_SB(sb)->s_uspi; - usb1 = ubh_get_usb_first (USPI_UBH); + usb1 = ubh_get_usb_first (uspi); ucg = ubh_get_ucg(UCPI_UBH); if (goal) @@ -723,7 +723,7 @@ unsigned ufs_bitmap_search (struct super_block * sb, return (unsigned)-1; } -void ufs_clusteracct(struct super_block * sb, +static void ufs_clusteracct(struct super_block * sb, struct ufs_cg_private_info * ucpi, unsigned blkno, int cnt) { struct ufs_sb_private_info * uspi; @@ -769,11 +769,11 @@ void ufs_clusteracct(struct super_block * sb, i = back + forw + 1; if (i > uspi->s_contigsumsize) i = uspi->s_contigsumsize; - fs32_add(sb, (u32*)ubh_get_addr(UCPI_UBH, ucpi->c_clustersumoff + (i << 2)), cnt); + fs32_add(sb, (__fs32*)ubh_get_addr(UCPI_UBH, ucpi->c_clustersumoff + (i << 2)), cnt); if (back > 0) - fs32_sub(sb, (u32*)ubh_get_addr(UCPI_UBH, ucpi->c_clustersumoff + (back << 2)), cnt); + fs32_sub(sb, (__fs32*)ubh_get_addr(UCPI_UBH, ucpi->c_clustersumoff + (back << 2)), cnt); if (forw > 0) - fs32_sub(sb, (u32*)ubh_get_addr(UCPI_UBH, ucpi->c_clustersumoff + (forw << 2)), cnt); + fs32_sub(sb, (__fs32*)ubh_get_addr(UCPI_UBH, ucpi->c_clustersumoff + (forw << 2)), cnt); }