All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Webb <chris@arachsys.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: Trouble increasing md component size
Date: Fri, 20 Jun 2008 00:49:14 +0100	[thread overview]
Message-ID: <20080619234914.GA24881@arachsys.com> (raw)
In-Reply-To: <20080619154520.GB3708@arachsys.com>

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

Chris Webb <chris@arachsys.com> writes:

> However, I'm not sure what the correct call to get the superblock written
> out at this point would be. I tried
> 
>   md_super_write(rdev->mddev, rdev, rdev->sb_offset << 1, rdev->sb_size,
>                  rdev->sb_page);
> 
> after updating sb->data_size as above, but that doesn't seem to do the right
> thing.

It works without the typo!

> +			((struct mdp_superblock_1 *) sb)->data_size = cpu_to_le64(rdev->size*2);

should read size*2 rather than rdev->size*2.

Cheers,

Chris.

[-- Attachment #2: linux-2.6.24.4-md-rdev-size.patch --]
[-- Type: text/plain, Size: 1125 bytes --]

--- linux-2.6.24.4/drivers/md/md.c	2008-03-24 18:49:18.000000000 +0000
+++ linux-2.6.24.4-mdplay/drivers/md/md.c	2008-06-20 00:44:50.000000000 +0100
@@ -1946,8 +1946,20 @@ rdev_size_store(mdk_rdev_t *rdev, const 
 	unsigned long long size = simple_strtoull(buf, &e, 10);
 	if (e==buf || (*e && *e != '\n'))
 		return -EINVAL;
-	if (rdev->mddev->pers)
-		return -EBUSY;
+	if (rdev->mddev->pers) {
+		mdp_super_t *sb;
+		if (rdev->sb_offset > rdev->data_offset/2) {
+			if (!size || size > rdev->sb_offset - rdev->data_offset/2)
+				size = rdev->sb_offset - rdev->data_offset/2;
+		} else if (!size || 2*size + rdev->data_offset > rdev->bdev->bd_inode->i_size >> 9)
+			size = ((rdev->bdev->bd_inode->i_size >> 9) - rdev->data_offset)/2;
+		sb = (mdp_super_t *) page_address(rdev->sb_page);
+		if (sb->major_version == 1) {
+			((struct mdp_superblock_1 *) sb)->data_size = cpu_to_le64(size*2);
+			md_super_write(rdev->mddev, rdev, rdev->sb_offset << 1, rdev->sb_size,
+					                 rdev->sb_page);
+		}
+	}
 	rdev->size = size;
 	if (size < rdev->mddev->size || rdev->mddev->size == 0)
 		rdev->mddev->size = size;

  parent reply	other threads:[~2008-06-19 23:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 18:26 Trouble increasing md component size Chris Webb
2008-06-18 19:22 ` Peter Rabbitson
2008-06-18 20:00   ` Chris Webb
2008-06-19  3:42     ` Neil Brown
2008-06-19 15:45       ` Chris Webb
2008-06-19 23:10         ` Chris Webb
2008-06-19 23:49         ` Chris Webb [this message]
2008-06-20 11:13           ` Chris Webb
2008-06-20 14:24             ` Chris Webb
2008-06-23  1:26               ` Neil Brown
2008-06-23 11:18                 ` Chris Webb
2008-06-23 22:53                   ` Neil Brown
2008-06-24 11:47                     ` Chris Webb
2008-06-24 23:19                       ` Chris Webb
2008-09-17 18:11                         ` [PATCH] md: Fix rdev_size_store with size = 0 Chris Webb
2008-10-07 12:40                         ` [Resend] " Chris Webb
2008-10-13  0:54                           ` Neil Brown
2008-06-24  2:40                   ` Trouble increasing md component size Neil Brown

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=20080619234914.GA24881@arachsys.com \
    --to=chris@arachsys.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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.