Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP : Do more syncing when kstat.zfs.darwin.tunable.use_system_sync != 0 #109

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion module/os/macos/spl/spl-taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,10 @@ taskq_empty(taskq_t *tq)
int
taskq_empty_ent(taskq_ent_t *t)
{
return (IS_EMPTY(*t));
if (t->tqent_prev == NULL && t->tqent_next == NULL)
return (TRUE);
else
return (IS_EMPTY(*t));
}

/*
Expand Down
22 changes: 12 additions & 10 deletions module/os/macos/zfs/ldi_iokit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,17 +423,19 @@ handle_sync_iokit(struct ldi_handle *lhp)

#if defined(MAC_OS_X_VERSION_10_11) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
/* from module/os/macos/zfs/zfs_vfsops.c */
extern uint64_t zfs_vfs_sync_paranoia;
/* Issue device sync */
if (LH_MEDIA(lhp)->synchronize(LH_CLIENT(lhp), 0, 0, kIOStorageSynchronizeOptionBarrier) !=
kIOReturnSuccess) {
printf("%s %s\n", __func__,
"IOMedia synchronizeCache (with write barrier) failed\n");
if (LH_MEDIA(lhp)->synchronize(LH_CLIENT(lhp), 0, 0, 0) !=
kIOReturnSuccess) {
printf("%s %s\n", __func__,
"IOMedia synchronizeCache (standard) failed\n");
return (ENOTSUP);
}
IOStorageSynchronizeOptions synctype = (zfs_vfs_sync_paranoia != 0)
? kIOStorageSynchronizeOptionNone
: kIOStorageSynchronizeOptionBarrier;
IOReturn ret = LH_MEDIA(lhp)->synchronize(LH_CLIENT(lhp),
0, 0, synctype);
if (ret != kIOReturnSuccess) {
printf("%s %s %d %s\n", __func__,
"IOMedia synchronizeCache (with write barrier) failed",
ret, "(see IOReturn.h)\n");
return (ENOTSUP);
}
#else
/* Issue device sync */
Expand Down
9 changes: 7 additions & 2 deletions module/os/macos/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ static void vdev_disk_close(vdev_t *);

extern unsigned int spl_split_stack_below;

extern uint64_t zfs_vfs_sync_paranoia;

typedef struct vdev_disk_ldi_cb {
list_node_t lcb_next;
ldi_callback_id_t lcb_id;
Expand Down Expand Up @@ -517,10 +519,13 @@ vdev_disk_io_strategy(void *arg)
switch (zio->io_type) {

case ZIO_TYPE_WRITE:
if (zio->io_priority == ZIO_PRIORITY_SYNC_WRITE)
if (zio->io_priority == ZIO_PRIORITY_SYNC_WRITE) {
flags = B_WRITE;
else
if (zfs_vfs_sync_paranoia != 0)
flags |= B_FUA;
} else {
flags = B_WRITE | B_ASYNC;
}

bp->b_un.b_addr =
abd_borrow_buf_copy(zio->io_abd, zio->io_size);
Expand Down
2 changes: 1 addition & 1 deletion module/os/macos/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ zfs_is_readonly(zfsvfs_t *zfsvfs)
* syncs. (As per illumos) Unfortunately, we can not tell the difference
* of when users run "sync" by hand. Sync is called on umount though.
*/
uint64_t zfs_vfs_sync_paranoia = 0;
uint64_t zfs_vfs_sync_paranoia = 1;

int
zfs_vfs_sync(struct mount *vfsp, __unused int waitfor,
Expand Down
2 changes: 2 additions & 0 deletions tests/zfs-tests/cmd/librt/mach_gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <mach/clock.h>
#include <mach/mach_time.h>

void gettime_dummy(void);

extern int
clock_gettime(clock_id_t clock_id, struct timespec *tp);

Expand Down