Re: [PATCH 10/22] libata: use preallocated buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tejun Heo wrote:
> It's not a very good idea to allocate memory during EH.  Use
> statically allocated buffer for dev->id[] and add 512byte buffer
> ap->sector_buf.  This buffer is owned by EH (or probing) and to be
> used as temporary buffer for various purposes (IDENTIFY, NCQ log page
> 10h, PM GSCR block).
> 
> Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
> 
> <snip>
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 9c2d4bb..a117ca2 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -360,7 +360,7 @@ struct ata_device {
>  	unsigned long		flags;		/* ATA_DFLAG_xxx */
>  	unsigned int		class;		/* ATA_DEV_xxx */
>  	unsigned int		devno;		/* 0 or 1 */
> -	u16			*id;		/* IDENTIFY xxx DEVICE data */
> +	u16			id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
>  	u8			pio_mode;
>  	u8			dma_mode;
>  	u8			xfer_mode;
> @@ -425,6 +425,8 @@ struct ata_port {
>  	struct list_head	eh_done_q;
>  
>  	void			*private_data;
> +
> +	u8			sector_buf[ATA_SECT_SIZE]; /* owned by EH */
>  };
>  
>  struct ata_port_operations {

Reorder ata_host_set->private_data and ata_port->private_data.

Signed-off-by: Albert Lee <albertcc@xxxxxxxxxx>
---
Just a minor fix.
Maybe we can make the ->private_data the last one for easier allocation.

--- upstream/include/linux/libata.h	2006-05-16 11:08:54.000000000 +0800
+++ upstream1/include/linux/libata.h	2006-05-17 13:25:24.000000000 +0800
@@ -330,12 +330,12 @@ struct ata_host_set {
 	unsigned long		irq;
 	void __iomem		*mmio_base;
 	unsigned int		n_ports;
-	void			*private_data;
 	const struct ata_port_operations *ops;
 	unsigned long		flags;
 	int			simplex_claimed;	/* Keep seperate in case we
 							   ever need to do this locked */
 	struct ata_port *	ports[0];
+	void			*private_data;
 };
 
 struct ata_queued_cmd {
@@ -492,9 +492,8 @@ struct ata_port {
 	u32			msg_enable;
 	struct list_head	eh_done_q;
 
-	void			*private_data;
-
 	u8			sector_buf[ATA_SECT_SIZE]; /* owned by EH */
+	void			*private_data;
 };
 
 struct ata_port_operations {



-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux