summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-09-26 19:20:00 -0400
committerJens Axboe <axboe@fb.com>2014-09-27 09:14:50 -0600
commit5a2aa873059fec8b6385071d9c0802893a9b2f41 (patch)
treeec80bcd00c6b507d2a06564373ac6b01c634442e /block
parent3be91c4a3d090bd700bd6ee5bf457c1bbf189a4f (diff)
downloadop-kernel-dev-5a2aa873059fec8b6385071d9c0802893a9b2f41.zip
op-kernel-dev-5a2aa873059fec8b6385071d9c0802893a9b2f41.tar.gz
block: Make protection interval calculation generic
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 <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 6a3aacf..cf40837e 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -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,
OpenPOWER on IntegriCloud