Skip to content

Commit

Permalink
Merge tag 'for-5.16/bdev-size-2021-11-09' of git://git.kernel.dk/linu…
Browse files Browse the repository at this point in the history
…x-block

Pull more bdev size updates from Jens Axboe:
 "Two followup changes for the bdev-size series from this merge window:

   - Add loff_t cast to bdev_nr_bytes() (Christoph)

   - Use bdev_nr_bytes() consistently for the block parts at least (me)"

* tag 'for-5.16/bdev-size-2021-11-09' of git://git.kernel.dk/linux-block:
  block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter()
  block: add a loff_t cast to bdev_nr_bytes
  • Loading branch information
Linus Torvalds committed Nov 9, 2021
2 parents 007301c + 138c1a3 commit 1dc1f92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions block/fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
struct block_device *bdev = iocb->ki_filp->private_data;
struct inode *bd_inode = bdev->bd_inode;
loff_t size = i_size_read(bd_inode);
loff_t size = bdev_nr_bytes(bdev);
struct blk_plug plug;
size_t shorted = 0;
ssize_t ret;
Expand Down Expand Up @@ -565,7 +565,7 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
struct block_device *bdev = iocb->ki_filp->private_data;
loff_t size = i_size_read(bdev->bd_inode);
loff_t size = bdev_nr_bytes(bdev);
loff_t pos = iocb->ki_pos;
size_t shorted = 0;
ssize_t ret;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static inline sector_t bdev_nr_sectors(struct block_device *bdev)

static inline loff_t bdev_nr_bytes(struct block_device *bdev)
{
return bdev_nr_sectors(bdev) << SECTOR_SHIFT;
return (loff_t)bdev_nr_sectors(bdev) << SECTOR_SHIFT;
}

static inline sector_t get_capacity(struct gendisk *disk)
Expand Down

0 comments on commit 1dc1f92

Please sign in to comment.