patch-2.3.45 linux/fs/adfs/inode.c

Next file: linux/fs/adfs/map.c
Previous file: linux/fs/adfs/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.44/linux/fs/adfs/inode.c linux/fs/adfs/inode.c
@@ -48,30 +48,36 @@
 abort_toobig:
 	return 0;
 }
+
 static int adfs_writepage(struct dentry *dentry, struct page *page)
 {
-	return block_write_full_page(page,adfs_get_block);
+	return block_write_full_page(page, adfs_get_block);
 }
+
 static int adfs_readpage(struct dentry *dentry, struct page *page)
 {
-	return block_read_full_page(page,adfs_get_block);
+	return block_read_full_page(page, adfs_get_block);
 }
-static int adfs_prepare_write(struct page *page, unsigned from, unsigned to)
+
+static int adfs_prepare_write(struct page *page, unsigned int from, unsigned int to)
 {
-	return cont_prepare_write(page,from,to,adfs_get_block,
-		&((struct inode*)page->mapping->host)->u.adfs_i.mmu_private);
+	return cont_prepare_write(page, from, to, adfs_get_block,
+		&((struct inode *)page->mapping->host)->u.adfs_i.mmu_private);
 }
+
 static int _adfs_bmap(struct address_space *mapping, long block)
 {
-	return generic_block_bmap(mapping,block,adfs_get_block);
+	return generic_block_bmap(mapping, block, adfs_get_block);
 }
-struct address_space_operations adfs_aops = {
-	readpage: adfs_readpage,
-	writepage: adfs_writepage,
-	prepare_write: adfs_prepare_write,
-	commit_write: generic_commit_write,
-	bmap: _adfs_bmap
+
+static struct address_space_operations adfs_aops = {
+	readpage:	adfs_readpage,
+	writepage:	adfs_writepage,
+	prepare_write:	adfs_prepare_write,
+	commit_write:	generic_commit_write,
+	bmap:		_adfs_bmap
 };
+
 #else
 int adfs_bmap(struct inode *inode, int block)
 {
@@ -280,7 +286,7 @@
 	if (S_ISDIR(inode->i_mode))
 		inode->i_op	= &adfs_dir_inode_operations;
 	else if (S_ISREG(inode->i_mode)) {
-		inode->i_op	 = &adfs_file_inode_operations;
+		inode->i_op	= &adfs_file_inode_operations;
 		inode->i_mapping->a_ops = &adfs_aops;
 		inode->u.adfs_i.mmu_private = inode->i_size;
 	}
@@ -328,8 +334,10 @@
 	if (error)
 		goto out;
 
-	if (ia_valid & ATTR_SIZE)
+	if (ia_valid & ATTR_SIZE) {
 		inode->i_size = attr->ia_size;
+		vmtruncate(inode, attr->ia_size);
+	}
 	if (ia_valid & ATTR_MTIME) {
 		inode->i_mtime = attr->ia_mtime;
 		adfs_unix2adfs_time(inode, attr->ia_mtime);

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