Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ctl/ctl_backend_block.c
| Show First 20 Lines • Show All 582 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void | static void | ||||
| ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, | ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, | ||||
| struct ctl_be_block_io *beio) | struct ctl_be_block_io *beio) | ||||
| { | { | ||||
| union ctl_io *io = beio->io; | union ctl_io *io = beio->io; | ||||
| struct mount *mountpoint; | struct mount *mountpoint; | ||||
| int error, lock_flags; | int error; | ||||
| DPRINTF("entered\n"); | DPRINTF("entered\n"); | ||||
| binuptime(&beio->ds_t0); | binuptime(&beio->ds_t0); | ||||
| devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); | devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); | ||||
| (void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT); | (void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT); | ||||
| if (MNT_SHARED_WRITES(mountpoint) || | vn_lock(be_lun->vn, vn_lktype_write(mountpoint, be_lun->vn) | | ||||
| ((mountpoint == NULL) && MNT_SHARED_WRITES(be_lun->vn->v_mount))) | LK_RETRY); | ||||
| lock_flags = LK_SHARED; | |||||
| else | |||||
| lock_flags = LK_EXCLUSIVE; | |||||
| vn_lock(be_lun->vn, lock_flags | LK_RETRY); | |||||
| error = VOP_FSYNC(be_lun->vn, beio->io_arg ? MNT_NOWAIT : MNT_WAIT, | error = VOP_FSYNC(be_lun->vn, beio->io_arg ? MNT_NOWAIT : MNT_WAIT, | ||||
| curthread); | curthread); | ||||
| VOP_UNLOCK(be_lun->vn); | VOP_UNLOCK(be_lun->vn); | ||||
| vn_finished_write(mountpoint); | vn_finished_write(mountpoint); | ||||
| mtx_lock(&be_lun->io_lock); | mtx_lock(&be_lun->io_lock); | ||||
| devstat_end_transaction(beio->lun->disk_stats, beio->io_len, | devstat_end_transaction(beio->lun->disk_stats, beio->io_len, | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | if (error == 0 && xuio.uio_resid > 0) { | ||||
| } | } | ||||
| bzero((uint8_t *)beio->sg_segs[i].addr + s, | bzero((uint8_t *)beio->sg_segs[i].addr + s, | ||||
| beio->sg_segs[i].len - s); | beio->sg_segs[i].len - s); | ||||
| s = 0; | s = 0; | ||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| struct mount *mountpoint; | struct mount *mountpoint; | ||||
| int lock_flags; | |||||
| (void)vn_start_write(be_lun->vn, &mountpoint, V_WAIT); | (void)vn_start_write(be_lun->vn, &mountpoint, V_WAIT); | ||||
| vn_lock(be_lun->vn, vn_lktype_write(mountpoint, | |||||
| if (MNT_SHARED_WRITES(mountpoint) || ((mountpoint == NULL) | be_lun->vn) | LK_RETRY); | ||||
| && MNT_SHARED_WRITES(be_lun->vn->v_mount))) | |||||
| lock_flags = LK_SHARED; | |||||
| else | |||||
| lock_flags = LK_EXCLUSIVE; | |||||
| vn_lock(be_lun->vn, lock_flags | LK_RETRY); | |||||
| /* | /* | ||||
| * UFS pays attention to IO_DIRECT for writes. The write | * UFS pays attention to IO_DIRECT for writes. The write | ||||
| * is done asynchronously. (Normally the write would just | * is done asynchronously. (Normally the write would just | ||||
| * get put into cache. | * get put into cache. | ||||
| * | * | ||||
| * UFS pays attention to IO_SYNC for writes. It will | * UFS pays attention to IO_SYNC for writes. It will | ||||
| * attempt to write the buffer out synchronously if that | * attempt to write the buffer out synchronously if that | ||||
| ▲ Show 20 Lines • Show All 2,074 Lines • Show Last 20 Lines | |||||