linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Clements <Paul.Clements@SteelEye.com>
To: Neil Brown <neilb@cse.unsw.edu.au>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] md: fix device size calculation with non-persistent superblock
Date: Mon, 23 Feb 2004 11:57:29 -0500	[thread overview]
Message-ID: <403A30F9.D54AAC68@SteelEye.com> (raw)
In-Reply-To: 16441.33071.218049.163976@notabene.cse.unsw.edu.au

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

Neil,

Currently, the device size calculation is not correct when hot-adding
devices to arrays with non-persistent superblocks. Device size is always
calculated as if there were a physical superblock on every device. The
attached simple change to hot_add_disk() fixes the problem.

Thanks,
Paul

[-- Attachment #2: md_nonpersistent_sb_fix.diff --]
[-- Type: text/x-patch, Size: 495 bytes --]

--- 2_6_3_rc2/drivers/md/md.c.PRISTINE	Mon Feb 23 11:01:57 2004
+++ 2_6_3_rc2/drivers/md/md.c	Mon Feb 23 11:29:10 2004
@@ -2365,7 +2365,12 @@ static int hot_add_disk(mddev_t * mddev,
 		return -EINVAL;
 	}
 
-	rdev->sb_offset = calc_dev_sboffset(rdev->bdev);
+	if (mddev->persistent)
+		rdev->sb_offset = calc_dev_sboffset(rdev->bdev);
+	else
+		rdev->sb_offset = rdev->bdev->bd_inode->i_size
+							>> BLOCK_SIZE_BITS;
+
 	size = calc_dev_size(rdev, mddev->chunk_size);
 	rdev->size = size;
 

  parent reply	other threads:[~2004-02-23 16:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-23  2:41 SW RAID5 + high memory support freezes 2.6.3 kernel Pavol Luptak
2004-02-23  4:27 ` Neil Brown
2004-02-23  5:30   ` Andrew Morton
2004-02-23 13:35     ` Pavol Luptak
2004-02-23 14:05       ` syrius.ml
2004-02-23 16:57   ` Paul Clements [this message]
2004-02-24  1:13     ` [PATCH] md: fix device size calculation with non-persistent superblock Neil Brown
2004-02-24 15:27       ` Paul Clements
2004-02-25 21:39     ` [PATCH] raid1: abort resync if there are no spare drives Paul Clements
2004-03-03  0:21       ` Neil Brown
2004-03-03  2:47         ` Paul Clements

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=403A30F9.D54AAC68@SteelEye.com \
    --to=paul.clements@steeleye.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    /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).