linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Phillip Susi <psusi@ubuntu.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] e2image: truncate raw image file to correct size
Date: Thu, 16 Feb 2012 18:30:31 -0500	[thread overview]
Message-ID: <20120216233031.GD26473@thunk.org> (raw)
In-Reply-To: <4F3D8D01.5040604@ubuntu.com>

On Thu, Feb 16, 2012 at 06:10:57PM -0500, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 02/16/2012 05:58 PM, Ted Ts'o wrote:
> > I don't see the bug here.  If there are no leftover sparse bytes,
> > there's no need to write the last zero byte.  The whole point was to
> > make sure i_size was set correctly, and if sparse==0, then i_size is
> > correct.
> 
> - From what I can see, when sparse == 0, the last write does a seek
> to move the file pointer, but doesn't write anything beyond the last
> hole, so i_size is not updated.  This resulted in an image file I
> took of a 20gb fs being 124 MiB too small.  I can only assume that
> this is to be expected, and is the reason for passing one byte of
> zero_buff to write_block instead of not giving it any bytes to
> write, and just asking it to do the seek the way the loop does.

Sorry, I'm still not understanding what you're concerned about.  The
last write should seek to the end of the file system, and write a
single byte --- which would be past the last hole.  The goal is to
make sure the file system is large enough that e2fsck doesn't
complain about the file system image being apparently too small.

And in fact, it's doing the right thing:

tytso.root@tytso-glaptop.cam.corp.google.com> {/home/tytso}  
2007# strace -o /tmp/foo /sbin/e2image -r /dev/funarg/library  /kbuild/test.img
e2image 1.42 (29-Nov-2011)
<tytso.root@tytso-glaptop.cam.corp.google.com> {/home/tytso}  
2008# tail /tmp/foo
lseek(5, 1048576, SEEK_CUR)             = 16102031360
lseek(5, 1048576, SEEK_CUR)             = 16103079936
lseek(5, 1048576, SEEK_CUR)             = 16104128512
lseek(5, 1048576, SEEK_CUR)             = 16105177088
lseek(5, 950271, SEEK_CUR)              = 16106127359
write(5, "\0", 1)                       = 1           <=====
munmap(0x7f7b6dace000, 495616)          = 0
close(4)                                = 0
close(3)                                = 0
exit_group(0)                           = ?

I don't understand why you're saying that it's not writing anything
beyond the last hole, and why you're saying i_size is not being
updated.  It's working for me; I can run e2fsck on the generated
image, and it's not complaining that the file system is too small.

       	   	    		     	 - Ted

  reply	other threads:[~2012-02-16 23:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 21:35 [PATCH 1/2] e2image: truncate raw image file to correct size Phillip Susi
2012-02-16 21:35 ` [PATCH 2/2] e2image: add -a switch to include all data Phillip Susi
2012-02-16 23:17   ` Ted Ts'o
2012-02-17  0:17     ` Phillip Susi
2012-02-17  9:17       ` Lukas Czerner
2012-02-17 14:50         ` Ted Ts'o
2012-02-17 15:35           ` Lukas Czerner
2012-02-17 15:39             ` Lukas Czerner
2012-02-17 20:39             ` Ted Ts'o
2012-02-16 22:58 ` [PATCH 1/2] e2image: truncate raw image file to correct size Ted Ts'o
2012-02-16 23:10   ` Phillip Susi
2012-02-16 23:30     ` Ted Ts'o [this message]
2012-02-17  0:21       ` Phillip Susi
2012-02-17 10:04       ` Lukas Czerner
2012-02-17 14:30         ` Ted Ts'o
2012-02-17 14:32           ` [PATCH 1/2] e2image: fix logic bug which could cause a raw image not to be extended Theodore Ts'o
2012-02-17 14:32             ` [PATCH 2/2] e2image: attempt to use ftruncate64 to set i_size for raw images Theodore Ts'o
2012-02-17 14:35               ` [PATCH 2/2 -v2] " Theodore Ts'o
2012-02-17 20:19                 ` Lukas Czerner
2012-02-17 20:18             ` [PATCH 1/2] e2image: fix logic bug which could cause a raw image not to be extended Lukas Czerner
2012-02-17 14:46           ` [PATCH 1/2] e2image: truncate raw image file to correct size Phillip Susi
2012-02-17 14:31         ` Phillip Susi

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=20120216233031.GD26473@thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=psusi@ubuntu.com \
    /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).