patch-2.4.18 linux/fs/freevxfs/vxfs_super.c
Next file: linux/fs/hfs/file.c
Previous file: linux/fs/freevxfs/vxfs_subr.c
Back to the patch index
Back to the overall index
- Lines: 95
- Date:
Mon Feb 4 19:16:43 2002
- Orig file:
linux.orig/fs/freevxfs/vxfs_super.c
- Orig date:
Mon Feb 18 20:18:40 2002
diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/fs/freevxfs/vxfs_super.c linux/fs/freevxfs/vxfs_super.c
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
-#ident "$Id: vxfs_super.c,v 1.26 2001/08/07 16:13:30 hch Exp hch $"
+#ident "$Id: vxfs_super.c,v 1.29 2002/01/02 22:02:12 hch Exp hch $"
/*
* Veritas filesystem driver - superblock related routines.
@@ -62,19 +62,6 @@
.statfs = vxfs_statfs,
};
-static __inline__ u_long
-vxfs_validate_bsize(kdev_t dev)
-{
- u_long bsize;
-
- bsize = get_hardsect_size(dev);
- if (bsize < BLOCK_SIZE)
- bsize = BLOCK_SIZE;
-
- set_blocksize(dev, bsize);
- return (bsize);
-}
-
/**
* vxfs_put_super - free superblock resources
* @sbp: VFS superblock.
@@ -153,21 +140,24 @@
{
struct vxfs_sb_info *infp;
struct vxfs_sb *rsbp;
- struct buffer_head *bp;
+ struct buffer_head *bp = NULL;
u_long bsize;
- kdev_t dev = sbp->s_dev;
- infp = kmalloc(sizeof(struct vxfs_sb_info), GFP_KERNEL);
+ infp = kmalloc(sizeof(*infp), GFP_KERNEL);
if (!infp) {
printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n");
return NULL;
}
- memset(infp, 0, sizeof(struct vxfs_sb_info));
+ memset(infp, 0, sizeof(*infp));
- bsize = vxfs_validate_bsize(dev);
+ bsize = sb_min_blocksize(sbp, BLOCK_SIZE);
+ if (!bsize) {
+ printk(KERN_WARNING "vxfs: unable to set blocksize\n");
+ goto out;
+ }
- bp = bread(dev, 1, bsize);
- if (!bp) {
+ bp = sb_bread(sbp, 1);
+ if (!bp || !buffer_mapped(bp)) {
if (!silent) {
printk(KERN_WARNING
"vxfs: unable to read disk superblock\n");
@@ -194,31 +184,15 @@
#endif
sbp->s_magic = rsbp->vs_magic;
- sbp->s_blocksize = rsbp->vs_bsize;
sbp->u.generic_sbp = (void *)infp;
infp->vsi_raw = rsbp;
infp->vsi_bp = bp;
infp->vsi_oltext = rsbp->vs_oltext[0];
infp->vsi_oltsize = rsbp->vs_oltsize;
-
- switch (rsbp->vs_bsize) {
- case 1024:
- sbp->s_blocksize_bits = 10;
- break;
- case 2048:
- sbp->s_blocksize_bits = 11;
- break;
- case 4096:
- sbp->s_blocksize_bits = 12;
- break;
- default:
- if (!silent) {
- printk(KERN_WARNING
- "vxfs: unsupported blocksise: %d\n",
- rsbp->vs_bsize);
- }
+ if (!sb_set_blocksize(sbp, rsbp->vs_bsize)) {
+ printk(KERN_WARNING "vxfs: unable to set final block size\n");
goto out;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)