LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Joe Thornber <thornber@sistina.com>
To: Joe Thornber <thornber@sistina.com>
Cc: Linux Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@zip.com.au>,
	Linus Torvalds <torvalds@osdl.org>
Subject: [Patch 1/5] dm: fix block device resizing
Date: Tue, 25 Nov 2003 16:30:05 +0000	[thread overview]
Message-ID: <20031125163005.GB524@reti> (raw)
In-Reply-To: <20031125162451.GA524@reti>

When setting the size of a Device-Mapper device in the gendisk entry,
also try to set the size of the corresponding block_device entry's
inode. This is necessary to allow online device/filesystem resizing to
work correctly.  [Kevin Corry]
--- diff/drivers/md/dm.c	2003-09-30 15:46:14.000000000 +0100
+++ source/drivers/md/dm.c	2003-11-25 15:36:59.000000000 +0000
@@ -666,6 +666,20 @@
 	up_write(&md->lock);
 }
 
+static void __set_size(struct gendisk *disk, sector_t size)
+{
+	struct block_device *bdev;
+
+	set_capacity(disk, size);
+	bdev = bdget_disk(disk, 0);
+	if (bdev) {
+		down(&bdev->bd_inode->i_sem);
+		i_size_write(bdev->bd_inode, size << SECTOR_SHIFT);
+		up(&bdev->bd_inode->i_sem);
+		bdput(bdev);
+	}
+}
+
 static int __bind(struct mapped_device *md, struct dm_table *t)
 {
 	request_queue_t *q = md->queue;
@@ -673,7 +687,7 @@
 	md->map = t;
 
 	size = dm_table_get_size(t);
-	set_capacity(md->disk, size);
+	__set_size(md->disk, size);
 	if (size == 0)
 		return 0;
 
@@ -692,7 +706,6 @@
 	dm_table_event_callback(md->map, NULL, NULL);
 	dm_table_put(md->map);
 	md->map = NULL;
-	set_capacity(md->disk, 0);
 }
 
 /*

  reply	other threads:[~2003-11-25 16:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-25 16:24 2.6.0-t10-dm1 Joe Thornber
2003-11-25 16:30 ` Joe Thornber [this message]
2003-11-25 16:31 ` [Patch 2/5] dm: remove dynamic table resizing Joe Thornber
2003-11-25 16:33 ` [Patch 3/5] dm: make v4 of the ioctl interface the default Joe Thornber
2003-11-25 16:47   ` Kevin P. Fleming
2003-11-25 17:05     ` Joe Thornber
2003-11-25 17:15       ` Kevin P. Fleming
2003-11-25 18:00         ` Joe Thornber
2003-11-25 17:29       ` Wichert Akkerman
2003-11-25 20:18         ` Alasdair G Kergon
2003-11-25 23:45           ` Adrian Bunk
2003-11-26 11:39             ` Joe Thornber
2003-11-25 17:09     ` Kevin Corry
2003-11-25 17:16       ` Kevin P. Fleming
2003-11-25 17:28         ` Kevin Corry
2003-11-25 17:20   ` Christoph Hellwig
2003-11-25 17:59     ` Joe Thornber
2003-11-25 16:34 ` [Patch 4/5] dm: set io restriction defaults Joe Thornber
2003-11-25 16:35 ` [Patch 5/5] dm: dm_table_event() sleep on spinlock bug Joe Thornber

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=20031125163005.GB524@reti \
    --to=thornber@sistina.com \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --subject='Re: [Patch 1/5] dm: fix block device resizing' \
    /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

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).