Skip to content

Commit

Permalink
wip: do custom zpl_writepages on syncfs(2)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Snajdr <[email protected]>
  • Loading branch information
snajpa committed Nov 29, 2024
1 parent f5b732d commit 1a7214e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/os/linux/zfs/sys/zpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ extern const struct inode_operations zpl_special_inode_operations;
extern const struct address_space_operations zpl_address_space_operations;
extern const struct file_operations zpl_file_operations;
extern const struct file_operations zpl_dir_file_operations;
extern int zpl_writepages(struct address_space *mapping,
struct writeback_control *wbc);

/* zpl_super.c */
extern void zpl_prune_sb(uint64_t nr_to_scan, void *arg);
Expand Down
2 changes: 1 addition & 1 deletion module/os/linux/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ zpl_write_cache_pages(struct address_space *mapping,
return (result);
}

static int
int
zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
{
znode_t *zp = ITOZ(mapping->host);
Expand Down
8 changes: 7 additions & 1 deletion module/os/linux/zfs/zpl_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ zpl_sync_fs(struct super_block *sb, int wait)
cred_t *cr = CRED();
znode_t *zp;
zfsvfs_t *zfsvfs = sb->s_fs_info;
struct writeback_control wbc = {
.sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE,
.nr_to_write = LONG_MAX,
.range_start = 0,
.range_end = LLONG_MAX,
};
int error;

crhold(cr);
Expand All @@ -119,7 +125,7 @@ zpl_sync_fs(struct super_block *sb, int wait)
for (zp = list_head(&zfsvfs->z_all_znodes); zp;
zp = list_next(&zfsvfs->z_all_znodes, zp)) {
if (zp->z_sa_hdl)
error = filemap_write_and_wait(ZTOI(zp)->i_mapping);
error = zpl_writepages(ZTOI(zp)->i_mapping, &wbc);
if (error != 0)
break;
}
Expand Down

0 comments on commit 1a7214e

Please sign in to comment.