diff options
| author | Andrew Morton <akpm@digeo.com> | 2003-04-20 00:29:12 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-20 00:29:12 -0700 |
| commit | 5fb58500eec7e5afab139a6b3825c55fbbeff48c (patch) | |
| tree | 2d5274d558729b4d8cb3842f58d310ad6a5c728a /include/linux | |
| parent | 88bdd4c3d1faed465755e2b0f5b9c34352693ac5 (diff) | |
[PATCH] Allocate hd_structs dynamically
From: Badari Pulavarty <pbadari@us.ibm.com>
Here is the patch to allocate hd_struct dynamically as we find
partitions.
There are 3 things I didn't like in the patch.
1) The patch allocates 15 pointers instead of 15 hd_structs. (incase of
s= csi). I was really hoping to get rid of "15" and make it really
dynamic. (In ca= se if we ever want to support more than 15 partitions
per disk etc..).=20 I was thought about making it a linked list, but
blk_partition_remap() needs to get to hd_struct for a given partition
everytime we do IO. So linked list would be bad, we really need direct
access to partition in= fo.
2) I had to add "partno" to hd_struct, since part_dev_read() used to calc=
ulate partition number from the address before.
3) kmalloc() failure in add_partition() will be silently ignored.
It saves 2048 bytes per disk.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/genhd.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index c2432bd349e5..ac8fc9ef5bdb 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -64,7 +64,7 @@ struct hd_struct { sector_t nr_sects; struct kobject kobj; unsigned reads, read_sectors, writes, write_sectors; - int policy; + int policy, partno; }; #define GENHD_FL_REMOVABLE 1 @@ -89,7 +89,7 @@ struct gendisk { int minor_shift; /* number of times minor is shifted to get real minor */ char disk_name[16]; /* name of major driver */ - struct hd_struct *part; /* [indexed by minor] */ + struct hd_struct **part; /* [indexed by minor] */ struct block_device_operations *fops; struct request_queue *queue; void *private_data; |
