patch-2.4.18 linux/fs/qnx4/inode.c

Next file: linux/fs/read_write.c
Previous file: linux/fs/qnx4/fsync.c
Back to the patch index
Back to the overall index

diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/fs/qnx4/inode.c linux/fs/qnx4/inode.c
@@ -95,7 +95,7 @@
 	QNX4DEBUG(("qnx4: write inode 2.\n"));
 	block = ino / QNX4_INODES_PER_BLOCK;
 	lock_kernel();
-	if (!(bh = bread(inode->i_dev, block, QNX4_BLOCK_SIZE))) {
+	if (!(bh = sb_bread(inode->i_sb, block))) {
 		printk("qnx4: major problem: unable to read inode from dev "
 		       "%s\n", kdevname(inode->i_dev));
 		unlock_kernel();
@@ -162,7 +162,7 @@
 	if ( nr >= 0 )
 		nr = qnx4_block_map( inode, nr );
 	if (nr) {
-		result = getblk(inode->i_dev, nr, QNX4_BLOCK_SIZE);
+		result = sb_getblk(inode->i_sb, nr);
 		return result;
 	}
 	if (!create) {
@@ -173,7 +173,7 @@
 	if (!tmp) {
 		return NULL;
 	}
-	result = getblk(inode->i_dev, tmp, QNX4_BLOCK_SIZE);
+	result = sb_getblk(inode->i_sb, tmp);
 	if (tst) {
 		qnx4_free_block(inode->i_sb, tmp);
 		brelse(result);
@@ -243,7 +243,7 @@
 		while ( --nxtnt > 0 ) {
 			if ( ix == 0 ) {
 				// read next xtnt block.
-				bh = bread( inode->i_dev, i_xblk - 1, QNX4_BLOCK_SIZE );
+				bh = sb_bread(inode->i_sb, i_xblk - 1);
 				if ( !bh ) {
 					QNX4DEBUG(("qnx4: I/O error reading xtnt block [%ld])\n", i_xblk - 1));
 					return -EIO;
@@ -307,7 +307,7 @@
 		rd = le32_to_cpu(sb->u.qnx4_sb.sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
 		rl = le32_to_cpu(sb->u.qnx4_sb.sb->RootDir.di_first_xtnt.xtnt_size);
 		for (j = 0; j < rl; j++) {
-			bh = bread(sb->s_dev, rd + j, QNX4_BLOCK_SIZE);	/* root dir, first block */
+			bh = sb_bread(sb, rd + j);	/* root dir, first block */
 			if (bh == NULL) {
 				return "unable to read root entry.";
 			}
@@ -318,6 +318,10 @@
 					if (!strncmp(rootdir->di_fname, QNX4_BMNAME, sizeof QNX4_BMNAME)) {
 						found = 1;
 						sb->u.qnx4_sb.BitMap = kmalloc( sizeof( struct qnx4_inode_entry ), GFP_KERNEL );
+						if (!sb->u.qnx4_sb.BitMap) {
+							brelse (bh);
+							return "not enough memory for bitmap inode";
+						}
 						memcpy( sb->u.qnx4_sb.BitMap, rootdir, sizeof( struct qnx4_inode_entry ) );	/* keep bitmap inode known */
 						break;
 					}
@@ -350,7 +354,7 @@
 	/* Check the boot signature. Since the qnx4 code is
 	   dangerous, we should leave as quickly as possible
 	   if we don't belong here... */
-	bh = bread(dev, 0, QNX4_BLOCK_SIZE);
+	bh = sb_bread(s, 0);
 	if (!bh) {
 		printk("qnx4: unable to read the boot sector\n");
 		goto outnobh;
@@ -362,7 +366,7 @@
 	}
 	brelse(bh);
 
-	bh = bread(dev, 1, QNX4_BLOCK_SIZE);
+	bh = sb_bread(s, 1);
 	if (!bh) {
 		printk("qnx4: unable to read the superblock\n");
 		goto outnobh;
@@ -457,7 +461,7 @@
 	}
 	block = ino / QNX4_INODES_PER_BLOCK;
 
-	if (!(bh = bread(inode->i_dev, block, QNX4_BLOCK_SIZE))) {
+	if (!(bh = sb_bread(inode->i_sb, block))) {
 		printk("qnx4: major problem: unable to read inode from dev "
 		       "%s\n", kdevname(inode->i_dev));
 		return;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)