Re: [PATCH 4/6] scsi_debug: add translation functions between LBA and index of provisioning map

James Bottomley
2013-05-02T22:50:23Z

On Tue, 2013-04-16 at 22:11 +0900, Akinobu Mita wrote:
> The translation from LBA to index of provisioning map (map_storep) is used
> in various places (map_state(), map_region(), and unmap_region()). But it
> is not correctly calculated if scsi_debug_unmap_alignment is zero.
>
> This introduces correct translation functions between LBA and index
> of provisioning map:
>
> static unsigned long lba_to_map_index(sector_t lba);
> static sector_t map_index_to_lba(unsigned long index);
>
> Actual bug fixes with using these functions will be done by forthcoming
> patches.

That's not the correct way to split patches, because it leads to untidy
things like this:

drivers/scsi/scsi_debug.c:2000:22: warning: ‘lba_to_map_index’ defined
but not used [-Wunused-function]
drivers/scsi/scsi_debug.c:2011:17: warning: ‘map_index_to_lba’ defined
but not used [-Wunused-function]

I fixed this just by rolling the last three patches together, but in
future, just put the static function in with whatever is calling it.

This is also good commit history practise regardless of the static
warning because it adds the function and the callers of that function in
the same commit meaning people who look later don't have to rummage
around for both commits.

James

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