From: "George Spelvin" <linux@horizon.com>
To: linux-ext4@vger.kernel.org, linux@horizon.com, tytso@mit.edu,
wenqing.lz@taobao.com
Subject: Re: [PATCH 2/2 v2] debugfs: dump a sparse file as a new sparse file
Date: 9 Jan 2013 19:42:32 -0500 [thread overview]
Message-ID: <20130110004232.9651.qmail@science.horizon.com> (raw)
In-Reply-To: <20130109145854.GA27630@thunk.org>
> 2) If the sparse flag is set, then ext2_file_read() will stop the read
> when it runs into the first uninitialized or sparse block. That is,
> consider the example file which has 8k of data, a 4k uninitialized
> block, and then 12k of data after that. If the sparse flag is passed
> to ext2_file_open(), then ext2fs_file_read(fd, buf, 16384, &got) will
> read 8k of data into buf, and return with got set to 8192.
>
> 3) To distinguish between EOF and a sparse block, if the current file
> offset is pointed at a sparse/uninitialized block, and the sparse flag
> was passed to ext2_file_open(), then in addition to *got getting set
> 0, ext2_file_read() will also return a new error code,
> EXT2_ET_READ_HOLE_FOUND.
Given that the current model of ext2fs_file_read is that it returns
some valid data in *got, AND the reason it stopped short as the retval,
wouldn't it make more sense to return EXT2_ET_READ_HOLE_FOUND from the
*first* read call?
It's a minor thing, as you just end up falling back to the Unix syscall
model of deferring the error until the next read call, but wouldn't
it be more consistent?
prev parent reply other threads:[~2013-01-10 0:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-01 12:30 [PATCH 0/2 v2] debugfs: dump a sparse file as a new sparse file Zheng Liu
2013-01-01 12:30 ` [PATCH 1/2 v2] debugfs: fixup the hard-coded buffer length in dump_file Zheng Liu
2013-01-01 20:14 ` Theodore Ts'o
2013-01-01 12:30 ` [PATCH 2/2 v2] debugfs: dump a sparse file as a new sparse file Zheng Liu
2013-01-01 20:38 ` Theodore Ts'o
2013-01-04 4:05 ` Zheng Liu
2013-01-04 19:37 ` Theodore Ts'o
2013-01-05 4:45 ` Zheng Liu
2013-01-09 14:58 ` Theodore Ts'o
2013-01-09 15:34 ` Zheng Liu
2013-01-10 0:42 ` George Spelvin [this message]
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=20130110004232.9651.qmail@science.horizon.com \
--to=linux@horizon.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wenqing.lz@taobao.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).