Re: How best to get the size of a blockdev from a file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023/4/18 20:28, Kanchan Joshi wrote:
On Tue, Apr 18, 2023 at 11:00:12AM +0100, David Howells wrote:
Hi Christoph,

It seems that my use of i_size_read(file_inode(in)) in filemap_splice_read() to get the size of the file to be spliced from doesn't work in the case of
blockdevs and it always returns 0.

What would be the best way to get the blockdev size?  Look at
file->f_mapping->i_size maybe?

bdev_nr_bytes(I_BDEV(file->f_mapping->host))
should work I suppose.


This needs the caller to check if the file is a blockdev. Can we fill the upper inode size which belongs to devtmpfs so that the generic code do not need to aware the low level inode type?



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux