Skip to content

Commit

Permalink
block: Make protection interval calculation generic
Browse files Browse the repository at this point in the history
Now that the protection interval has been detached from the sector size
we need to be able to handle sizes that are different from 4K and
512. Make the interval calculation generic.

Signed-off-by: Martin K. Petersen <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
martinkpetersen authored and axboe committed Sep 27, 2014
1 parent 3be91c4 commit 5a2aa87
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions block/bio-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,7 @@ EXPORT_SYMBOL(bio_integrity_enabled);
static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi,
unsigned int sectors)
{
/* At this point there are only 512b or 4096b DIF/EPP devices */
if (bi->interval == 4096)
return sectors >>= 3;

return sectors;
return sectors >> (ilog2(bi->interval) - 9);
}

static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
Expand Down

0 comments on commit 5a2aa87

Please sign in to comment.