Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ctl/ctl_backend_block.c
Show First 20 Lines • Show All 856 Lines • ▼ Show 20 Lines | ctl_be_block_getattr_file(struct ctl_be_block_lun *be_lun, const char *attrname) | ||||
uint64_t val; | uint64_t val; | ||||
int error; | int error; | ||||
val = UINT64_MAX; | val = UINT64_MAX; | ||||
if (be_lun->vn == NULL) | if (be_lun->vn == NULL) | ||||
return (val); | return (val); | ||||
vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); | vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); | ||||
if (strcmp(attrname, "blocksused") == 0) { | if (strcmp(attrname, "blocksused") == 0) { | ||||
error = VOP_GETATTR(be_lun->vn, &vattr, curthread->td_ucred); | error = VOP_GETATTR(be_lun->vn, 0, &vattr, curthread->td_ucred); | ||||
if (error == 0) | if (error == 0) | ||||
val = vattr.va_bytes / be_lun->cbe_lun.blocksize; | val = vattr.va_bytes / be_lun->cbe_lun.blocksize; | ||||
} | } | ||||
if (strcmp(attrname, "blocksavail") == 0 && | if (strcmp(attrname, "blocksavail") == 0 && | ||||
!VN_IS_DOOMED(be_lun->vn)) { | !VN_IS_DOOMED(be_lun->vn)) { | ||||
error = VFS_STATFS(be_lun->vn->v_mount, &statfs); | error = VFS_STATFS(be_lun->vn->v_mount, &statfs); | ||||
if (error == 0) | if (error == 0) | ||||
val = statfs.f_bavail * statfs.f_bsize / | val = statfs.f_bavail * statfs.f_bsize / | ||||
▲ Show 20 Lines • Show All 1,354 Lines • ▼ Show 20 Lines | ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) | ||||
be_lun->dev_type = CTL_BE_BLOCK_FILE; | be_lun->dev_type = CTL_BE_BLOCK_FILE; | ||||
be_lun->dispatch = ctl_be_block_dispatch_file; | be_lun->dispatch = ctl_be_block_dispatch_file; | ||||
be_lun->lun_flush = ctl_be_block_flush_file; | be_lun->lun_flush = ctl_be_block_flush_file; | ||||
be_lun->get_lba_status = ctl_be_block_gls_file; | be_lun->get_lba_status = ctl_be_block_gls_file; | ||||
be_lun->getattr = ctl_be_block_getattr_file; | be_lun->getattr = ctl_be_block_getattr_file; | ||||
be_lun->unmap = ctl_be_block_unmap_file; | be_lun->unmap = ctl_be_block_unmap_file; | ||||
cbe_lun->flags &= ~CTL_LUN_FLAG_UNMAP; | cbe_lun->flags &= ~CTL_LUN_FLAG_UNMAP; | ||||
error = VOP_GETATTR(be_lun->vn, &vattr, curthread->td_ucred); | error = VOP_GETATTR(be_lun->vn, 0, &vattr, curthread->td_ucred); | ||||
if (error != 0) { | if (error != 0) { | ||||
snprintf(req->error_str, sizeof(req->error_str), | snprintf(req->error_str, sizeof(req->error_str), | ||||
"error calling VOP_GETATTR() for file %s", | "error calling VOP_GETATTR() for file %s", | ||||
be_lun->dev_path); | be_lun->dev_path); | ||||
return (error); | return (error); | ||||
} | } | ||||
error = VOP_PATHCONF(be_lun->vn, _PC_DEALLOC_PRESENT, &pconf); | error = VOP_PATHCONF(be_lun->vn, _PC_DEALLOC_PRESENT, &pconf); | ||||
▲ Show 20 Lines • Show All 1,084 Lines • Show Last 20 Lines |