Re: [PATCH 07/22] ide-tape: struct idetape_tape_t: shorten member names v2

2008-02-04 Thread Borislav Petkov
On Tue, Feb 05, 2008 at 02:23:21AM +0100, Bartlomiej Zolnierkiewicz wrote:
> On Monday 04 February 2008, Borislav Petkov wrote:
> > Shorten some member names not too aggressively since this driver might be 
> > gone
> > anyway soon.
> > 
> > Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
> > ---
> >  drivers/ide/ide-tape.c |  210 
> > ++--
> >  1 files changed, 113 insertions(+), 97 deletions(-)
> > 
> > diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
> > index 126e8a9..0b5ccce 100644
> > --- a/drivers/ide/ide-tape.c
> > +++ b/drivers/ide/ide-tape.c
> 
> [...]
> 
> > @@ -1583,7 +1579,8 @@ static void idetape_create_read_cmd(idetape_tape_t 
> > *tape, idetape_pc_t *pc, unsi
> > pc->bh = bh;
> > atomic_set(&bh->b_count, 0);
> > pc->buffer = NULL;
> > -   pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
> > +   pc->buffer_size = length * tape->blk_size;
> > +   pc->request_transfer= length * tape->blk_size;
> > if (pc->request_transfer == tape->stage_size)
> > set_bit(PC_DMA_RECOMMENDED, &pc->flags);
> >  }
> > @@ -1621,7 +1618,8 @@ static void idetape_create_write_cmd(idetape_tape_t 
> > *tape, idetape_pc_t *pc, uns
> > pc->b_data = bh->b_data;
> > pc->b_count = atomic_read(&bh->b_count);
> > pc->buffer = NULL;
> > -   pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
> > +   pc->request_transfer= length * tape->blk_size;
> > +   pc->buffer_size = length * tape->blk_size;
> > if (pc->request_transfer == tape->stage_size)
> > set_bit(PC_DMA_RECOMMENDED, &pc->flags);
> >  }
> 
> for some reason gcc doesn't seem to optimize the new code as well as
> the old one (=> driver size goes up instead of staying unchanged)
> 
> interdiff between original patch and merged version:
> 
> diff -u b/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
> --- b/drivers/ide/ide-tape.c
> +++ b/drivers/ide/ide-tape.c
> @@ -324,7 +324,7 @@
>   /* Current character device data transfer direction */
>   u8 chrdev_dir;
>  
> - /* tape block size, usu. 512 or 1024 bytes */
> + /* tape block size, usually 512 or 1024 bytes */
>   unsigned short blk_size;
>   int user_bs_factor;
>  
> @@ -1580,8 +1580,8 @@
>   pc->bh = bh;
>   atomic_set(&bh->b_count, 0);
>   pc->buffer = NULL;
> - pc->buffer_size = length * tape->blk_size;
> - pc->request_transfer= length * tape->blk_size;
> + pc->buffer_size = length * tape->blk_size;
> + pc->request_transfer = pc->buffer_size;
>   if (pc->request_transfer == tape->stage_size)
>   set_bit(PC_DMA_RECOMMENDED, &pc->flags);
>  }
> @@ -1619,8 +1619,8 @@
>   pc->b_data = bh->b_data;
>   pc->b_count = atomic_read(&bh->b_count);
>   pc->buffer = NULL;
> - pc->request_transfer= length * tape->blk_size;
> - pc->buffer_size = length * tape->blk_size;
> + pc->buffer_size = length * tape->blk_size;
> + pc->request_transfer = pc->buffer_size;
>   if (pc->request_transfer == tape->stage_size)
>   set_bit(PC_DMA_RECOMMENDED, &pc->flags);
>  }

Yeah, i did that only because checkpatch.pl complained that multiple assignments
should be avoided. Now it looks kinda dumb that way besides improving 
readability
so converting it to the best form w.r.t generating smaller binary would be a 
reason
good enough to ignore checkpatch.pl in that case.

-- 
Regards/Gruß,
Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 07/22] ide-tape: struct idetape_tape_t: shorten member names v2

2008-02-04 Thread Bartlomiej Zolnierkiewicz
On Monday 04 February 2008, Borislav Petkov wrote:
> Shorten some member names not too aggressively since this driver might be gone
> anyway soon.
> 
> Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
> ---
>  drivers/ide/ide-tape.c |  210 
> ++--
>  1 files changed, 113 insertions(+), 97 deletions(-)
> 
> diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
> index 126e8a9..0b5ccce 100644
> --- a/drivers/ide/ide-tape.c
> +++ b/drivers/ide/ide-tape.c

[...]

> @@ -1583,7 +1579,8 @@ static void idetape_create_read_cmd(idetape_tape_t 
> *tape, idetape_pc_t *pc, unsi
>   pc->bh = bh;
>   atomic_set(&bh->b_count, 0);
>   pc->buffer = NULL;
> - pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
> + pc->buffer_size = length * tape->blk_size;
> + pc->request_transfer= length * tape->blk_size;
>   if (pc->request_transfer == tape->stage_size)
>   set_bit(PC_DMA_RECOMMENDED, &pc->flags);
>  }
> @@ -1621,7 +1618,8 @@ static void idetape_create_write_cmd(idetape_tape_t 
> *tape, idetape_pc_t *pc, uns
>   pc->b_data = bh->b_data;
>   pc->b_count = atomic_read(&bh->b_count);
>   pc->buffer = NULL;
> - pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
> + pc->request_transfer= length * tape->blk_size;
> + pc->buffer_size = length * tape->blk_size;
>   if (pc->request_transfer == tape->stage_size)
>   set_bit(PC_DMA_RECOMMENDED, &pc->flags);
>  }

for some reason gcc doesn't seem to optimize the new code as well as
the old one (=> driver size goes up instead of staying unchanged)

interdiff between original patch and merged version:

diff -u b/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- b/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -324,7 +324,7 @@
/* Current character device data transfer direction */
u8 chrdev_dir;
 
-   /* tape block size, usu. 512 or 1024 bytes */
+   /* tape block size, usually 512 or 1024 bytes */
unsigned short blk_size;
int user_bs_factor;
 
@@ -1580,8 +1580,8 @@
pc->bh = bh;
atomic_set(&bh->b_count, 0);
pc->buffer = NULL;
-   pc->buffer_size = length * tape->blk_size;
-   pc->request_transfer= length * tape->blk_size;
+   pc->buffer_size = length * tape->blk_size;
+   pc->request_transfer = pc->buffer_size;
if (pc->request_transfer == tape->stage_size)
set_bit(PC_DMA_RECOMMENDED, &pc->flags);
 }
@@ -1619,8 +1619,8 @@
pc->b_data = bh->b_data;
pc->b_count = atomic_read(&bh->b_count);
pc->buffer = NULL;
-   pc->request_transfer= length * tape->blk_size;
-   pc->buffer_size = length * tape->blk_size;
+   pc->buffer_size = length * tape->blk_size;
+   pc->request_transfer = pc->buffer_size;
if (pc->request_transfer == tape->stage_size)
set_bit(PC_DMA_RECOMMENDED, &pc->flags);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/22] ide-tape: struct idetape_tape_t: shorten member names v2

2008-02-04 Thread Borislav Petkov
Shorten some member names not too aggressively since this driver might be gone
anyway soon.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-tape.c |  210 ++--
 1 files changed, 113 insertions(+), 97 deletions(-)

diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 126e8a9..0b5ccce 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -299,10 +299,8 @@ typedef struct ide_tape_obj {
/* Timer used to poll for dsc */
struct timer_list dsc_timer;
/* Read/Write dsc polling frequency */
-   unsigned long best_dsc_rw_frequency;
-   /* The current polling frequency */
-   unsigned long dsc_polling_frequency;
-   /* Maximum waiting time */
+   unsigned long best_dsc_rw_freq;
+   unsigned long dsc_poll_freq;
unsigned long dsc_timeout;
 
/*
@@ -310,7 +308,7 @@ typedef struct ide_tape_obj {
 */
u8 partition;
/* Current block */
-   unsigned int first_frame_position;
+   unsigned int first_frame;
 
/*
 *  Last error information
@@ -326,11 +324,8 @@ typedef struct ide_tape_obj {
/* Current character device data transfer direction */
u8 chrdev_dir;
 
-   /*
-*  Device information
-*/
-   /* Usually 512 or 1024 bytes */
-   unsigned short tape_block_size;
+   /* tape block size, usu. 512 or 1024 bytes */
+   unsigned short blk_size;
int user_bs_factor;
 
/* Copy of the tape's Capabilities and Mechanical Page */
@@ -349,8 +344,8 @@ typedef struct ide_tape_obj {
 *  The data buffer size is chosen based on the tape's
 *  recommendation.
 */
-   /* Pointer to the request which is waiting in the device request queue 
*/
-   struct request *active_data_request;
+   /* Ptr to the request which is waiting in the device request queue */
+   struct request *active_data_rq;
/* Data buffer size (chosen based on the tape's recommendation */
int stage_size;
idetape_stage_t *merge_stage;
@@ -388,7 +383,7 @@ typedef struct ide_tape_obj {
/* Status/Action flags: long for set_bit */
unsigned long flags;
/* protects the ide-tape queue */
-   spinlock_t spinlock;
+   spinlock_t lock;
 
/*
 * Measures average tape speed
@@ -750,7 +745,7 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 
*sense)
/* Correct pc->actually_transferred by asking the tape.  */
if (test_bit(PC_DMA_ERROR, &pc->flags)) {
pc->actually_transferred = pc->request_transfer -
-   tape->tape_block_size *
+   tape->blk_size *
be32_to_cpu(get_unaligned((u32 *)&sense[3]));
idetape_update_buffers(pc);
}
@@ -809,7 +804,7 @@ static void idetape_activate_next_stage(ide_drive_t *drive)
rq->rq_disk = tape->disk;
rq->buffer = NULL;
rq->special = (void *)stage->bh;
-   tape->active_data_request = rq;
+   tape->active_data_rq = rq;
tape->active_stage = stage;
tape->next_stage = stage->next;
 }
@@ -951,13 +946,13 @@ static int idetape_end_request(ide_drive_t *drive, int 
uptodate, int nr_sects)
return 0;
}
 
-   spin_lock_irqsave(&tape->spinlock, flags);
+   spin_lock_irqsave(&tape->lock, flags);
 
/* The request was a pipelined data transfer request */
-   if (tape->active_data_request == rq) {
+   if (tape->active_data_rq == rq) {
active_stage = tape->active_stage;
tape->active_stage = NULL;
-   tape->active_data_request = NULL;
+   tape->active_data_rq = NULL;
tape->nr_pending_stages--;
if (rq->cmd[0] & REQ_IDETAPE_WRITE) {
remove_stage = 1;
@@ -978,7 +973,8 @@ static int idetape_end_request(ide_drive_t *drive, int 
uptodate, int nr_sects)
/*
 * Insert the next request into the request queue.
 */
-   (void) ide_do_drive_cmd(drive, 
tape->active_data_request, ide_end);
+   (void)ide_do_drive_cmd(drive, tape->active_data_rq,
+   ide_end);
} else if (!error) {
idetape_increase_max_pipeline_stages(drive);
}
@@ -990,9 +986,9 @@ static int idetape_end_request(ide_drive_t *drive, int 
uptodate, int nr_sects)
 
if (remove_stage)
idetape_remove_stage_head(drive);
-   if (tape->active_data_request == NULL)
+   if (tape->active_data_rq == NULL)
clear_bit(IDETAPE_PIPELINE_ACTIVE, &tape->flags);
-   spin_unlock_irqrestore(&tape->spinlock, flags);
+   spin_unlock_irqrestore(&tape->lock, flags);