Skip to contentSkip to conversation

scatterlist fallout: drivers/scsi/arm/

PATCH In review Al Viro 4 participants 9 messages Oct 27, 2007 – Oct 29, 2007

Subsystems (4)
lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 scatterlist fallout: drivers/scsi/arm/

---

drivers/scsi/arm/scsi.h +2 -2
index 21ba571..2d09fef 100644
@@ -39,7 +39,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
 		SCp->buffer++;
 		SCp->buffers_residual--;
 		SCp->ptr = (char *)
-			 (page_address(SCp->buffer->page) +
+			 (page_address(sg_page(SCp->buffer)) +
 			  SCp->buffer->offset);
 		SCp->this_residual = SCp->buffer->length;
 	} else {
@@ -77,7 +77,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 		SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
 		SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
 		SCpnt->SCp.ptr = (char *)
-			 (page_address(SCpnt->SCp.buffer->page) +
+			 (page_address(sg_page(SCpnt->SCp.buffer)) +
 			  SCpnt->SCp.buffer->offset);
 		SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
 		SCpnt->SCp.phase = SCpnt->request_bufflen;
#1 lore raw

Already have this one queued for Linus in my tree.

Quoted 25 lines · Al Viro

---

drivers/scsi/arm/scsi.h +2 -2
index 21ba571..2d09fef 100644
@@ -39,7 +39,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
 		SCp->buffer++;
 		SCp->buffers_residual--;
 		SCp->ptr = (char *)
-			 (page_address(SCp->buffer->page) +
+			 (page_address(sg_page(SCp->buffer)) +
 			  SCp->buffer->offset);
 		SCp->this_residual = SCp->buffer->length;
 	} else {
@@ -77,7 +77,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 		SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
 		SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
 		SCpnt->SCp.ptr = (char *)
-			 (page_address(SCpnt->SCp.buffer->page) +
+			 (page_address(sg_page(SCpnt->SCp.buffer)) +
 			  SCpnt->SCp.buffer->offset);
 		SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
 		SCpnt->SCp.phase = SCpnt->request_bufflen;
Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#2 lore raw
In reply to Al Viro
Quoted 17 lines · Al Viro

---

drivers/scsi/arm/scsi.h +1 -1
index 21ba571..2d09fef 100644
@@ -39,7 +39,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
 		SCp->buffer++;
 		SCp->buffers_residual--;
 		SCp->ptr = (char *)
-			 (page_address(SCp->buffer->page) +
+			 (page_address(sg_page(SCp->buffer)) +
 			  SCp->buffer->offset);
 		SCp->this_residual = SCp->buffer->length;
 	} else {

drivers/scsi/arm/scsi.h static inline void init_SCp(struct scsi_cmnd *SCpnt) · line 83

Quoted 8 lines
drivers/scsi/arm/scsi.h +1 -1
@@ -77,7 +77,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 		SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
 		SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
 		SCpnt->SCp.ptr = (char *)
-			 (page_address(SCpnt->SCp.buffer->page) +
+			 (page_address(sg_page(SCpnt->SCp.buffer)) +
 			  SCpnt->SCp.buffer->offset);
 		SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
 		SCpnt->SCp.phase = SCpnt->request_bufflen;

FYI, here's what I have queued (cut'n'pasted so probably won't apply):

drivers/scsi/arm/scsi.h +2 -6
index 21ba571..bb6550e 100644
@@ -38,9 +38,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
        if (ret) {
                SCp->buffer++;
                SCp->buffers_residual--;
-               SCp->ptr = (char *)
-                        (page_address(SCp->buffer->page) +
-                         SCp->buffer->offset);
+               SCp->ptr = sg_virt(SCp->buffer);
                SCp->this_residual = SCp->buffer->length;
        } else {
                SCp->ptr = NULL;
@@ -76,9 +74,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 
                SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
                SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
-               SCpnt->SCp.ptr = (char *)
-                        (page_address(SCpnt->SCp.buffer->page) +
-                         SCpnt->SCp.buffer->offset);
+               SCpnt->SCp.ptr = sg_virt(SCpnt->SCp.buffer);
                SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
                SCpnt->SCp.phase = SCpnt->request_bufflen;
 
Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#3 lore raw
Quoted 2 lines · Russell King

FYI, here's what I have queued (cut'n'pasted so probably won't apply):

Yes, much nicer.

Linus

#4 lore raw
In reply to Russell King
Quoted 45 lines · Russell King
Quoted 17 lines · Al Viro

---

drivers/scsi/arm/scsi.h +1 -1
index 21ba571..2d09fef 100644
@@ -39,7 +39,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
 		SCp->buffer++;
 		SCp->buffers_residual--;
 		SCp->ptr = (char *)
-			 (page_address(SCp->buffer->page) +
+			 (page_address(sg_page(SCp->buffer)) +
 			  SCp->buffer->offset);
 		SCp->this_residual = SCp->buffer->length;
 	} else {

drivers/scsi/arm/scsi.h static inline void init_SCp(struct scsi_cmnd *SCpnt) · line 83

Quoted 8 lines
drivers/scsi/arm/scsi.h +1 -1
@@ -77,7 +77,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 		SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
 		SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
 		SCpnt->SCp.ptr = (char *)
-			 (page_address(SCpnt->SCp.buffer->page) +
+			 (page_address(sg_page(SCpnt->SCp.buffer)) +
 			  SCpnt->SCp.buffer->offset);
 		SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
 		SCpnt->SCp.phase = SCpnt->request_bufflen;

FYI, here's what I have queued (cut'n'pasted so probably won't apply):

drivers/scsi/arm/scsi.h +1 -3
index 21ba571..bb6550e 100644
@@ -38,9 +38,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
        if (ret) {
                SCp->buffer++;
                SCp->buffers_residual--;
-               SCp->ptr = (char *)
-                        (page_address(SCp->buffer->page) +
-                         SCp->buffer->offset);
+               SCp->ptr = sg_virt(SCp->buffer);
                SCp->this_residual = SCp->buffer->length;
        } else {
                SCp->ptr = NULL;

drivers/scsi/arm/scsi.h static inline void init_SCp(struct scsi_cmnd *SCpnt) · line 79

Quoted 9 lines
drivers/scsi/arm/scsi.h +1 -3
@@ -76,9 +74,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 
                SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
                SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
-               SCpnt->SCp.ptr = (char *)
-                        (page_address(SCpnt->SCp.buffer->page) +
-                         SCpnt->SCp.buffer->offset);
+               SCpnt->SCp.ptr = sg_virt(SCpnt->SCp.buffer);
                SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
                SCpnt->SCp.phase = SCpnt->request_bufflen;

Russell, will you be merging this yourself or do you want me to include it in the sg fixup branch?

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 47 lines · Jens Axboe
Quoted 46 lines · Russell King
Quoted 17 lines · Al Viro

---

drivers/scsi/arm/scsi.h +1 -1
index 21ba571..2d09fef 100644
@@ -39,7 +39,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
 		SCp->buffer++;
 		SCp->buffers_residual--;
 		SCp->ptr = (char *)
-			 (page_address(SCp->buffer->page) +
+			 (page_address(sg_page(SCp->buffer)) +
 			  SCp->buffer->offset);
 		SCp->this_residual = SCp->buffer->length;
 	} else {

drivers/scsi/arm/scsi.h static inline void init_SCp(struct scsi_cmnd *SCpnt) · line 83

Quoted 8 lines
drivers/scsi/arm/scsi.h +1 -1
@@ -77,7 +77,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 		SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
 		SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
 		SCpnt->SCp.ptr = (char *)
-			 (page_address(SCpnt->SCp.buffer->page) +
+			 (page_address(sg_page(SCpnt->SCp.buffer)) +
 			  SCpnt->SCp.buffer->offset);
 		SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
 		SCpnt->SCp.phase = SCpnt->request_bufflen;

FYI, here's what I have queued (cut'n'pasted so probably won't apply):

drivers/scsi/arm/scsi.h +1 -3
index 21ba571..bb6550e 100644
@@ -38,9 +38,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
        if (ret) {
                SCp->buffer++;
                SCp->buffers_residual--;
-               SCp->ptr = (char *)
-                        (page_address(SCp->buffer->page) +
-                         SCp->buffer->offset);
+               SCp->ptr = sg_virt(SCp->buffer);
                SCp->this_residual = SCp->buffer->length;
        } else {
                SCp->ptr = NULL;
@@ -76,9 +74,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 
Quoted 11 lines

drivers/scsi/arm/scsi.h static inline void init_SCp(struct scsi_cmnd *SCpnt) · line 79

Quoted 8 lines
drivers/scsi/arm/scsi.h +1 -3
                SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
                SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
-               SCpnt->SCp.ptr = (char *)
-                        (page_address(SCpnt->SCp.buffer->page) +
-                         SCpnt->SCp.buffer->offset);
+               SCpnt->SCp.ptr = sg_virt(SCpnt->SCp.buffer);
                SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
                SCpnt->SCp.phase = SCpnt->request_bufflen;

Russell, will you be merging this yourself or do you want me to include it in the sg fixup branch?

It's already merged into the ARM git tree as of Friday. Waiting for ack's from various people for other merged patches before sending the set to Linus.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#6 lore raw
Quoted 60 lines · Russell King
Quoted 47 lines · Jens Axboe
Quoted 46 lines · Russell King
Quoted 17 lines · Al Viro

---

drivers/scsi/arm/scsi.h +1 -1
index 21ba571..2d09fef 100644
@@ -39,7 +39,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
 		SCp->buffer++;
 		SCp->buffers_residual--;
 		SCp->ptr = (char *)
-			 (page_address(SCp->buffer->page) +
+			 (page_address(sg_page(SCp->buffer)) +
 			  SCp->buffer->offset);
 		SCp->this_residual = SCp->buffer->length;
 	} else {

drivers/scsi/arm/scsi.h static inline void init_SCp(struct scsi_cmnd *SCpnt) · line 83

Quoted 8 lines
drivers/scsi/arm/scsi.h +1 -1
@@ -77,7 +77,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 		SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
 		SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
 		SCpnt->SCp.ptr = (char *)
-			 (page_address(SCpnt->SCp.buffer->page) +
+			 (page_address(sg_page(SCpnt->SCp.buffer)) +
 			  SCpnt->SCp.buffer->offset);
 		SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
 		SCpnt->SCp.phase = SCpnt->request_bufflen;

FYI, here's what I have queued (cut'n'pasted so probably won't apply):

drivers/scsi/arm/scsi.h +1 -3
index 21ba571..bb6550e 100644
@@ -38,9 +38,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
        if (ret) {
                SCp->buffer++;
                SCp->buffers_residual--;
-               SCp->ptr = (char *)
-                        (page_address(SCp->buffer->page) +
-                         SCp->buffer->offset);
+               SCp->ptr = sg_virt(SCp->buffer);
                SCp->this_residual = SCp->buffer->length;
        } else {
                SCp->ptr = NULL;
@@ -76,9 +74,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
 
Quoted 11 lines

drivers/scsi/arm/scsi.h static inline void init_SCp(struct scsi_cmnd *SCpnt) · line 79

Quoted 8 lines
drivers/scsi/arm/scsi.h +1 -3
                SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
                SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
-               SCpnt->SCp.ptr = (char *)
-                        (page_address(SCpnt->SCp.buffer->page) +
-                         SCpnt->SCp.buffer->offset);
+               SCpnt->SCp.ptr = sg_virt(SCpnt->SCp.buffer);
                SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
                SCpnt->SCp.phase = SCpnt->request_bufflen;

Russell, will you be merging this yourself or do you want me to include it in the sg fixup branch?

Quoted 3 lines

It's already merged into the ARM git tree as of Friday. Waiting for ack's from various people for other merged patches before sending the set to Linus.

Great, thanks.

Signature · 1 line
Jens Axboe
author
#7 lore raw
Quoted 8 lines · Jens Axboe
Quoted 6 lines
Quoted 2 lines

Russell, will you be merging this yourself or do you want me to include it in the sg fixup branch?

It's already merged into the ARM git tree as of Friday. Waiting for ack's from various people for other merged patches before sending the set to Linus.

Great, thanks.

Speaking of sg fixups... What should be done about zfcp_address_to_sg()? You've added the third argument to all calls, but not to definition...

static inline void
zfcp_address_to_sg(void *address, struct scatterlist *list, size_t size)

{
	sg_set_buf(list, address, size);
}

seems to be a plausible guess at what you meant to do, but that's a guess without anything to back it - I really have not looked into the area at all.

#8 lore raw
Quoted 13 lines · Al Viro
Quoted 8 lines · Jens Axboe
Quoted 6 lines
Quoted 2 lines

Russell, will you be merging this yourself or do you want me to include it in the sg fixup branch?

It's already merged into the ARM git tree as of Friday. Waiting for ack's from various people for other merged patches before sending the set to Linus.

Great, thanks.

Speaking of sg fixups... What should be done about zfcp_address_to_sg()? You've added the third argument to all calls, but not to definition...

Quoted 7 lines

static inline void
zfcp_address_to_sg(void *address, struct scatterlist *list, size_t size)

{
	sg_set_buf(list, address, size);
}

seems to be a plausible guess at what you meant to do, but that's a guess without anything to back it - I really have not looked into the area at all.

Should already be fixed up in the 'sg' branch, like this:

drivers/s390/scsi/zfcp_def.h +3 -2
index 0754542..e268f79 100644
@@ -70,11 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list)
  * zfcp_address_to_sg - set up struct scatterlist from kernel address
  * @address: kernel address
  * @list: struct scatterlist
+ * @size: buffer size
  */
 static inline void
-zfcp_address_to_sg(void *address, struct scatterlist *list)
+zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)
 {
-	sg_set_buf(list, address, 0);
+	sg_set_buf(list, address, size);
 }
 
 #define REQUEST_LIST_SIZE 128
Signature · 1 line
Jens Axboe