linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch 4/13] Allow regular files to be preallocated on-disk.
@ 2007-07-24 11:04 Girish Shilamkar
  2007-08-04  0:40 ` Theodore Tso
  0 siblings, 1 reply; 4+ messages in thread
From: Girish Shilamkar @ 2007-07-24 11:04 UTC (permalink / raw)
  To: Ext4 Mailing List; +Cc: Andreas Dilger, Theodore Tso

Allow regular files to be preallocated on-disk up to the next multiple
of the system PAGE_SIZE without complaining about extra blocks.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>

Index: e2fsprogs-1.40.1/e2fsck/pass1.c
===================================================================
--- e2fsprogs-1.40.1.orig/e2fsck/pass1.c
+++ e2fsprogs-1.40.1/e2fsck/pass1.c
@@ -1591,9 +1591,14 @@ static void check_blocks(e2fsck_t ctx, s
 				bad_size = 2;
 		}
 	} else {
+		e2_blkcnt_t blkpg = getpagesize() / fs->blocksize;
+
 		size = EXT2_I_SIZE(inode);
 		if ((pb.last_block >= 0) &&
-		    (size < (__u64) pb.last_block * fs->blocksize))
+		    /* allow allocated blocks to end of PAGE_SIZE */
+		    (size < (__u64)pb.last_block * fs->blocksize) &&
+		    (pb.last_block / blkpg * blkpg != pb.last_block ||
+		     size < (__u64)(pb.last_block & ~(blkpg-1)) *fs->blocksize))
 			bad_size = 3;
 		else if (size > ext2_max_sizes[fs->super->s_log_block_size])
 			bad_size = 4;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-04 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 11:04 [Patch 4/13] Allow regular files to be preallocated on-disk Girish Shilamkar
2007-08-04  0:40 ` Theodore Tso
2007-08-04 16:19   ` Andreas Dilger
2007-08-04 18:38     ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).