Re: [PATCH] ata_sg_setup_one vs ata_sg_setup?

From: Boaz Harrosh
Date: Wed Nov 14 2007 - 08:07:01 EST


On Wed, Nov 14 2007 at 6:40 +0200, Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:
> Hi Jeff,
>
> Was looking through libata, and it seems to me that ata_sg_setup is a
> superset of ata_sg_setup_one. Am I missing something? Seems like it could
> be simplified.
>
> My machine never seems to do an ata_sg_setup_one, so this patch isn't really
> tested...
>
It's not only your machine, it's every ones machines. Since 2.6.18.
But in 2.6.24 the last code user of ata_sg_setup_one was also removed
from libata-scsi.c :
(http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e10b8c3f5f23188e065b1845ba732570eca007fe)
Please see in above commit's comment about this issue.

> Thanks,
> Rusty.
> ---
> Subject: libata: fold ata_queued_cmd single and sg logic
>
> libata separates the single buffer case from the scatterlist case
> internally. It's not clear that this is necessary.
>
> Remove the ATA_QCFLAG_SINGLE flag, and buf_virt pointer, and always
> initialize qc->nbytes in ata_sg_init().
>
> It's possible that the ATA_QCFLAG_SG and ATA_QCFLAG_DMAMAP flags could
> be entirely removed, and we could use whether qc->__sg is NULL or not.
>
Yes these flags can be removed and you will find that qc->__sg will
never be NULL, unless it is a DMA_NONE command.

> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
>
> diff -r 8b1075c7ad47 drivers/ata/libata-core.c
> --- a/drivers/ata/libata-core.c Tue Nov 13 21:00:47 2007 +1100
> +++ b/drivers/ata/libata-core.c Wed Nov 14 15:31:07 2007 +1100
> @@ -1648,16 +1648,8 @@ unsigned ata_exec_internal_sg(struct ata
<snip>

Thanks for doing this.

Boaz
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/