mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-17 04:36:22 +00:00
scst_lib: use bdev_nr_bytes(bdev) instead of i_size_read(bdev->bd_inode)
Use the helper to query the size of a block device in bytes.
This commit is contained in:
@@ -329,6 +329,18 @@ static inline void bdev_release_backport(struct bdev_handle *handle)
|
||||
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
/*
|
||||
* See also commit 6436bd90f76e ("block: add a bdev_nr_bytes helper") # v5.16.
|
||||
*/
|
||||
static inline loff_t bdev_nr_bytes_backport(struct block_device *bdev)
|
||||
{
|
||||
return i_size_read(bdev->bd_inode);
|
||||
}
|
||||
|
||||
#define bdev_nr_bytes bdev_nr_bytes_backport
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0) && \
|
||||
(!defined(RHEL_RELEASE_CODE) || \
|
||||
RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 1))
|
||||
|
||||
+1
-1
@@ -6178,7 +6178,7 @@ loff_t scst_bdev_size(const char *path)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
res = i_size_read(bdev_desc.bdev->bd_inode);
|
||||
res = bdev_nr_bytes(bdev_desc.bdev);
|
||||
|
||||
scst_release_bdev(&bdev_desc);
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user