linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: Stefan Behrens <sbehrens@giantdisaster.de>
Cc: <linux-btrfs@vger.kernel.org>, <zab@redhat.com>
Subject: Re: [PATCH] Btrfs: init device stats for new devices
Date: Fri, 11 Oct 2013 09:43:33 -0400	[thread overview]
Message-ID: <20131011134333.GJ16461@localhost.localdomain> (raw)
In-Reply-To: <a1938a2cc8a66c24293b19aa91526d6eac433b10.1381497087.git.sbehrens@giantdisaster.de>

On Fri, Oct 11, 2013 at 03:20:42PM +0200, Stefan Behrens wrote:
> Device stats are only initialized (read from tree items) on mount.
> Trying to read device stats after adding or replacing new devices will
> return errors.
> 
> btrfs_init_new_device() and btrfs_init_dev_replace_tgtdev() are the two
> functions that allocate and initialize new btrfs_device structures after
> a filesystem is mounted. They set the device stats to zero by using
> kzalloc() which is correct for new devices. The only missing thing was
> to declare these stats as being valid (device->dev_stats_valid = 1) and
> this patch adds this missing code.
> 
> This is the reproducer:
> 
> TEST_DEV1=/dev/sdzzzzz1
> TEST_DEV2=/dev/sdzzzzz2
> TEST_DEV3=/dev/sdzzzzz3
> TEST_MNT=/mnt
> mkfs.btrfs $TEST_DEV1
> mount $TEST_DEV1 $TEST_MNT
> btrfs device add $TEST_DEV2 $TEST_MNT
> btrfs device stat $TEST_MNT
> btrfs replace start -B $TEST_DEV2 $TEST_DEV3 $TEST_MNT
> btrfs device stat $TEST_MNT
> umount $TEST_MNT
> 

Sounds like something that would look great in xfstests,

Josef

  reply	other threads:[~2013-10-11 13:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 13:20 [PATCH] Btrfs: init device stats for new devices Stefan Behrens
2013-10-11 13:43 ` Josef Bacik [this message]
2013-10-11 17:32 ` Zach Brown
2013-10-11 17:36 ` Zach Brown
  -- strict thread matches above, loose matches on Subject: below --
2013-09-28 19:49 Not possible to read device stats for devices added after mount Ondřej Kunc
2013-09-30 21:58 ` [PATCH] btrfs: init device stats for new devices Zach Brown
2013-09-30 22:03   ` Ondřej Kunc
2013-09-30 22:54     ` Zach Brown
2013-10-07 15:25   ` Stefan Behrens

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=20131011134333.GJ16461@localhost.localdomain \
    --to=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sbehrens@giantdisaster.de \
    --cc=zab@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 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).