Re: [PATCH 1/7] aacraid: Greater than 2TB capacity support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +		if ((scsicmd->cmnd[0] == WRITE_6) ||	/* 6 byte command */
> +		    (scsicmd->cmnd[0] == READ_6))
> +			lba = ((scsicmd->cmnd[1] & 0x1F) << 16) |
> +			    (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
> +		else if ((scsicmd->cmnd[0] == WRITE_16)	|| /* 16 byte command */
> +		  	 (scsicmd->cmnd[0] == READ_16))
> +			lba = ((u64)scsicmd->cmnd[2] << 56) |
> +			      ((u64)scsicmd->cmnd[3] << 48) |
> +			      ((u64)scsicmd->cmnd[4] << 40) |
> +			      ((u64)scsicmd->cmnd[5] << 32) |
> +			      ((u64)scsicmd->cmnd[6] << 24) |
> +			      (scsicmd->cmnd[7] << 16) |
> +			      (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
> +		else if ((scsicmd->cmnd[0] == WRITE_12)	|| /* 12 byte command */
> +		 	 (scsicmd->cmnd[0] == READ_12))
> +			lba = ((u64)scsicmd->cmnd[2] << 24) |
> +			      (scsicmd->cmnd[3] << 16) |
> +			      (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
> +		else
> +			lba = ((u64)scsicmd->cmnd[2] << 24) |
> +			       (scsicmd->cmnd[3] << 16) |
> +			       (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
> +		printk(KERN_DEBUG
> +		  "io_callback[cpu %d]: lba = %llu, t = %ld.\n",
> +		  smp_processor_id(), (unsigned long long)lba, jiffies);
> +	}

this would be more readable as a swich statement.

> +	} else if (scsicmd->cmnd[0] == READ_16) { /* 16 byte command */
> +		dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", cid));
> +
> +		lba = 	((u64)scsicmd->cmnd[2] << 56) |
> +		 	((u64)scsicmd->cmnd[3] << 48) |
> +			((u64)scsicmd->cmnd[4] << 40) |
> +			((u64)scsicmd->cmnd[5] << 32) |
> +			((u64)scsicmd->cmnd[6] << 24) | 
> +			(scsicmd->cmnd[7] << 16) |
> +			(scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
> +		count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) |
> +			(scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13];
> +	} else if (scsicmd->cmnd[0] == READ_12) { /* 12 byte command */
> +		dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", cid));
> +
> +		lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16)
> +		    | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
> +		count = (scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16)
> +		      | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
>  	} else {
>  		dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", cid));

dito

> -
> +			if (scsicmd->request->rq_disk)
> +				strlcpy(fsa_dev_ptr[cid].devname,
> +				scsicmd->request->rq_disk->disk_name,
> +			  	min(sizeof(fsa_dev_ptr[cid].devname),
> +				sizeof(scsicmd->request->rq_disk->disk_name) + 1));

do we really need this?  A driver really shouldn't look at ->rq_disk

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux