aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2008-04-27 09:38:33 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-27 09:38:33 -0400
commitf73850a302de45c7cb6672d0e8b103c1f122b6ae (patch)
tree8f334f79c2aa3ee906124e787e167e96c58808fe
parent41aa17069ea8d2b5cd2ca1ef7ff6cdb7c6abec95 (diff)
ide-tape: mv tape->stage_size tape->buffer_size
Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-tape.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index dc7abb25a8eb..6836d0d92d8a 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -308,7 +308,7 @@ typedef struct ide_tape_obj {
308 */ 308 */
309 309
310 /* Data buffer size chosen based on the tape's recommendation */ 310 /* Data buffer size chosen based on the tape's recommendation */
311 int stage_size; 311 int buffer_size;
312 idetape_stage_t *merge_stage; 312 idetape_stage_t *merge_stage;
313 int merge_stage_size; 313 int merge_stage_size;
314 struct idetape_bh *bh; 314 struct idetape_bh *bh;
@@ -1168,7 +1168,7 @@ static void idetape_create_read_cmd(idetape_tape_t *tape,
1168 pc->buf = NULL; 1168 pc->buf = NULL;
1169 pc->buf_size = length * tape->blk_size; 1169 pc->buf_size = length * tape->blk_size;
1170 pc->req_xfer = pc->buf_size; 1170 pc->req_xfer = pc->buf_size;
1171 if (pc->req_xfer == tape->stage_size) 1171 if (pc->req_xfer == tape->buffer_size)
1172 pc->flags |= PC_FLAG_DMA_RECOMMENDED; 1172 pc->flags |= PC_FLAG_DMA_RECOMMENDED;
1173} 1173}
1174 1174
@@ -1188,7 +1188,7 @@ static void idetape_create_write_cmd(idetape_tape_t *tape,
1188 pc->buf = NULL; 1188 pc->buf = NULL;
1189 pc->buf_size = length * tape->blk_size; 1189 pc->buf_size = length * tape->blk_size;
1190 pc->req_xfer = pc->buf_size; 1190 pc->req_xfer = pc->buf_size;
1191 if (pc->req_xfer == tape->stage_size) 1191 if (pc->req_xfer == tape->buffer_size)
1192 pc->flags |= PC_FLAG_DMA_RECOMMENDED; 1192 pc->flags |= PC_FLAG_DMA_RECOMMENDED;
1193} 1193}
1194 1194
@@ -1291,7 +1291,7 @@ out:
1291 1291
1292/* 1292/*
1293 * The function below uses __get_free_pages to allocate a data buffer of size 1293 * The function below uses __get_free_pages to allocate a data buffer of size
1294 * tape->stage_size (or a bit more). We attempt to combine sequential pages as 1294 * tape->buffer_size (or a bit more). We attempt to combine sequential pages as
1295 * much as possible. 1295 * much as possible.
1296 * 1296 *
1297 * It returns a pointer to the newly allocated buffer, or NULL in case of 1297 * It returns a pointer to the newly allocated buffer, or NULL in case of
@@ -1792,9 +1792,9 @@ static void idetape_empty_write_pipeline(ide_drive_t *drive)
1792 " but we are not writing.\n"); 1792 " but we are not writing.\n");
1793 return; 1793 return;
1794 } 1794 }
1795 if (tape->merge_stage_size > tape->stage_size) { 1795 if (tape->merge_stage_size > tape->buffer_size) {
1796 printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n"); 1796 printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n");
1797 tape->merge_stage_size = tape->stage_size; 1797 tape->merge_stage_size = tape->buffer_size;
1798 } 1798 }
1799 if (tape->merge_stage_size) { 1799 if (tape->merge_stage_size) {
1800 blocks = tape->merge_stage_size / tape->blk_size; 1800 blocks = tape->merge_stage_size / tape->blk_size;
@@ -1905,7 +1905,7 @@ static void idetape_pad_zeros(ide_drive_t *drive, int bcount)
1905 unsigned int count; 1905 unsigned int count;
1906 1906
1907 bh = tape->merge_stage->bh; 1907 bh = tape->merge_stage->bh;
1908 count = min(tape->stage_size, bcount); 1908 count = min(tape->buffer_size, bcount);
1909 bcount -= count; 1909 bcount -= count;
1910 blocks = count / tape->blk_size; 1910 blocks = count / tape->blk_size;
1911 while (count) { 1911 while (count) {
@@ -2074,7 +2074,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
2074 tape->merge_stage_size -= actually_read; 2074 tape->merge_stage_size -= actually_read;
2075 count -= actually_read; 2075 count -= actually_read;
2076 } 2076 }
2077 while (count >= tape->stage_size) { 2077 while (count >= tape->buffer_size) {
2078 bytes_read = idetape_add_chrdev_read_request(drive, ctl); 2078 bytes_read = idetape_add_chrdev_read_request(drive, ctl);
2079 if (bytes_read <= 0) 2079 if (bytes_read <= 0)
2080 goto finish; 2080 goto finish;
@@ -2156,12 +2156,12 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf,
2156 if (count == 0) 2156 if (count == 0)
2157 return (0); 2157 return (0);
2158 if (tape->merge_stage_size) { 2158 if (tape->merge_stage_size) {
2159 if (tape->merge_stage_size >= tape->stage_size) { 2159 if (tape->merge_stage_size >= tape->buffer_size) {
2160 printk(KERN_ERR "ide-tape: bug: merge buf too big\n"); 2160 printk(KERN_ERR "ide-tape: bug: merge buf too big\n");
2161 tape->merge_stage_size = 0; 2161 tape->merge_stage_size = 0;
2162 } 2162 }
2163 actually_written = min((unsigned int) 2163 actually_written = min((unsigned int)
2164 (tape->stage_size - tape->merge_stage_size), 2164 (tape->buffer_size - tape->merge_stage_size),
2165 (unsigned int)count); 2165 (unsigned int)count);
2166 if (idetape_copy_stage_from_user(tape, buf, actually_written)) 2166 if (idetape_copy_stage_from_user(tape, buf, actually_written))
2167 ret = -EFAULT; 2167 ret = -EFAULT;
@@ -2169,7 +2169,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf,
2169 tape->merge_stage_size += actually_written; 2169 tape->merge_stage_size += actually_written;
2170 count -= actually_written; 2170 count -= actually_written;
2171 2171
2172 if (tape->merge_stage_size == tape->stage_size) { 2172 if (tape->merge_stage_size == tape->buffer_size) {
2173 ssize_t retval; 2173 ssize_t retval;
2174 tape->merge_stage_size = 0; 2174 tape->merge_stage_size = 0;
2175 retval = idetape_add_chrdev_write_request(drive, ctl); 2175 retval = idetape_add_chrdev_write_request(drive, ctl);
@@ -2177,14 +2177,14 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf,
2177 return (retval); 2177 return (retval);
2178 } 2178 }
2179 } 2179 }
2180 while (count >= tape->stage_size) { 2180 while (count >= tape->buffer_size) {
2181 ssize_t retval; 2181 ssize_t retval;
2182 if (idetape_copy_stage_from_user(tape, buf, tape->stage_size)) 2182 if (idetape_copy_stage_from_user(tape, buf, tape->buffer_size))
2183 ret = -EFAULT; 2183 ret = -EFAULT;
2184 buf += tape->stage_size; 2184 buf += tape->buffer_size;
2185 count -= tape->stage_size; 2185 count -= tape->buffer_size;
2186 retval = idetape_add_chrdev_write_request(drive, ctl); 2186 retval = idetape_add_chrdev_write_request(drive, ctl);
2187 actually_written += tape->stage_size; 2187 actually_written += tape->buffer_size;
2188 if (retval <= 0) 2188 if (retval <= 0)
2189 return (retval); 2189 return (retval);
2190 } 2190 }
@@ -2678,8 +2678,8 @@ static void idetape_add_settings(ide_drive_t *drive)
2678 1, 2, (u16 *)&tape->caps[16], NULL); 2678 1, 2, (u16 *)&tape->caps[16], NULL);
2679 ide_add_setting(drive, "speed", SETTING_READ, TYPE_SHORT, 0, 0xffff, 2679 ide_add_setting(drive, "speed", SETTING_READ, TYPE_SHORT, 0, 0xffff,
2680 1, 1, (u16 *)&tape->caps[14], NULL); 2680 1, 1, (u16 *)&tape->caps[14], NULL);
2681 ide_add_setting(drive, "stage", SETTING_READ, TYPE_INT, 0, 0xffff, 1, 2681 ide_add_setting(drive, "buffer_size", SETTING_READ, TYPE_INT, 0, 0xffff,
2682 1024, &tape->stage_size, NULL); 2682 1, 1024, &tape->buffer_size, NULL);
2683 ide_add_setting(drive, "tdsc", SETTING_RW, TYPE_INT, IDETAPE_DSC_RW_MIN, 2683 ide_add_setting(drive, "tdsc", SETTING_RW, TYPE_INT, IDETAPE_DSC_RW_MIN,
2684 IDETAPE_DSC_RW_MAX, 1000, HZ, &tape->best_dsc_rw_freq, 2684 IDETAPE_DSC_RW_MAX, 1000, HZ, &tape->best_dsc_rw_freq,
2685 NULL); 2685 NULL);
@@ -2709,7 +2709,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
2709{ 2709{
2710 unsigned long t; 2710 unsigned long t;
2711 int speed; 2711 int speed;
2712 int stage_size; 2712 int buffer_size;
2713 u8 gcw[2]; 2713 u8 gcw[2];
2714 u16 *ctl = (u16 *)&tape->caps[12]; 2714 u16 *ctl = (u16 *)&tape->caps[12];
2715 2715
@@ -2739,23 +2739,23 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
2739 idetape_get_mode_sense_results(drive); 2739 idetape_get_mode_sense_results(drive);
2740 ide_tape_get_bsize_from_bdesc(drive); 2740 ide_tape_get_bsize_from_bdesc(drive);
2741 tape->user_bs_factor = 1; 2741 tape->user_bs_factor = 1;
2742 tape->stage_size = *ctl * tape->blk_size; 2742 tape->buffer_size = *ctl * tape->blk_size;
2743 while (tape->stage_size > 0xffff) { 2743 while (tape->buffer_size > 0xffff) {
2744 printk(KERN_NOTICE "ide-tape: decreasing stage size\n"); 2744 printk(KERN_NOTICE "ide-tape: decreasing stage size\n");
2745 *ctl /= 2; 2745 *ctl /= 2;
2746 tape->stage_size = *ctl * tape->blk_size; 2746 tape->buffer_size = *ctl * tape->blk_size;
2747 } 2747 }
2748 stage_size = tape->stage_size; 2748 buffer_size = tape->buffer_size;
2749 tape->pages_per_stage = stage_size / PAGE_SIZE; 2749 tape->pages_per_stage = buffer_size / PAGE_SIZE;
2750 if (stage_size % PAGE_SIZE) { 2750 if (buffer_size % PAGE_SIZE) {
2751 tape->pages_per_stage++; 2751 tape->pages_per_stage++;
2752 tape->excess_bh_size = PAGE_SIZE - stage_size % PAGE_SIZE; 2752 tape->excess_bh_size = PAGE_SIZE - buffer_size % PAGE_SIZE;
2753 } 2753 }
2754 2754
2755 /* select the "best" DSC read/write polling freq */ 2755 /* select the "best" DSC read/write polling freq */
2756 speed = max(*(u16 *)&tape->caps[14], *(u16 *)&tape->caps[8]); 2756 speed = max(*(u16 *)&tape->caps[14], *(u16 *)&tape->caps[8]);
2757 2757
2758 t = (IDETAPE_FIFO_THRESHOLD * tape->stage_size * HZ) / (speed * 1000); 2758 t = (IDETAPE_FIFO_THRESHOLD * tape->buffer_size * HZ) / (speed * 1000);
2759 2759
2760 /* 2760 /*
2761 * Ensure that the number we got makes sense; limit it within 2761 * Ensure that the number we got makes sense; limit it within
@@ -2767,8 +2767,8 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
2767 printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " 2767 printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, "
2768 "%lums tDSC%s\n", 2768 "%lums tDSC%s\n",
2769 drive->name, tape->name, *(u16 *)&tape->caps[14], 2769 drive->name, tape->name, *(u16 *)&tape->caps[14],
2770 (*(u16 *)&tape->caps[16] * 512) / tape->stage_size, 2770 (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size,
2771 tape->stage_size / 1024, 2771 tape->buffer_size / 1024,
2772 tape->best_dsc_rw_freq * 1000 / HZ, 2772 tape->best_dsc_rw_freq * 1000 / HZ,
2773 drive->using_dma ? ", DMA":""); 2773 drive->using_dma ? ", DMA":"");
2774 2774