patch-2.3.9 linux/fs/inode.c

Next file: linux/fs/ioctl.c
Previous file: linux/fs/hpfs/super.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.8/linux/fs/inode.c linux/fs/inode.c
@@ -231,7 +231,7 @@
 void clear_inode(struct inode *inode)
 {
 	if (inode->i_nrpages)
-		truncate_inode_pages(inode, 0);
+		BUG();
 	wait_on_inode(inode);
 	if (IS_QUOTAINIT(inode))
 		DQUOT_DROP(inode);
@@ -261,6 +261,8 @@
 		if (tmp == head)
 			break;
 		inode = list_entry(tmp, struct inode, i_list);
+		if (inode->i_nrpages)
+			truncate_inode_pages(inode, 0);
 		clear_inode(inode);
 		count++;
 	}
@@ -735,6 +737,8 @@
 				if (op && op->delete_inode) {
 					void (*delete)(struct inode *) = op->delete_inode;
 					spin_unlock(&inode_lock);
+					if (inode->i_nrpages)
+						truncate_inode_pages(inode, 0);
 					delete(inode);
 					spin_lock(&inode_lock);
 				}
@@ -778,8 +782,14 @@
 
 int bmap(struct inode * inode, int block)
 {
-	if (inode->i_op && inode->i_op->bmap)
-		return inode->i_op->bmap(inode, block);
+	struct buffer_head tmp;
+
+	if (inode->i_op && inode->i_op->get_block) {
+		tmp.b_state = 0;
+		tmp.b_blocknr = 0;
+		inode->i_op->get_block(inode, block, &tmp, 0);
+		return tmp.b_blocknr;
+	}
 	return 0;
 }
 

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