All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@sun.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 2/2] ext4: journal superblock modifications in ext4_statfs()
Date: Fri, 06 Nov 2009 17:26:51 -0700	[thread overview]
Message-ID: <6BDA2C94-6FA5-48EE-9E68-56BDFC4B558A@sun.com> (raw)
In-Reply-To: <4AF4A429.7090507@redhat.com>

On 2009-11-06, at 15:33, Eric Sandeen wrote:
> commit a71ce8c6c9bf269b192f352ea555217815cf027e updated
> ext4_statfs() to update the on-disk superblock counters,
> but modified this buffer directly without any journaling of
> the change.  This is one of the accesses that was causing the crc  
> errors in journal replay as seen in kernel.org bugzilla #14354.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
>
> @@ -3650,20 +3652,33 @@ static int ext4_statfs(struct dentry  
> *dentry, struct kstatfs *buf)
> +	handle = ext4_journal_start_sb(sb, 1);
> +	if (IS_ERR(handle)) {
> +		err = PTR_ERR(handle);
> +		goto out;
> +	}
> +	err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
> +	if (err)
> +		goto journal_stop;
> +	es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
> +	ext4_free_blocks_count_set(es, buf->f_bfree);
> +	err = ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);


I admit to being the instigator of this change.

The intention is that we want to update the on-disk superblock block/ 
inode
counters from the per-cpu data periodically, since they are never  
updated
anymore (only the group summaries are updated, to avoid contention).   
However,
this isn't critical work, since it is only useful for read-only e2fsck  
not
reporting spurious errors on the filesystem and dumpe2fs/debugfs  
having some
chance at reporting a reasonable value for the filesystem space usage.

Starting a transaction as part of statfs is really counter-productive  
to making
that code efficient, which was the whole point of the original patch  
to remove
the per-call "overhead" calculation.

The intention was that the in-memory superblock would be updated  
whenever statfs
is called (this doesn't cost anything, since we've already computed  
the value
for statfs), and if the superblock is written to disk for some other  
reason they
will go along for the ride.

If the choice is between adding a proper transaction here, or not  
doing this at
all, I'd rather just not do it at all.  Of course, I'd like to work  
out some
kind of compromise, like only updating the superblock when there is  
already a shadow BH that is being used to write to the journal, or  
similar.

If there is a desire to keep a transaction here and update the  
superblock
counters, it _definitely_ doesn't need to be done on every statfs, but  
at most
once every 30 seconds or whatever.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


  reply	other threads:[~2009-11-07  0:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-06 22:33 [PATCH 2/2] ext4: journal superblock modifications in ext4_statfs() Eric Sandeen
2009-11-07  0:26 ` Andreas Dilger [this message]
2009-11-07  1:08   ` Eric Sandeen
2009-11-08 21:48   ` Theodore Tso
2009-11-08 22:09     ` Eric Sandeen
2009-11-09 12:53       ` Theodore Tso
2009-11-09 17:55         ` Andreas Dilger
2009-11-09  4:41     ` Andreas Dilger
2009-11-15  3:29       ` Theodore Tso
2009-11-16 23:38         ` Andreas Dilger
2009-11-19 19:08           ` tytso
2009-11-23 11:57             ` Duane Griffin
2009-11-23 14:26               ` tytso
2009-11-23 14:40                 ` Duane Griffin

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=6BDA2C94-6FA5-48EE-9E68-56BDFC4B558A@sun.com \
    --to=adilger@sun.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.