Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18977
Modified Files:
super.c
Log Message:
- Add comment about sector/block size handling
- Reformat lengthy if (...) expression.
Index: super.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- super.c 20 Sep 2004 05:51:29 -0000 1.6
+++ super.c 20 Sep 2004 07:01:15 -0000 1.7
@@ -179,12 +179,38 @@
struct buffer_head *bh;
struct ods2sb *ods2p;
+ /* This should be something like (from ext2):
+ *
+ * int blocksize;
+ * blocksize = sb_min_blocksize(sb, BLOCK_SIZE);
+ * // See what the current blocksize for the device is, and
+ * // use that as the blocksize. Otherwise (or if the blocksize
+ * // is smaller than the default) use the default.
+ * // This is important for devices that have a hardware
+ * // sectorsize that is larger than the default.
+ * blocksize = sb_min_blocksize(sb, BLOCK_SIZE);
+ * if (!blocksize) {
+ * printk ("EXT2-fs: unable to set blocksize\n");
+ * goto failed_sbi;
+ * }
+ *
+ * // If the superblock doesn't start on a hardware sector boundary,
+ * // calculate the offset.
+ * if (blocksize != BLOCK_SIZE) {
+ * logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
+ * offset = (sb_block*BLOCK_SIZE) % blocksize;
+ * } else {
+ * logic_sb_block = sb_block;
+ * }
+ *
+ * if (!(bh = sb_bread(sb, logic_sb_block))) {
+ * ...
+ */
sb_set_blocksize(sb, get_hardsect_size(sb->s_dev));
if ((bh = sb_bread(sb, GETBLKNO(sb, 1))) != NULL && bh->b_data != NULL) {
-
- u16 *p;
- u16 chksum1 = 0;
- u16 chksum2 = 0;
+ u16 *p;
+ u16 chksum1 = 0;
+ u16 chksum2 = 0;
if ((ODS2_SB (sb) = kmalloc(sizeof(struct ods2sb), GFP_KERNEL)) == NULL) {
printk("ODS2-fs kmalloc failed for sb generic\n");
@@ -198,17 +224,20 @@
for (p = (u16 *)&(ods2p->hm2) ; p < (u16 *)&(ods2p->hm2.hm2_w_checksum2) ; chksum2 += *p++);
/*
- This is the way to check for a valid home block.
- */
-
- if (ods2p->hm2.hm2_l_homelbn != 0 && ods2p->hm2.hm2_l_alhomelbn != 0 &&
- ods2p->hm2.hm2_l_altidxlbn != 0 && ods2p->hm2.hm2_w_cluster != 0 &&
- ods2p->hm2.u1.s1.hm2_b_structlevl == 2 && ods2p->hm2.u1.s1.hm2_b_structlevv >= 1 &&
- ods2p->hm2.hm2_w_homevbn != 0 && ods2p->hm2.hm2_l_ibmaplbn != 0 &&
- ods2p->hm2.hm2_l_maxfiles > ods2p->hm2.hm2_w_resfiles && ods2p->hm2.hm2_w_resfiles >= 5 &&
- chksum1 == ods2p->hm2.hm2_w_checksum1 && chksum2 == ods2p->hm2.hm2_w_checksum2) {
-
-
+ * This is the way to check for a valid home block.
+ */
+ if (ods2p->hm2.hm2_l_homelbn != 0 &&
+ ods2p->hm2.hm2_l_alhomelbn != 0 &&
+ ods2p->hm2.hm2_l_altidxlbn != 0 &&
+ ods2p->hm2.hm2_w_cluster != 0 &&
+ ods2p->hm2.u1.s1.hm2_b_structlevl == 2 &&
+ ods2p->hm2.u1.s1.hm2_b_structlevv >= 1 &&
+ ods2p->hm2.hm2_w_homevbn != 0 &&
+ ods2p->hm2.hm2_l_ibmaplbn != 0 &&
+ ods2p->hm2.hm2_l_maxfiles > ods2p->hm2.hm2_w_resfiles &&
+ ods2p->hm2.hm2_w_resfiles >= 5 &&
+ chksum1 == ods2p->hm2.hm2_w_checksum1 &&
+ chksum2 == ods2p->hm2.hm2_w_checksum2) {
ods2p->flags.v_raw = 0;
ods2p->flags.v_lowercase = 0;
ods2p->flags.v_version = SB_M_VERSALL;
|