]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] st: add struct rq_map_data support
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Thu, 18 Dec 2008 05:49:40 +0000 (14:49 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 2 Jan 2009 17:54:23 +0000 (11:54 -0600)
This adds struct rq_map_data and the array of pointers to store
fragment buffers to struct st_buffer.

This patch doesn't remove st_buf_fragment but the latter patch does.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/st.c
drivers/scsi/st.h

index 3984cd82fe10c682d1859a1c7d390b9dfa6f22df..9d9e4b90f23b34e1a6559cb8f8778411f482267d 100644 (file)
@@ -3723,6 +3723,12 @@ static struct st_buffer *
        tb->buffer_size = got;
        sg_init_table(tb->sg, max_sg);
 
+       tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *), priority);
+       if (!tb->reserved_pages) {
+               kfree(tb);
+               return NULL;
+       }
+
        return tb;
 }
 
@@ -3771,9 +3777,11 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
                STbuffer->buffer_size = got;
                if (STbuffer->cleared)
                        memset(page_address(STbuffer->frp[segs].page), 0, b_size);
+               STbuffer->reserved_pages[segs] = STbuffer->frp[segs].page;
                segs++;
        }
        STbuffer->b_data = page_address(STbuffer->frp[0].page);
+       STbuffer->map_data.page_order = order;
 
        return 1;
 }
@@ -3803,6 +3811,8 @@ static void normalize_buffer(struct st_buffer * STbuffer)
        STbuffer->frp_segs = STbuffer->orig_frp_segs;
        STbuffer->frp_sg_current = 0;
        STbuffer->sg_segs = 0;
+       STbuffer->map_data.page_order = 0;
+       STbuffer->map_data.offset = 0;
 }
 
 
@@ -4282,6 +4292,7 @@ static void scsi_tape_release(struct kref *kref)
        if (tpnt->buffer) {
                tpnt->buffer->orig_frp_segs = 0;
                normalize_buffer(tpnt->buffer);
+               kfree(tpnt->buffer->reserved_pages);
                kfree(tpnt->buffer);
        }
 
index b92712f959315ddf23c4cc134da9703f13029763..74748abe82463c0a138ac742f33256bae6bbacc3 100644 (file)
@@ -44,6 +44,8 @@ struct st_buffer {
        int syscall_result;
        struct st_request *last_SRpnt;
        struct st_cmdstatus cmdstat;
+       struct page **reserved_pages;
+       struct rq_map_data map_data;
        unsigned char *b_data;
        unsigned short use_sg;  /* zero or max number of s/g segments for this adapter */
        unsigned short sg_segs;         /* number of segments in s/g list */