Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
#include <sys/dmu_zfetch.h> | #include <sys/dmu_zfetch.h> | ||||
#include <sys/zfs_ioctl.h> | #include <sys/zfs_ioctl.h> | ||||
#include <sys/zap.h> | #include <sys/zap.h> | ||||
#include <sys/zio_checksum.h> | #include <sys/zio_checksum.h> | ||||
#include <sys/zio_compress.h> | #include <sys/zio_compress.h> | ||||
#include <sys/sa.h> | #include <sys/sa.h> | ||||
#include <sys/zfeature.h> | #include <sys/zfeature.h> | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include <sys/racct.h> | |||||
#include <sys/vm.h> | #include <sys/vm.h> | ||||
#include <sys/zfs_znode.h> | #include <sys/zfs_znode.h> | ||||
#endif | #endif | ||||
/* | /* | ||||
* Enable/disable nopwrite feature. | * Enable/disable nopwrite feature. | ||||
*/ | */ | ||||
int zfs_nopwrite_enabled = 1; | int zfs_nopwrite_enabled = 1; | ||||
▲ Show 20 Lines • Show All 364 Lines • ▼ Show 20 Lines | if (offset + length > dn->dn_datablksz) { | ||||
(longlong_t)offset, (longlong_t)length); | (longlong_t)offset, (longlong_t)length); | ||||
rw_exit(&dn->dn_struct_rwlock); | rw_exit(&dn->dn_struct_rwlock); | ||||
return (SET_ERROR(EIO)); | return (SET_ERROR(EIO)); | ||||
} | } | ||||
nblks = 1; | nblks = 1; | ||||
} | } | ||||
dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_SLEEP); | dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_SLEEP); | ||||
#if defined(_KERNEL) && defined(RACCT) | |||||
if (racct_enable && !read) { | |||||
PROC_LOCK(curproc); | |||||
racct_add_force(curproc, RACCT_WRITEBPS, length); | |||||
racct_add_force(curproc, RACCT_WRITEIOPS, nblks); | |||||
PROC_UNLOCK(curproc); | |||||
} | |||||
#endif | |||||
zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); | zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); | ||||
blkid = dbuf_whichblock(dn, 0, offset); | blkid = dbuf_whichblock(dn, 0, offset); | ||||
for (i = 0; i < nblks; i++) { | for (i = 0; i < nblks; i++) { | ||||
dmu_buf_impl_t *db = dbuf_hold(dn, blkid + i, tag); | dmu_buf_impl_t *db = dbuf_hold(dn, blkid + i, tag); | ||||
if (db == NULL) { | if (db == NULL) { | ||||
rw_exit(&dn->dn_struct_rwlock); | rw_exit(&dn->dn_struct_rwlock); | ||||
dmu_buf_rele_array(dbp, nblks, tag); | dmu_buf_rele_array(dbp, nblks, tag); | ||||
zio_nowait(zio); | zio_nowait(zio); | ||||
▲ Show 20 Lines • Show All 979 Lines • ▼ Show 20 Lines | dmu_assign_arcbuf(dmu_buf_t *handle, uint64_t offset, arc_buf_t *buf, | ||||
* same size as the dbuf, and the dbuf is not metadata. It | * same size as the dbuf, and the dbuf is not metadata. It | ||||
* can't be metadata because the loaned arc buf comes from the | * can't be metadata because the loaned arc buf comes from the | ||||
* user-data kmem arena. | * user-data kmem arena. | ||||
*/ | */ | ||||
if (offset == db->db.db_offset && blksz == db->db.db_size && | if (offset == db->db.db_offset && blksz == db->db.db_size && | ||||
DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) { | DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) { | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
curthread->td_ru.ru_oublock++; | curthread->td_ru.ru_oublock++; | ||||
#endif | #ifdef RACCT | ||||
if (racct_enable) { | |||||
PROC_LOCK(curproc); | |||||
racct_add_force(curproc, RACCT_WRITEBPS, blksz); | |||||
racct_add_force(curproc, RACCT_WRITEIOPS, 1); | |||||
PROC_UNLOCK(curproc); | |||||
} | |||||
#endif /* RACCT */ | |||||
#endif /* _KERNEL */ | |||||
dbuf_assign_arcbuf(db, buf, tx); | dbuf_assign_arcbuf(db, buf, tx); | ||||
dbuf_rele(db, FTAG); | dbuf_rele(db, FTAG); | ||||
} else { | } else { | ||||
objset_t *os; | objset_t *os; | ||||
uint64_t object; | uint64_t object; | ||||
DB_DNODE_ENTER(dbuf); | DB_DNODE_ENTER(dbuf); | ||||
dn = DB_DNODE(dbuf); | dn = DB_DNODE(dbuf); | ||||
▲ Show 20 Lines • Show All 697 Lines • Show Last 20 Lines |