[kernel] r20209 - in dists/wheezy/linux/debian/patches: . bugfix/all

Ben Hutchings benh at alioth.debian.org
Sat Jun 8 17:17:51 UTC 2013


Author: benh
Date: Sat Jun  8 17:17:51 2013
New Revision: 20209

Log:
udf: Fix handling of i_blocks

Added:
   dists/wheezy/linux/debian/patches/bugfix/all/udf-Fix-handling-of-i_blocks.patch
Modified:
   dists/wheezy/linux/debian/patches/series

Added: dists/wheezy/linux/debian/patches/bugfix/all/udf-Fix-handling-of-i_blocks.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/wheezy/linux/debian/patches/bugfix/all/udf-Fix-handling-of-i_blocks.patch	Sat Jun  8 17:17:51 2013	(r20209)
@@ -0,0 +1,189 @@
+From: Jan Kara <jack at suse.cz>
+Date: Thu, 16 Feb 2012 13:00:14 +0100
+Subject: udf: Fix handling of i_blocks
+
+commit fd4287dbc07763595c1e74edbb6520092290185c upstream.
+
+Commit 36350462 removed unused quota support from UDF. As an unfortunate
+sideeffect it also removed updates of i_blocks so all files had i_block == 0.
+Fix the problem by returning updates of file space back to UDF allocation and
+freeing functions.
+
+Signed-off-by: Jan Kara <jack at suse.cz>
+---
+ fs/udf/balloc.c |   84 ++++++++++++++++++++++++++++++-------------------------
+ 1 file changed, 46 insertions(+), 38 deletions(-)
+
+diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
+index 987585b..1ba2baa 100644
+--- a/fs/udf/balloc.c
++++ b/fs/udf/balloc.c
+@@ -105,7 +105,6 @@ static void udf_add_free_space(struct super_block *sb, u16 partition, u32 cnt)
+ }
+ 
+ static void udf_bitmap_free_blocks(struct super_block *sb,
+-				   struct inode *inode,
+ 				   struct udf_bitmap *bitmap,
+ 				   struct kernel_lb_addr *bloc,
+ 				   uint32_t offset,
+@@ -172,7 +171,6 @@ error_return:
+ }
+ 
+ static int udf_bitmap_prealloc_blocks(struct super_block *sb,
+-				      struct inode *inode,
+ 				      struct udf_bitmap *bitmap,
+ 				      uint16_t partition, uint32_t first_block,
+ 				      uint32_t block_count)
+@@ -223,7 +221,6 @@ out:
+ }
+ 
+ static int udf_bitmap_new_block(struct super_block *sb,
+-				struct inode *inode,
+ 				struct udf_bitmap *bitmap, uint16_t partition,
+ 				uint32_t goal, int *err)
+ {
+@@ -349,7 +346,6 @@ error_return:
+ }
+ 
+ static void udf_table_free_blocks(struct super_block *sb,
+-				  struct inode *inode,
+ 				  struct inode *table,
+ 				  struct kernel_lb_addr *bloc,
+ 				  uint32_t offset,
+@@ -581,7 +577,6 @@ error_return:
+ }
+ 
+ static int udf_table_prealloc_blocks(struct super_block *sb,
+-				     struct inode *inode,
+ 				     struct inode *table, uint16_t partition,
+ 				     uint32_t first_block, uint32_t block_count)
+ {
+@@ -643,7 +638,6 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
+ }
+ 
+ static int udf_table_new_block(struct super_block *sb,
+-			       struct inode *inode,
+ 			       struct inode *table, uint16_t partition,
+ 			       uint32_t goal, int *err)
+ {
+@@ -743,18 +737,23 @@ void udf_free_blocks(struct super_block *sb, struct inode *inode,
+ 	struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
+ 
+ 	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
+-		udf_bitmap_free_blocks(sb, inode, map->s_uspace.s_bitmap,
++		udf_bitmap_free_blocks(sb, map->s_uspace.s_bitmap,
+ 				       bloc, offset, count);
+ 	} else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
+-		udf_table_free_blocks(sb, inode, map->s_uspace.s_table,
++		udf_table_free_blocks(sb, map->s_uspace.s_table,
+ 				      bloc, offset, count);
+ 	} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
+-		udf_bitmap_free_blocks(sb, inode, map->s_fspace.s_bitmap,
++		udf_bitmap_free_blocks(sb, map->s_fspace.s_bitmap,
+ 				       bloc, offset, count);
+ 	} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
+-		udf_table_free_blocks(sb, inode, map->s_fspace.s_table,
++		udf_table_free_blocks(sb, map->s_fspace.s_table,
+ 				      bloc, offset, count);
+ 	}
++
++	if (inode) {
++		inode_sub_bytes(inode,
++				((sector_t)count) << sb->s_blocksize_bits);
++	}
+ }
+ 
+ inline int udf_prealloc_blocks(struct super_block *sb,
+@@ -763,29 +762,34 @@ inline int udf_prealloc_blocks(struct super_block *sb,
+ 			       uint32_t block_count)
+ {
+ 	struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
++	sector_t allocated;
+ 
+ 	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
+-		return udf_bitmap_prealloc_blocks(sb, inode,
+-						  map->s_uspace.s_bitmap,
+-						  partition, first_block,
+-						  block_count);
++		allocated = udf_bitmap_prealloc_blocks(sb,
++						       map->s_uspace.s_bitmap,
++						       partition, first_block,
++						       block_count);
+ 	else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
+-		return udf_table_prealloc_blocks(sb, inode,
+-						 map->s_uspace.s_table,
+-						 partition, first_block,
+-						 block_count);
++		allocated = udf_table_prealloc_blocks(sb,
++						      map->s_uspace.s_table,
++						      partition, first_block,
++						      block_count);
+ 	else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
+-		return udf_bitmap_prealloc_blocks(sb, inode,
+-						  map->s_fspace.s_bitmap,
+-						  partition, first_block,
+-						  block_count);
++		allocated = udf_bitmap_prealloc_blocks(sb,
++						       map->s_fspace.s_bitmap,
++						       partition, first_block,
++						       block_count);
+ 	else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
+-		return udf_table_prealloc_blocks(sb, inode,
+-						 map->s_fspace.s_table,
+-						 partition, first_block,
+-						 block_count);
++		allocated = udf_table_prealloc_blocks(sb,
++						      map->s_fspace.s_table,
++						      partition, first_block,
++						      block_count);
+ 	else
+ 		return 0;
++
++	if (inode && allocated > 0)
++		inode_add_bytes(inode, allocated << sb->s_blocksize_bits);
++	return allocated;
+ }
+ 
+ inline int udf_new_block(struct super_block *sb,
+@@ -793,25 +797,29 @@ inline int udf_new_block(struct super_block *sb,
+ 			 uint16_t partition, uint32_t goal, int *err)
+ {
+ 	struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
++	int block;
+ 
+ 	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
+-		return udf_bitmap_new_block(sb, inode,
+-					   map->s_uspace.s_bitmap,
+-					   partition, goal, err);
++		block = udf_bitmap_new_block(sb,
++					     map->s_uspace.s_bitmap,
++					     partition, goal, err);
+ 	else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
+-		return udf_table_new_block(sb, inode,
+-					   map->s_uspace.s_table,
+-					   partition, goal, err);
+-	else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
+-		return udf_bitmap_new_block(sb, inode,
+-					    map->s_fspace.s_bitmap,
++		block = udf_table_new_block(sb,
++					    map->s_uspace.s_table,
+ 					    partition, goal, err);
++	else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
++		block = udf_bitmap_new_block(sb,
++					     map->s_fspace.s_bitmap,
++					     partition, goal, err);
+ 	else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
+-		return udf_table_new_block(sb, inode,
+-					   map->s_fspace.s_table,
+-					   partition, goal, err);
++		block = udf_table_new_block(sb,
++					    map->s_fspace.s_table,
++					    partition, goal, err);
+ 	else {
+ 		*err = -EIO;
+ 		return 0;
+ 	}
++	if (inode && block)
++		inode_add_bytes(inode, sb->s_blocksize);
++	return block;
+ }

Modified: dists/wheezy/linux/debian/patches/series
==============================================================================
--- dists/wheezy/linux/debian/patches/series	Sat Jun  8 17:12:21 2013	(r20208)
+++ dists/wheezy/linux/debian/patches/series	Sat Jun  8 17:17:51 2013	(r20209)
@@ -650,3 +650,5 @@
 bugfix/all/nfsd-rename-int-access-to-int-may_flags-in-nfsd_open.patch
 bugfix/all/nfsd-vfs_llseek-with-32-or-64-bit-offsets-hashes.patch
 bugfix/all/ext3-return-32-64-bit-dir-name-hash-according-to-usa.patch
+
+bugfix/all/udf-Fix-handling-of-i_blocks.patch



More information about the Kernel-svn-changes mailing list