linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Girish Shilamkar <girish@clusterfs.com>
To: Ext4 Mailing List <linux-ext4@vger.kernel.org>
Cc: Andreas Dilger <adilger@clusterfs.com>, Theodore Tso <tytso@mit.edu>
Subject: [Patch 4/13] Allow regular files to be preallocated on-disk.
Date: Tue, 24 Jul 2007 16:34:48 +0530	[thread overview]
Message-ID: <1185275088.3789.69.camel@dhcp4.linsyssoft.com> (raw)

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;

             reply	other threads:[~2007-07-24 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24 11:04 Girish Shilamkar [this message]
2007-08-04  0:40 ` [Patch 4/13] Allow regular files to be preallocated on-disk Theodore Tso
2007-08-04 16:19   ` Andreas Dilger
2007-08-04 18:38     ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1185275088.3789.69.camel@dhcp4.linsyssoft.com \
    --to=girish@clusterfs.com \
    --cc=adilger@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).