All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: Arne Jansen <sensille@gmx.net>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 3/6] btrfs: add scrub code and prototypes
Date: Mon, 14 Mar 2011 01:50:31 +0200	[thread overview]
Message-ID: <20110313235031.GA32690@kwango.lan.net> (raw)
In-Reply-To: <7ccafb5250b72ca706369a8d5b45f06e8d5a4f8a.1299941055.git.sensille@gmx.net>

On Sat, Mar 12, 2011 at 03:50:42PM +0100, Arne Jansen wrote:
> This is the main scrub code.
> 
> Updates v3:
> 
>  - fixed EIO handling, need to reallocate bio instead of reusing it
>  - Updated according to David Sterba's review
>  - don't clobber bi_flags on reuse, just set UPTODATE
>  - allocate long living bios with bio_kmalloc instead of bio_alloc
> 
> Signed-off-by: Arne Jansen <sensille@gmx.net>
> ---
>  fs/btrfs/Makefile |    2 +-
>  fs/btrfs/ctree.h  |   14 +
>  fs/btrfs/scrub.c  | 1497 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 1512 insertions(+), 1 deletions(-)

(snipped)

> +static noinline_for_stack int scrub_stripe(struct scrub_dev *sdev,
> +	struct map_lookup *map, int num, u64 base, u64 length)
> +{
> +	struct btrfs_path *path;
> +	struct btrfs_fs_info *fs_info = sdev->dev->dev_root->fs_info;
> +	struct btrfs_root *root = fs_info->extent_root;
> +	struct btrfs_root *csum_root = fs_info->csum_root;
> +	struct btrfs_extent_item *extent;
> +	u64 flags;
> +	int ret;
> +	int slot;
> +	int i;
> +	int nstripes;

It should be u64 nstripes.  A few lines below you assign the stripe
length, it is a 64 bit quantity, also do_div() expects a 64 bit
dividend.  This fixes a serious breakage on x86-32.

Overall, this function could use a good cleanup.  I can send you a patch
later unless you want to do it yourself.

> +	int start_stripe;
> +	struct extent_buffer *l;
> +	struct btrfs_key key;
> +	u64 physical;
> +	u64 logical;
> +	u64 generation;
> +	u64 mirror_num;

And a minor thing on the whole series: u64 should be printed with %llu
and explicit casting to unsigned long long.

Thanks,

		Ilya

> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-12 14:50 [PATCH v3 0/6] btrfs: scrub Arne Jansen
2011-03-12 14:50 ` [PATCH v3 1/6] btrfs: add parameter to btrfs_lookup_csum_range Arne Jansen
2011-03-12 14:50 ` [PATCH v3 2/6] btrfs: make struct map_lookup public Arne Jansen
2011-03-12 14:50 ` [PATCH v3 3/6] btrfs: add scrub code and prototypes Arne Jansen
2011-03-13 23:50   ` Ilya Dryomov [this message]
2011-03-14  9:57     ` Arne Jansen
2011-03-16 14:35   ` Ilya Dryomov
2011-03-16 14:54     ` Ilya Dryomov
2011-03-16 22:07   ` Andi Kleen
2011-03-16 23:10     ` Arne Jansen
2011-03-17 19:02       ` Arne Jansen
2011-03-12 14:50 ` [PATCH v3 4/6] btrfs: sync scrub with commit & device removal Arne Jansen
2011-03-12 14:50 ` [PATCH v3 5/6] btrfs: add state information for scrub Arne Jansen
2011-03-12 14:50 ` [PATCH v3 6/6] btrfs: new ioctls " Arne Jansen

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=20110313235031.GA32690@kwango.lan.net \
    --to=idryomov@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sensille@gmx.net \
    /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.