From: Tejun Heo <tj@kernel.org>
To: jeff@garzik.org, linux-ide@vger.kernel.org,
James.Bottomley@HansenPartnership.com, bharrosh@panasas.com,
greg.freemyer@gmail.com, linux-scsi@vger.kernel.org,
brking@linux.vnet.ibm.com
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 1/6] block: misc updates
Date: Thu, 3 Jul 2008 17:33:01 +0900 [thread overview]
Message-ID: <1215073986-4709-2-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1215073986-4709-1-git-send-email-tj@kernel.org>
This patch makes the following misc updates in preparation for
extended block devt support.
* make add_partition report on failrues
* add hd_struct->disk which points to the containing gendisk
* fix comment for gendisk->part
Signed-off-by: Tejun Heo <tj@kernel.org>
---
fs/partitions/check.c | 11 ++++++++++-
include/linux/genhd.h | 3 ++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 6149e4b..b915ac2 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -346,19 +346,28 @@ static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH,
void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
{
+ char name[BDEVNAME_SIZE];
struct hd_struct *p;
int err;
+ disk_name(disk, part, name);
+
p = kzalloc(sizeof(*p), GFP_KERNEL);
- if (!p)
+ if (!p) {
+ printk(KERN_WARNING "%s: failed to allocate partition "
+ "structure (part=%d)\n", name, part);
return;
+ }
if (!init_part_stats(p)) {
+ printk(KERN_WARNING "%s: failed to initialize partition stats "
+ "structure (part=%d)\n", name, part);
kfree(p);
return;
}
p->start_sect = start;
p->nr_sects = len;
+ p->disk = disk;
p->partno = part;
p->policy = disk->policy;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index ae7aec3..1f06681 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -88,6 +88,7 @@ struct hd_struct {
sector_t start_sect;
sector_t nr_sects;
struct device dev;
+ struct gendisk *disk;
struct kobject *holder_dir;
int policy, partno;
#ifdef CONFIG_FAIL_MAKE_REQUEST
@@ -117,7 +118,7 @@ struct gendisk {
int minors; /* maximum number of minors, =1 for
* disks that can't be partitioned. */
char disk_name[32]; /* name of major driver */
- struct hd_struct **part; /* [indexed by minor] */
+ struct hd_struct **part; /* [indexed by minor - 1] */
struct block_device_operations *fops;
struct request_queue *queue;
void *private_data;
--
1.5.4.5
next prev parent reply other threads:[~2008-07-03 8:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-03 8:33 [PATCHSET 2.6.26-rc8] block: implement extended devt Tejun Heo
2008-07-03 8:33 ` Tejun Heo [this message]
2008-07-03 8:33 ` [PATCH 2/6] block: don't depend on consecutive minor space Tejun Heo
2008-07-03 8:33 ` [PATCH 3/6] block: implement extended minors Tejun Heo
2008-07-03 8:33 ` [PATCH 4/6] block: adjust formatting for large minors and add ext_range sysfs attr Tejun Heo
2008-07-03 8:33 ` [PATCH 5/6] sd/ide-disk: apply extended minors to sd and ide Tejun Heo
2008-07-03 8:33 ` [PATCH 6/6] block: implement CONFIG_DEBUG_BLOCK_EXT_DEVT Tejun Heo
2008-07-03 13:28 ` [PATCHSET 2.6.26-rc8] block: implement extended devt Matthew Wilcox
2008-07-03 15:54 ` Tejun Heo
2008-07-06 14:37 ` Tejun Heo
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=1215073986-4709-2-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bharrosh@panasas.com \
--cc=brking@linux.vnet.ibm.com \
--cc=greg.freemyer@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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).