From: Alan Cook <acook@visionpointsystems.com>
To: linux-xfs@oss.sgi.com
Subject: ftruncate() Writes Last Block of File
Date: Mon, 19 Mar 2012 14:44:33 +0000 (UTC) [thread overview]
Message-ID: <loom.20120319T153420-855@post.gmane.org> (raw)
I have three questions regarding the XFS implementation of ftruncate(). In the
block device driver, I can see that writes are being performed to the last block
of previously written file when ftruncate() is called. I believe that I found
ftruncate() in the XFS sources, but all I see is the filesize being updated in
the inode. So if ftruncate() is writing to the last block, it appears to be a
triggered event.
To test, I added printk() statements in the block device driver that outputs
jiffies for write operations. A file is created and written (~1 MiB), and then
truncated to 8192 via ftruncate(). The original write to file happens about 20
jiffies before the call to ftruncate(). When looking at the output, there is an
additional write to what is the last block of the truncated file, which reports
the same jiffies as the call to ftruncate().
I am not reporting this as a bug, simply looking for more information, as it was
not something that I expected to happen.
Does ftruncate() actually write to the last block of the file? If not, any
thoughts on what would be? It only happens when ftruncate() is called.
Where in the XFS kernel code is ftruncate() implemented? I searched around, but
have no confidence that what I see is actually the ftruncate() implementation.
If ftruncate() does write to the last block of the file, why does it do so?
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2012-03-19 14:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 14:44 Alan Cook [this message]
2012-03-21 4:22 ` ftruncate() Writes Last Block of File Dave Chinner
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=loom.20120319T153420-855@post.gmane.org \
--to=acook@visionpointsystems.com \
--cc=linux-xfs@oss.sgi.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