patch-2.4.27 linux-2.4.27/fs/affs/bitmap.c
Next file: linux-2.4.27/fs/affs/super.c
Previous file: linux-2.4.27/fs/affs/amigaffs.c
Back to the patch index
Back to the overall index
- Lines: 76
- Date:
2004-08-07 16:26:05.962400523 -0700
- Orig file:
linux-2.4.26/fs/affs/bitmap.c
- Orig date:
2002-02-25 11:38:07.000000000 -0800
diff -urN linux-2.4.26/fs/affs/bitmap.c linux-2.4.27/fs/affs/bitmap.c
@@ -268,8 +268,7 @@
return 0;
}
-int
-affs_init_bitmap(struct super_block *sb)
+int affs_init_bitmap(struct super_block *sb, int *flags)
{
struct affs_bm_info *bm;
struct buffer_head *bmap_bh = NULL, *bh = NULL;
@@ -277,13 +276,13 @@
u32 size, blk, end, offset, mask;
int i, res = 0;
- if (sb->s_flags & MS_RDONLY)
+ if (*flags & MS_RDONLY)
return 0;
if (!AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->bm_flag) {
printk(KERN_NOTICE "AFFS: Bitmap invalid - mounting %s read only\n",
kdevname(sb->s_dev));
- sb->s_flags |= MS_RDONLY;
+ *flags |= MS_RDONLY;
return 0;
}
@@ -296,7 +295,7 @@
bm = AFFS_SB->s_bitmap = kmalloc(size, GFP_KERNEL);
if (!AFFS_SB->s_bitmap) {
printk(KERN_ERR "AFFS: Bitmap allocation failed\n");
- return 1;
+ return -ENOMEM;
}
memset(AFFS_SB->s_bitmap, 0, size);
@@ -311,13 +310,13 @@
bh = affs_bread(sb, bm->bm_key);
if (!bh) {
printk(KERN_ERR "AFFS: Cannot read bitmap\n");
- res = 1;
+ res = -EIO;
goto out;
}
if (affs_checksum_block(sb, bh)) {
printk(KERN_WARNING "AFFS: Bitmap %u invalid - mounting %s read only.\n",
bm->bm_key, kdevname(sb->s_dev));
- sb->s_flags |= MS_RDONLY;
+ *flags |= MS_RDONLY;
goto out;
}
pr_debug("AFFS: read bitmap block %d: %d\n", blk, bm->bm_key);
@@ -333,7 +332,7 @@
bmap_bh = affs_bread(sb, be32_to_cpu(bmap_blk[blk]));
if (!bmap_bh) {
printk(KERN_ERR "AFFS: Cannot read bitmap extension\n");
- res = 1;
+ res = -EIO;
goto out;
}
bmap_blk = (u32 *)bmap_bh->b_data;
@@ -378,3 +377,15 @@
affs_brelse(bmap_bh);
return res;
}
+
+void affs_free_bitmap(struct super_block *sb)
+{
+ if (!AFFS_SB->s_bitmap)
+ return;
+
+ affs_brelse(AFFS_SB->s_bmap_bh);
+ AFFS_SB->s_bmap_bh = NULL;
+ AFFS_SB->s_last_bmap = ~0;
+ kfree(AFFS_SB->s_bitmap);
+ AFFS_SB->s_bitmap = NULL;
+}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)