linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Daegyu Han <hdg9400@gmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: Why doesn't disk io occur to read file system metadata despite clearing dentry and inode with drop_cache command?
Date: Thu, 17 Oct 2019 17:32:17 +0200	[thread overview]
Message-ID: <20191017153217.GB27576@quack2.suse.cz> (raw)
In-Reply-To: <CAARcW+qa7aRbh+BeFWTndGLC8owsy9VPUqcJ-BYN-Yw3jQM-_w@mail.gmail.com>

Hello,

On Wed 11-09-19 15:27:07, Daegyu Han wrote:
> I am confused about "echo # >/proc/sys/vm/drop_caches" and blockdev
> --flushbufs.  According to OSStep book written by Remzi,If the target
> inodes are not cached in memory, disk IO should be occur to readthe
> inode, which will make a dentry data structure on memory.  To my
> knowledge, echo 3 >/proc/sys/vm/drop_caches is to drop(clear) page
> cahche, inodes and dentry. I have experimented with blktrace to figure
> out whether disk io is really occurring to read the inode.
> 
> 1. echo 3 > /proc/sys/vm/drop_caches
> However, there is no disk io to read inode. I can only see the disk io
> to read 16KB data block.
> 2. echo 3 > /proc/sys/vm/drop_caches` and `blockdev --flushbufs
> /dev/nvme0n1I found block access (+8(512*8=4KB)) to read inode.
> 
> A quick look at how blockdev --flushbufs works in the kernel code shows
> that it clears the superblock.  Why doesn't disk io occur to read inodes
> with drop_cache alone?  The kernel book called ULK says that inodes and
> superblocks are cached in buffer-cache.Is this the reason for this?  I
> infer as follows:Is the buffer_head data structure not flushed to disk by
> drop_cache alone because the storage device is still mapped in memory?

Yes, I guess that's what happened. Note that drop_caches drop only clean
and unreferenced inodes, dentries & page cache. So if the inode is dirty
(e.g. due to atime update pending), drop caches won't free it. Another
effect may be that something (e.g. the jbd2 journal) holds onto the buffer
caching the inode table block with the inode.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2019-10-17 15:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11  6:27 Why doesn't disk io occur to read file system metadata despite clearing dentry and inode with drop_cache command? Daegyu Han
2019-10-17 15:32 ` Jan Kara [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=20191017153217.GB27576@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=hdg9400@gmail.com \
    --cc=linux-ext4@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).