diff options
author | Simon Rettberg | 2023-01-09 18:08:16 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-01-09 18:08:16 +0100 |
commit | 3ccfe2d4042e84195f7db9645f9f3c3326bc0c04 (patch) | |
tree | 2c7d15ac2c163c1b692861901d03f4d59e64d6a2 /src/kernel/xloop_file_fmt_raw.c | |
parent | [KERNEL] Fix a copy/paste error acessing wrong variable in sanity check (diff) | |
download | xloop-3ccfe2d4042e84195f7db9645f9f3c3326bc0c04.tar.gz xloop-3ccfe2d4042e84195f7db9645f9f3c3326bc0c04.tar.xz xloop-3ccfe2d4042e84195f7db9645f9f3c3326bc0c04.zip |
[KERNEL] Update for Linux 6.1
Diffstat (limited to 'src/kernel/xloop_file_fmt_raw.c')
-rw-r--r-- | src/kernel/xloop_file_fmt_raw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kernel/xloop_file_fmt_raw.c b/src/kernel/xloop_file_fmt_raw.c index 52d879a..17c5274 100644 --- a/src/kernel/xloop_file_fmt_raw.c +++ b/src/kernel/xloop_file_fmt_raw.c @@ -360,20 +360,20 @@ static int __raw_file_fmt_fallocate(struct xloop_device *xlo, struct request *rq * information. */ struct file *file = xlo->xlo_backing_file; - struct request_queue *q = xlo->xlo_queue; int ret; mode |= FALLOC_FL_KEEP_SIZE; - if (!blk_queue_discard(q)) { - ret = -EOPNOTSUPP; - goto out; - } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) + if (!bdev_max_discard_sectors(xlo->xlo_device)) +#else + if (!blk_queue_discard(xlo->xlo_queue)) +#endif + return -EOPNOTSUPP; ret = file->f_op->fallocate(file, mode, pos, blk_rq_bytes(rq)); if (unlikely(ret && ret != -EINVAL && ret != -EOPNOTSUPP)) ret = -EIO; -out: return ret; } |