[Devel] [PATCH RH7 2/4] ploop: Add @write argument to ->fastmap
Kirill Tkhai
ktkhai at virtuozzo.com
Thu Aug 6 14:55:31 MSK 2020
This allows to differ READ and WRITE request. We need
that, since they are required to be protected differently.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/block/ploop/io_kaio.c | 3 ++-
fs/ext4/file.c | 2 +-
include/linux/fs.h | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 89e39ff1b926..9cbe923b14bf 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -1206,7 +1206,8 @@ kaio_fastmap(struct ploop_io *io, struct bio *orig_bio,
return 0;
}
- ret = inode->i_op->fastmap(inode, isec, orig_bio->bi_size, &phys_sec);
+ ret = inode->i_op->fastmap(inode, isec, orig_bio->bi_size, &phys_sec,
+ orig_bio->bi_rw & REQ_WRITE);
if (ret < 0) {
io->plo->st.fast_neg_noem++;
return 1;
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index edaf966c9a2f..57a8cc2b8e3f 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -126,7 +126,7 @@ static bool ext4_overwrite_io(struct inode *inode, loff_t pos, loff_t len)
}
static int ext4_fastmap(struct inode *inode, sector_t lblk_sec,
- unsigned int len, sector_t *pblk_sec)
+ unsigned int len, sector_t *pblk_sec, bool write)
{
struct ext4_map_blocks map;
loff_t pos = lblk_sec << 9;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 598d7ec03578..bb3bab24fae1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2013,7 +2013,7 @@ struct inode_operations {
int (*atomic_open)(struct inode *, struct dentry *,
struct file *, unsigned open_flag,
umode_t create_mode, int *opened);
- int (*fastmap)(struct inode *, sector_t, unsigned int, sector_t *);
+ int (*fastmap)(struct inode *, sector_t, unsigned int, sector_t *, bool);
} ____cacheline_aligned;
More information about the Devel
mailing list