Skip to contentSkip to conversation

libata: Initialize nbytes for internal sg commands

PATCH In review Brian King 2 participants 5 messages Jan 17, 2007 – Jan 22, 2007 1 message not in the archive libata

lore
Share & tools
lore

Brian King

author
#1 lore raw

PATCH 2/3 libata: Initialize nbytes for internal sg commands

In reply to a message not in the archive

Some LLDDs, like ipr, use nbytes and pad_len to determine the total data transfer length of a command. Make sure nbytes gets initialized for internally generated commands.

---

 linux-2.6-bjking1/drivers/ata/libata-core.c |    1 +
 1 files changed, 1 insertion(+)
drivers/ata/libata-core.c renamed from drivers/ata/libata-core.c~libata_fix_nbytes +1 -0
diff -puN drivers/ata/libata-core.c~libata_fix_nbytes drivers/ata/libata-core.c
@@ -1250,6 +1250,7 @@ unsigned ata_exec_internal_sg(struct ata
 
 		ata_sg_init(qc, sg, n_elem);
 		qc->nsect = buflen / ATA_SECT_SIZE;
+		qc->nbytes = buflen;
 	}
 
 	qc->private_data = &wait;

_

author
#5 lore raw

PATCH 3/3 libata: Initialize qc->pad_len

In reply to a message not in the archive

Initialize qc->pad_len for each new command. This ensures that pad_len is not set to a stale value for zero data length commands.

---

 linux-2.6-bjking1/include/linux/libata.h |    1 +
 1 files changed, 1 insertion(+)
include/linux/libata.h renamed from include/linux/libata.h~libata_init_pad_len +1 -0
diff -puN include/linux/libata.h~libata_init_pad_len include/linux/libata.h
@@ -1151,6 +1151,7 @@ static inline void ata_qc_reinit(struct 
 	qc->nbytes = qc->curbytes = 0;
 	qc->n_elem = 0;
 	qc->err_mask = 0;
+	qc->pad_len = 0;
 
 	ata_tf_init(qc->dev, &qc->tf);
 

_

author
#3 lore raw
Quoted 8 lines · Tejun Heo
Quoted 3 lines · Brian King

Some LLDDs, like ipr, use nbytes and pad_len to determine the total data transfer length of a command. Make sure nbytes gets initialized for internally generated commands.

I think it's better to apply the following patch instead of this one.

http://article.gmane.org/gmane.linux.ide/14792

Works for me. I loaded that patch in place of this one and verified it solved my problem as well. I still need the other two patches in this series, however.

Thanks,

Brian

Signature · 3 lines
Brian King
eServer Storage I/O
IBM Linux Technology Center
author
#4 lore raw
Quoted 5 lines · Brian King
Quoted 4 lines · Tejun Heo
Quoted 3 lines · Brian King

Some LLDDs, like ipr, use nbytes and pad_len to determine the total data transfer length of a command. Make sure nbytes gets initialized for internally generated commands.

Quoted 7 lines
Quoted 3 lines

I think it's better to apply the following patch instead of this one.

http://article.gmane.org/gmane.linux.ide/14792

Works for me. I loaded that patch in place of this one and verified it solved my problem as well. I still need the other two patches in this series, however.

Jeff,

Do you plan to pull this patch series into upstream-fixes? Without these three patches (or 1 & 3 plus Tejun's patch referenced above), ipr SATA is broken in 2.6.20.

Thanks,

Brian

Signature · 3 lines
Brian King
eServer Storage I/O
IBM Linux Technology Center