Skip to content

Commit 1a7214e

Browse files
committed
wip: do custom zpl_writepages on syncfs(2)
Signed-off-by: Pavel Snajdr <[email protected]>
1 parent f5b732d commit 1a7214e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

include/os/linux/zfs/sys/zpl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ extern const struct inode_operations zpl_special_inode_operations;
4949
extern const struct address_space_operations zpl_address_space_operations;
5050
extern const struct file_operations zpl_file_operations;
5151
extern const struct file_operations zpl_dir_file_operations;
52+
extern int zpl_writepages(struct address_space *mapping,
53+
struct writeback_control *wbc);
5254

5355
/* zpl_super.c */
5456
extern void zpl_prune_sb(uint64_t nr_to_scan, void *arg);

module/os/linux/zfs/zpl_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ zpl_write_cache_pages(struct address_space *mapping,
546546
return (result);
547547
}
548548

549-
static int
549+
int
550550
zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
551551
{
552552
znode_t *zp = ITOZ(mapping->host);

module/os/linux/zfs/zpl_super.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ zpl_sync_fs(struct super_block *sb, int wait)
111111
cred_t *cr = CRED();
112112
znode_t *zp;
113113
zfsvfs_t *zfsvfs = sb->s_fs_info;
114+
struct writeback_control wbc = {
115+
.sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE,
116+
.nr_to_write = LONG_MAX,
117+
.range_start = 0,
118+
.range_end = LLONG_MAX,
119+
};
114120
int error;
115121

116122
crhold(cr);
@@ -119,7 +125,7 @@ zpl_sync_fs(struct super_block *sb, int wait)
119125
for (zp = list_head(&zfsvfs->z_all_znodes); zp;
120126
zp = list_next(&zfsvfs->z_all_znodes, zp)) {
121127
if (zp->z_sa_hdl)
122-
error = filemap_write_and_wait(ZTOI(zp)->i_mapping);
128+
error = zpl_writepages(ZTOI(zp)->i_mapping, &wbc);
123129
if (error != 0)
124130
break;
125131
}

0 commit comments

Comments
 (0)