Browse Source

block_dev: get rid of blksize bits calculation

We store the bits in the bdev sector size locally, but we don't use
the calculation anymore. All we do with it is shift it back up to
the bdev sector size. So let's just use that directly and kill the
variable and bits calculation.

Signed-off-by: Jens Axboe <axboe@fb.com>
Jens Axboe 8 years ago
parent
commit
9a794fb9bd
1 changed files with 4 additions and 4 deletions
  1. 4 4
      fs/block_dev.c

+ 4 - 4
fs/block_dev.c

@@ -202,7 +202,6 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
 {
 {
 	struct file *file = iocb->ki_filp;
 	struct file *file = iocb->ki_filp;
 	struct block_device *bdev = I_BDEV(bdev_file_inode(file));
 	struct block_device *bdev = I_BDEV(bdev_file_inode(file));
-	unsigned blkbits = blksize_bits(bdev_logical_block_size(bdev));
 	struct bio_vec inline_vecs[DIO_INLINE_BIO_VECS], *vecs, *bvec;
 	struct bio_vec inline_vecs[DIO_INLINE_BIO_VECS], *vecs, *bvec;
 	loff_t pos = iocb->ki_pos;
 	loff_t pos = iocb->ki_pos;
 	bool should_dirty = false;
 	bool should_dirty = false;
@@ -211,7 +210,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
 	blk_qc_t qc;
 	blk_qc_t qc;
 	int i;
 	int i;
 
 
-	if ((pos | iov_iter_alignment(iter)) & ((1 << blkbits) - 1))
+	if ((pos | iov_iter_alignment(iter)) &
+	    (bdev_logical_block_size(bdev) - 1))
 		return -EINVAL;
 		return -EINVAL;
 
 
 	if (nr_pages <= DIO_INLINE_BIO_VECS)
 	if (nr_pages <= DIO_INLINE_BIO_VECS)
@@ -331,7 +331,6 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
 	struct file *file = iocb->ki_filp;
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = bdev_file_inode(file);
 	struct inode *inode = bdev_file_inode(file);
 	struct block_device *bdev = I_BDEV(inode);
 	struct block_device *bdev = I_BDEV(inode);
-	unsigned blkbits = blksize_bits(bdev_logical_block_size(bdev));
 	struct blkdev_dio *dio;
 	struct blkdev_dio *dio;
 	struct bio *bio;
 	struct bio *bio;
 	bool is_read = (iov_iter_rw(iter) == READ);
 	bool is_read = (iov_iter_rw(iter) == READ);
@@ -339,7 +338,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
 	blk_qc_t qc = BLK_QC_T_NONE;
 	blk_qc_t qc = BLK_QC_T_NONE;
 	int ret;
 	int ret;
 
 
-	if ((pos | iov_iter_alignment(iter)) & ((1 << blkbits) - 1))
+	if ((pos | iov_iter_alignment(iter)) &
+	    (bdev_logical_block_size(bdev) - 1))
 		return -EINVAL;
 		return -EINVAL;
 
 
 	bio = bio_alloc_bioset(GFP_KERNEL, nr_pages, blkdev_dio_pool);
 	bio = bio_alloc_bioset(GFP_KERNEL, nr_pages, blkdev_dio_pool);