Created
February 12, 2015 08:08
-
-
Save tuxoko/132647ede8572651909b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c | |
index 9be69b5..1238fcd 100644 | |
--- a/module/zfs/dbuf.c | |
+++ b/module/zfs/dbuf.c | |
@@ -1763,8 +1763,13 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid, | |
ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); | |
ASSERT(dn->dn_type != DMU_OT_NONE); | |
- | |
+#ifdef _KERNEL | |
+ printk_once("sizeof dbuf=%lu\n", sizeof (dmu_buf_impl_t)); | |
+ db = (dmu_buf_impl_t *)__get_free_page(GFP_KERNEL); | |
+ dbuf_cons(db, NULL, 0); | |
+#else | |
db = kmem_cache_alloc(dbuf_cache, KM_SLEEP); | |
+#endif | |
db->db_objset = os; | |
db->db.db_object = dn->dn_object; | |
@@ -1814,7 +1819,12 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid, | |
db->db_state = DB_EVICTING; | |
if ((odb = dbuf_hash_insert(db)) != NULL) { | |
/* someone else inserted it first */ | |
+#ifdef _KERNEL | |
+ dbuf_dest(db, NULL); | |
+ free_page((unsigned long)db); | |
+#else | |
kmem_cache_free(dbuf_cache, db); | |
+#endif | |
mutex_exit(&dn->dn_dbufs_mtx); | |
return (odb); | |
} | |
@@ -1900,8 +1910,12 @@ dbuf_destroy(dmu_buf_impl_t *db) | |
ASSERT(db->db_hash_next == NULL); | |
ASSERT(db->db_blkptr == NULL); | |
ASSERT(db->db_data_pending == NULL); | |
- | |
+#ifdef _KERNEL | |
+ dbuf_dest(db, NULL); | |
+ free_page((unsigned long)db); | |
+#else | |
kmem_cache_free(dbuf_cache, db); | |
+#endif | |
arc_space_return(sizeof (dmu_buf_impl_t), ARC_SPACE_OTHER); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment