Commit 0af2b37d authored by Ritesh Harjani (IBM)'s avatar Ritesh Harjani (IBM)

iomap: Use iomap_punch_t typedef

It makes it much easier if we have iomap_punch_t typedef for "punch"
function pointer in all delalloc related punch, scan and release
functions. It will be useful in later patches when we will factor out
iomap_write_delalloc_punch() function.
Suggested-by: default avatarMatthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarRitesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent eee2d2e6
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define IOEND_BATCH_SIZE 4096 #define IOEND_BATCH_SIZE 4096
typedef int (*iomap_punch_t)(struct inode *inode, loff_t offset, loff_t length);
/* /*
* Structure allocated for each folio to track per-block uptodate state * Structure allocated for each folio to track per-block uptodate state
* and I/O completions. * and I/O completions.
...@@ -901,7 +902,7 @@ EXPORT_SYMBOL_GPL(iomap_file_buffered_write); ...@@ -901,7 +902,7 @@ EXPORT_SYMBOL_GPL(iomap_file_buffered_write);
*/ */
static int iomap_write_delalloc_scan(struct inode *inode, static int iomap_write_delalloc_scan(struct inode *inode,
loff_t *punch_start_byte, loff_t start_byte, loff_t end_byte, loff_t *punch_start_byte, loff_t start_byte, loff_t end_byte,
int (*punch)(struct inode *inode, loff_t offset, loff_t length)) iomap_punch_t punch)
{ {
while (start_byte < end_byte) { while (start_byte < end_byte) {
struct folio *folio; struct folio *folio;
...@@ -979,8 +980,7 @@ static int iomap_write_delalloc_scan(struct inode *inode, ...@@ -979,8 +980,7 @@ static int iomap_write_delalloc_scan(struct inode *inode,
* the code to subtle off-by-one bugs.... * the code to subtle off-by-one bugs....
*/ */
static int iomap_write_delalloc_release(struct inode *inode, static int iomap_write_delalloc_release(struct inode *inode,
loff_t start_byte, loff_t end_byte, loff_t start_byte, loff_t end_byte, iomap_punch_t punch)
int (*punch)(struct inode *inode, loff_t pos, loff_t length))
{ {
loff_t punch_start_byte = start_byte; loff_t punch_start_byte = start_byte;
loff_t scan_end_byte = min(i_size_read(inode), end_byte); loff_t scan_end_byte = min(i_size_read(inode), end_byte);
...@@ -1073,8 +1073,7 @@ static int iomap_write_delalloc_release(struct inode *inode, ...@@ -1073,8 +1073,7 @@ static int iomap_write_delalloc_release(struct inode *inode,
*/ */
int iomap_file_buffered_write_punch_delalloc(struct inode *inode, int iomap_file_buffered_write_punch_delalloc(struct inode *inode,
struct iomap *iomap, loff_t pos, loff_t length, struct iomap *iomap, loff_t pos, loff_t length,
ssize_t written, ssize_t written, iomap_punch_t punch)
int (*punch)(struct inode *inode, loff_t pos, loff_t length))
{ {
loff_t start_byte; loff_t start_byte;
loff_t end_byte; loff_t end_byte;
......
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