All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	"Martin K. Petersen" <mkp@mkp.net>, Matthew Wilcox <willy@wil.cx>
Subject: Re: [PATCH] libata: add TRIM support
Date: Mon, 16 Nov 2009 22:34:36 -0500	[thread overview]
Message-ID: <4B0219CC.2060401@pobox.com> (raw)
In-Reply-To: <20091116154343.GA6672@infradead.org>



Overall, OK.

Needs minor revisions, including one bug fix (tf->device stomping).


> +static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
> +{
> +	u32 min_io_sectors;
> +
> +	rbuf[1] = 0xb0;
> +	rbuf[3] = 0x3c;		/* required VPD size with unmap support */
> +
> +	/*
> +	 * Optimal transfer length granularity.
> +	 *
> +	 * This is always one physical block, but for disks with a smaller
> +	 * logical than physical sector size we need to figure out what the
> +	 * latter is.
> +	 */
> +	min_io_sectors = 1;
> +	if ((args->id[106]&  0xc000) == 0x4000&&  (args->id[106]&  (1<<  13)))
> +		min_io_sectors *= args->id[106]&  0xf;

args->id[] access should be via ata_id_* functions from include/linux/ata.h.

Create new ata_id_* as needed.

Plus...  add some whitespace before all C operators, to be consistent 
with the rest of libata.


> +	buf = page_address(sg_page(scsi_sglist(scmd)));
> +	size = ata_set_lba_range_entries(buf, 512 / 8, block, n_block);
> +
> +	tf->protocol = ATA_PROT_DMA;
> +	tf->hob_feature = 0;
> +	tf->feature = ATA_DSM_TRIM;
> +	tf->hob_nsect = (size / 512)>>  8;

needs whitespace before op


> +	tf->nsect = size / 512;
> +	tf->hob_lbal = 0;
> +	tf->lbal = 0;
> +	tf->hob_lbam = 0;
> +	tf->lbam = 0;
> +	tf->hob_lbah = 0;
> +	tf->lbah = 0;

taskfile is pre-zeroed for you (ata_scsi_qc_new -> ata_qc_new_init -> 
ata_qc_reinit -> ata_tf_init), so zap all those zeroing lines.


> +	tf->device = ATA_LBA;

__do not__ overwrite tf->device value.  It is already assigned a useful 
value, which you just stomped.


> +	tf->device = dev->devno ?
> +		tf->device | ATA_DEV1 : tf->device&  ~ATA_DEV1;

delete this; already done in ata_tf_init()


> +	qc->sect_size = ATA_SECT_SIZE;

delete this; already done in ata_qc_reinit()


  parent reply	other threads:[~2009-11-17  3:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-16 15:43 [PATCH] libata: add TRIM support Christoph Hellwig
2009-11-16 16:07 ` Alan Cox
2009-11-16 16:19   ` Sergei Shtylyov
2009-11-17 14:30   ` Christoph Hellwig
2009-11-17  3:34 ` Jeff Garzik [this message]
2009-11-17 14:32   ` Christoph Hellwig
2009-11-17 21:59     ` Jeff Garzik
2009-11-17 14:36   ` Christoph Hellwig
2009-11-17 14:04 ` Mark Lord
2009-11-17 14:35   ` Christoph Hellwig
2009-11-17 14:52     ` Alan Cox
2009-11-17 15:00       ` Christoph Hellwig
2009-11-19  3:35         ` Mark Lord
2009-11-19 10:23           ` Alan Cox
2009-11-19 14:22             ` Mark Lord
     [not found]               ` <4B05DE00.3020707@gmail.com>
     [not found]                 ` <20091120001829.354abfc0@lxorguk.ukuu.org.uk>
     [not found]                   ` <4B05E3D1.1000904@pobox.com>
2009-11-20 12:46                     ` Alan Cox
2009-11-21  4:33                       ` Mark Lord
2009-11-21  6:09                         ` Martin K. Petersen
2009-11-22  2:39                           ` Mark Lord

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=4B0219CC.2060401@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=hch@infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@mkp.net \
    --cc=willy@wil.cx \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.