Commit 8ff6daa1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

iomap: constify struct iomap_ops

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent b6f41e44
...@@ -1074,7 +1074,7 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, ...@@ -1074,7 +1074,7 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
*/ */
ssize_t ssize_t
dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
struct address_space *mapping = iocb->ki_filp->f_mapping; struct address_space *mapping = iocb->ki_filp->f_mapping;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
...@@ -1118,7 +1118,7 @@ static int dax_fault_return(int error) ...@@ -1118,7 +1118,7 @@ static int dax_fault_return(int error)
* necessary locking for the page fault to proceed successfully. * necessary locking for the page fault to proceed successfully.
*/ */
int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
struct address_space *mapping = vma->vm_file->f_mapping; struct address_space *mapping = vma->vm_file->f_mapping;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
...@@ -1317,7 +1317,7 @@ static int dax_pmd_load_hole(struct vm_area_struct *vma, pmd_t *pmd, ...@@ -1317,7 +1317,7 @@ static int dax_pmd_load_hole(struct vm_area_struct *vma, pmd_t *pmd,
} }
int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
pmd_t *pmd, unsigned int flags, struct iomap_ops *ops) pmd_t *pmd, unsigned int flags, const struct iomap_ops *ops)
{ {
struct address_space *mapping = vma->vm_file->f_mapping; struct address_space *mapping = vma->vm_file->f_mapping;
unsigned long pmd_addr = address & PMD_MASK; unsigned long pmd_addr = address & PMD_MASK;
......
...@@ -814,7 +814,7 @@ extern const struct file_operations ext2_file_operations; ...@@ -814,7 +814,7 @@ extern const struct file_operations ext2_file_operations;
/* inode.c */ /* inode.c */
extern const struct address_space_operations ext2_aops; extern const struct address_space_operations ext2_aops;
extern const struct address_space_operations ext2_nobh_aops; extern const struct address_space_operations ext2_nobh_aops;
extern struct iomap_ops ext2_iomap_ops; extern const struct iomap_ops ext2_iomap_ops;
/* namei.c */ /* namei.c */
extern const struct inode_operations ext2_dir_inode_operations; extern const struct inode_operations ext2_dir_inode_operations;
......
...@@ -842,13 +842,13 @@ ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length, ...@@ -842,13 +842,13 @@ ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length,
return 0; return 0;
} }
struct iomap_ops ext2_iomap_ops = { const struct iomap_ops ext2_iomap_ops = {
.iomap_begin = ext2_iomap_begin, .iomap_begin = ext2_iomap_begin,
.iomap_end = ext2_iomap_end, .iomap_end = ext2_iomap_end,
}; };
#else #else
/* Define empty ops for !CONFIG_FS_DAX case to avoid ugly ifdefs */ /* Define empty ops for !CONFIG_FS_DAX case to avoid ugly ifdefs */
struct iomap_ops ext2_iomap_ops; const struct iomap_ops ext2_iomap_ops;
#endif /* CONFIG_FS_DAX */ #endif /* CONFIG_FS_DAX */
int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
......
...@@ -3253,7 +3253,7 @@ static inline void ext4_clear_io_unwritten_flag(ext4_io_end_t *io_end) ...@@ -3253,7 +3253,7 @@ static inline void ext4_clear_io_unwritten_flag(ext4_io_end_t *io_end)
} }
} }
extern struct iomap_ops ext4_iomap_ops; extern const struct iomap_ops ext4_iomap_ops;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -3420,7 +3420,7 @@ static int ext4_iomap_end(struct inode *inode, loff_t offset, loff_t length, ...@@ -3420,7 +3420,7 @@ static int ext4_iomap_end(struct inode *inode, loff_t offset, loff_t length,
return ret; return ret;
} }
struct iomap_ops ext4_iomap_ops = { const struct iomap_ops ext4_iomap_ops = {
.iomap_begin = ext4_iomap_begin, .iomap_begin = ext4_iomap_begin,
.iomap_end = ext4_iomap_end, .iomap_end = ext4_iomap_end,
}; };
......
...@@ -182,7 +182,7 @@ typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len, ...@@ -182,7 +182,7 @@ typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len,
void *data, struct iomap *iomap); void *data, struct iomap *iomap);
loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length, loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length,
unsigned flags, struct iomap_ops *ops, void *data, unsigned flags, const struct iomap_ops *ops, void *data,
iomap_actor_t actor); iomap_actor_t actor);
/* direct-io.c: */ /* direct-io.c: */
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
*/ */
loff_t loff_t
iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned flags, iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned flags,
struct iomap_ops *ops, void *data, iomap_actor_t actor) const struct iomap_ops *ops, void *data, iomap_actor_t actor)
{ {
struct iomap iomap = { 0 }; struct iomap iomap = { 0 };
loff_t written = 0, ret; loff_t written = 0, ret;
...@@ -232,7 +232,7 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data, ...@@ -232,7 +232,7 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
ssize_t ssize_t
iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *iter, iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *iter,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
struct inode *inode = iocb->ki_filp->f_mapping->host; struct inode *inode = iocb->ki_filp->f_mapping->host;
loff_t pos = iocb->ki_pos, ret = 0, written = 0; loff_t pos = iocb->ki_pos, ret = 0, written = 0;
...@@ -315,7 +315,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data, ...@@ -315,7 +315,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
int int
iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
loff_t ret; loff_t ret;
...@@ -395,7 +395,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count, ...@@ -395,7 +395,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count,
int int
iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero, iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
loff_t ret; loff_t ret;
...@@ -415,7 +415,7 @@ EXPORT_SYMBOL_GPL(iomap_zero_range); ...@@ -415,7 +415,7 @@ EXPORT_SYMBOL_GPL(iomap_zero_range);
int int
iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero, iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
unsigned blocksize = (1 << inode->i_blkbits); unsigned blocksize = (1 << inode->i_blkbits);
unsigned off = pos & (blocksize - 1); unsigned off = pos & (blocksize - 1);
...@@ -443,7 +443,7 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length, ...@@ -443,7 +443,7 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length,
} }
int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
struct page *page = vmf->page; struct page *page = vmf->page;
struct inode *inode = file_inode(vma->vm_file); struct inode *inode = file_inode(vma->vm_file);
...@@ -542,7 +542,7 @@ iomap_fiemap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, ...@@ -542,7 +542,7 @@ iomap_fiemap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
} }
int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fi, int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fi,
loff_t start, loff_t len, struct iomap_ops *ops) loff_t start, loff_t len, const struct iomap_ops *ops)
{ {
struct fiemap_ctx ctx; struct fiemap_ctx ctx;
loff_t ret; loff_t ret;
...@@ -836,8 +836,8 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length, ...@@ -836,8 +836,8 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length,
} }
ssize_t ssize_t
iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, struct iomap_ops *ops, iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
iomap_dio_end_io_t end_io) const struct iomap_ops *ops, iomap_dio_end_io_t end_io)
{ {
struct address_space *mapping = iocb->ki_filp->f_mapping; struct address_space *mapping = iocb->ki_filp->f_mapping;
struct inode *inode = file_inode(iocb->ki_filp); struct inode *inode = file_inode(iocb->ki_filp);
......
...@@ -1144,7 +1144,7 @@ xfs_file_iomap_end( ...@@ -1144,7 +1144,7 @@ xfs_file_iomap_end(
return 0; return 0;
} }
struct iomap_ops xfs_iomap_ops = { const struct iomap_ops xfs_iomap_ops = {
.iomap_begin = xfs_file_iomap_begin, .iomap_begin = xfs_file_iomap_begin,
.iomap_end = xfs_file_iomap_end, .iomap_end = xfs_file_iomap_end,
}; };
...@@ -1190,6 +1190,6 @@ xfs_xattr_iomap_begin( ...@@ -1190,6 +1190,6 @@ xfs_xattr_iomap_begin(
return error; return error;
} }
struct iomap_ops xfs_xattr_iomap_ops = { const struct iomap_ops xfs_xattr_iomap_ops = {
.iomap_begin = xfs_xattr_iomap_begin, .iomap_begin = xfs_xattr_iomap_begin,
}; };
...@@ -33,7 +33,7 @@ void xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *, ...@@ -33,7 +33,7 @@ void xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *,
struct xfs_bmbt_irec *); struct xfs_bmbt_irec *);
xfs_extlen_t xfs_eof_alignment(struct xfs_inode *ip, xfs_extlen_t extsize); xfs_extlen_t xfs_eof_alignment(struct xfs_inode *ip, xfs_extlen_t extsize);
extern struct iomap_ops xfs_iomap_ops; extern const struct iomap_ops xfs_iomap_ops;
extern struct iomap_ops xfs_xattr_iomap_ops; extern const struct iomap_ops xfs_xattr_iomap_ops;
#endif /* __XFS_IOMAP_H__*/ #endif /* __XFS_IOMAP_H__*/
...@@ -37,9 +37,9 @@ static inline void *dax_radix_locked_entry(sector_t sector, unsigned long flags) ...@@ -37,9 +37,9 @@ static inline void *dax_radix_locked_entry(sector_t sector, unsigned long flags)
} }
ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
struct iomap_ops *ops); const struct iomap_ops *ops);
int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
struct iomap_ops *ops); const struct iomap_ops *ops);
int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index); int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index);
int dax_invalidate_mapping_entry_sync(struct address_space *mapping, int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
...@@ -72,7 +72,7 @@ static inline unsigned int dax_radix_order(void *entry) ...@@ -72,7 +72,7 @@ static inline unsigned int dax_radix_order(void *entry)
return 0; return 0;
} }
int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
pmd_t *pmd, unsigned int flags, struct iomap_ops *ops); pmd_t *pmd, unsigned int flags, const struct iomap_ops *ops);
#else #else
static inline unsigned int dax_radix_order(void *entry) static inline unsigned int dax_radix_order(void *entry)
{ {
...@@ -80,7 +80,7 @@ static inline unsigned int dax_radix_order(void *entry) ...@@ -80,7 +80,7 @@ static inline unsigned int dax_radix_order(void *entry)
} }
static inline int dax_iomap_pmd_fault(struct vm_area_struct *vma, static inline int dax_iomap_pmd_fault(struct vm_area_struct *vma,
unsigned long address, pmd_t *pmd, unsigned int flags, unsigned long address, pmd_t *pmd, unsigned int flags,
struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
return VM_FAULT_FALLBACK; return VM_FAULT_FALLBACK;
} }
......
...@@ -72,17 +72,17 @@ struct iomap_ops { ...@@ -72,17 +72,17 @@ struct iomap_ops {
}; };
ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from, ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
struct iomap_ops *ops); const struct iomap_ops *ops);
int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len,
struct iomap_ops *ops); const struct iomap_ops *ops);
int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len,
bool *did_zero, struct iomap_ops *ops); bool *did_zero, const struct iomap_ops *ops);
int iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero, int iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
struct iomap_ops *ops); const struct iomap_ops *ops);
int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
struct iomap_ops *ops); const struct iomap_ops *ops);
int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
loff_t start, loff_t len, struct iomap_ops *ops); loff_t start, loff_t len, const struct iomap_ops *ops);
/* /*
* Flags for direct I/O ->end_io: * Flags for direct I/O ->end_io:
...@@ -92,6 +92,6 @@ int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ...@@ -92,6 +92,6 @@ int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
typedef int (iomap_dio_end_io_t)(struct kiocb *iocb, ssize_t ret, typedef int (iomap_dio_end_io_t)(struct kiocb *iocb, ssize_t ret,
unsigned flags); unsigned flags);
ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
struct iomap_ops *ops, iomap_dio_end_io_t end_io); const struct iomap_ops *ops, iomap_dio_end_io_t end_io);
#endif /* LINUX_IOMAP_H */ #endif /* LINUX_IOMAP_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment