• Andrew Morton's avatar
    [PATCH] Allocate hd_structs dynamically · 5fb58500
    Andrew Morton authored
    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.
    5fb58500
cciss.c 75.3 KB