linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	Theodore Ts'o <tytso@mit.edu>, Eric Sandeen <esandeen@redhat.com>
Subject: Re: Discard request and write counters
Date: Thu, 24 Mar 2011 10:40:20 +1100	[thread overview]
Message-ID: <20110323234020.GH26611@dastard> (raw)
In-Reply-To: <alpine.LFD.2.00.1103231352250.1486@dhcp-27-109.brq.redhat.com>

On Wed, Mar 23, 2011 at 02:07:40PM +0100, Lukas Czerner wrote:
> Hello,
> 
> I have noticed that we do treat discard requests (REQ_DISCARD) as write
> requests which is probably right, but it has the side effect of
> increasing write counters as well (disk_stats->sectors[1]) which leads
> to confusing result.
> 
> For example in ext4 filesystem we have counter s_kbytes_written which
> stores amount of kbytes written to the filesystem throughout its
> lifetime. Now, if you mount the filesystem with -o discard mount option,
> which means that with every commit blocks used by unlinked files are
> discarded, you'll get approx. twice as many kb writes as it should be
> (if you delete every file you have previously written of course).
> 
> So this means that with -o discard the ext4 s_kbytes_written counter is
> no longer reliable. Now the question is how to fix that ? Should the
> users of the disk_stats->sectors[1] count with this behaviour as the
> REQ_DISCARD is treated as write and should be accounted for, or should
> we change that in block layer and do not count REQ_DISCARD as write in
> the first place ?

IMO discard needs to be accounted separately in new counters.
Discards are not writes, but knowing how much data is being
discarded along with read and write stats is definitely useful
information about the IO load the device is under.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2011-03-23 23:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 13:07 Discard request and write counters Lukas Czerner
2011-03-23 23:40 ` Dave Chinner [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=20110323234020.GH26611@dastard \
    --to=david@fromorbit.com \
    --cc=axboe@kernel.dk \
    --cc=esandeen@redhat.com \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).