From: "Xin Zhao" <uszhaoxin@gmail.com>
To: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: a question regarding Ext3 file truncate
Date: Wed, 7 Feb 2007 12:16:36 -0500 [thread overview]
Message-ID: <4ae3c140702070916s71055311j107577421c2c366a@mail.gmail.com> (raw)
Hi,
Please forgive me if the question is dumb.
I am modifying ext3 to add some new features, but was confused by the
implementation of ext3_truncate().
In ext3_truncate():
we first use
n = ext3_block_to_path(inode, last_block, offsets, NULL);
to get the path of the last block.
If the number of blocks is smaller than 12, all blocks are then
direct blocks. We then need to clear them.
But the interesting thing happens:
if (n == 1) /* direct blocks */
{
ext3_free_data(handle, inode, NULL, i_data+offsets[0],
i_data + EXT3_NDIR_BLOCKS);
goto do_indirects;
}
This code seems to free data blocks right after the blocks used by the
file. I think it should be
ext3_free_data(handle, inode, NULL, i_data, i_data+offsets[0]);
Right? can some one explain this a little bit?
Thanks,
-x
next reply other threads:[~2007-02-07 17:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-07 17:16 Xin Zhao [this message]
2007-02-07 18:37 ` a question regarding Ext3 file truncate Mingming Cao
2007-02-07 18:42 ` Xin Zhao
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=4ae3c140702070916s71055311j107577421c2c366a@mail.gmail.com \
--to=uszhaoxin@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/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).