diff --git a/sys/vfs/hammer/hammer_btree.c b/sys/vfs/hammer/hammer_btree.c index 6165ae5..278af54 100644 --- a/sys/vfs/hammer/hammer_btree.c +++ b/sys/vfs/hammer/hammer_btree.c @@ -2398,6 +2398,7 @@ btree_remove(hammer_cursor_t cursor) * another thread wiggles an insertion in during an * iteration. */ + kprintf("DEBUG: %s set iterate_check\n", __func__); cursor->flags |= HAMMER_CURSOR_ITERATE_CHECK; error = hammer_cursor_up(cursor); } diff --git a/sys/vfs/hammer/hammer_cursor.c b/sys/vfs/hammer/hammer_cursor.c index c71ff8f..c9ac345 100644 --- a/sys/vfs/hammer/hammer_cursor.c +++ b/sys/vfs/hammer/hammer_cursor.c @@ -970,6 +970,7 @@ hammer_cursor_removed_node(hammer_node_t node, hammer_node_t parent, int index) if (cursor->leaf == &ondisk->elms[cursor->index].leaf) cursor->leaf = NULL; cursor->flags |= HAMMER_CURSOR_TRACKED_RIPOUT; + kprintf("DEBUG: %s set iterate_check\n", __func__); cursor->flags |= HAMMER_CURSOR_ITERATE_CHECK; cursor->node = parent; cursor->index = index; diff --git a/sys/vfs/hammer/hammer_ioctl.c b/sys/vfs/hammer/hammer_ioctl.c index 267ded3..0812eb7 100644 --- a/sys/vfs/hammer/hammer_ioctl.c +++ b/sys/vfs/hammer/hammer_ioctl.c @@ -34,6 +34,7 @@ * $DragonFly: src/sys/vfs/hammer/hammer_ioctl.c,v 1.32 2008/11/13 02:23:29 dillon Exp $ */ +#include #include "hammer.h" static int hammer_ioc_gethistory(hammer_transaction_t trans, hammer_inode_t ip, @@ -48,6 +49,8 @@ static int hammer_ioc_set_version(hammer_transaction_t trans, struct hammer_ioc_version *ver); static int hammer_ioc_get_info(hammer_transaction_t trans, struct hammer_ioc_info *info); +static int hammer_ioc_dummy(hammer_transaction_t trans, hammer_inode_t ip, + struct hammer_ioc_dummy *info); static int hammer_ioc_add_snapshot(hammer_transaction_t trans, hammer_inode_t ip, struct hammer_ioc_snapshot *snap); static int hammer_ioc_del_snapshot(hammer_transaction_t trans, hammer_inode_t ip, @@ -228,6 +231,12 @@ hammer_ioctl(hammer_inode_t ip, u_long com, caddr_t data, int fflag, &trans, ip, (struct hammer_ioc_data *)data); } break; + case HAMMERIOC_DUMMY: + if (error == 0) { + error = hammer_ioc_dummy( + &trans, ip, (struct hammer_ioc_dummy *)data); + } + break; default: error = EOPNOTSUPP; break; @@ -571,7 +580,7 @@ hammer_ioc_set_version(hammer_transaction_t trans, hammer_inode_t ip, struct hammer_cursor cursor; hammer_volume_t volume; int error; - int over = hmp->version; +int over = hmp->version; /* * Generally do not allow downgrades. However, version 4 can @@ -978,7 +987,6 @@ again: leaf.base.localization = ip->obj_localization + HAMMER_LOCALIZE_INODE; leaf.base.key = 0; /* page 0 */ leaf.data_len = sizeof(struct hammer_config_data); - cursor.key_beg = leaf.base; cursor.asof = HAMMER_MAX_TID; @@ -1019,6 +1027,96 @@ again: } static +void +print_elm(const char *str, struct hammer_base_elm *elm) +{ + kprintf("DEBUG: [%s] objid: %016jx key: %016jx loc: %08x ctid: %016jx dtid: %016jx rectype=%d objtype=%d btype=%d\n", + str, elm->obj_id, elm->key, elm->localization, elm->create_tid, elm->delete_tid, elm->rec_type, elm->obj_type, elm->btype); + +} + +static +void +print_pfs(const char *str, struct hammer_pseudofs_data *pfs) +{ + char *uuid1, *uuid2; + int s1, s2; + + s1 = s2 = 0; + uuid_to_string(&pfs->unique_uuid, &uuid1, &s1); + uuid_to_string(&pfs->shared_uuid, &uuid2, &s2); + kprintf("DEBUG [%s] ltid=%016jx btid=%016jx etid=%016jx bts=%ju ets=%ju " + "uniq=%s shared=%s lbl=%s snaps=%s\n", str, pfs->sync_low_tid, pfs->sync_beg_tid, + pfs->sync_end_tid, pfs->sync_beg_ts, pfs->sync_end_ts, uuid1, uuid2, pfs->label, + pfs->snapshots); +} +static +int +hammer_ioc_dummy(hammer_transaction_t trans, hammer_inode_t ip, struct hammer_ioc_dummy *data) +{ + struct hammer_cursor cursor; + hammer_node_ondisk_t dsknode; + u_int32_t localization; + char *str; + int status = 0; + int error; + + kprintf("DEBUG: obj_loc: %08x\n", (int)(ip->obj_localization >> 16)); + localization = 0; + error = hammer_init_cursor(trans, &cursor, NULL, NULL); + if (error) { + hammer_done_cursor(&cursor); + return -1; + } + + cursor.key_beg.localization = HAMMER_DEF_LOCALIZATION + + HAMMER_LOCALIZE_MISC; + cursor.key_beg.obj_id = HAMMER_OBJID_ROOT; + cursor.key_beg.create_tid = 0; + cursor.key_beg.delete_tid = 0; + cursor.key_beg.rec_type = HAMMER_RECTYPE_PFS; + cursor.key_beg.obj_type = 0; + cursor.key_beg.key = localization; + cursor.key_end = cursor.key_beg; + cursor.key_end.key = HAMMER_MAX_KEY; + cursor.asof = HAMMER_MAX_TID; + cursor.flags |= HAMMER_CURSOR_ASOF; + + error = hammer_btree_first(&cursor); + while (error == 0) { + if (error) { + kprintf("DEBUG: NO record\n"); + } else { + error = hammer_ip_resolve_data(&cursor); + if (error) + kprintf("DEBUG: Failed to resolve cursor data\n"); + else { + dsknode = cursor.node->ondisk; + uuid_to_string(&cursor.data->pfsd.unique_uuid, &str, &status); + print_elm("leaf", &cursor.leaf->base); +// print_elm("key_beg", &cursor.key_beg); +// print_elm("key_end", &cursor.key_end); + if ((cursor.data->pfsd.mirror_flags & HAMMER_PFSD_DELETED) == 0) { + kprintf("# %u\n", (u_int32_t)(cursor.leaf->base.key >> 16)); + print_pfs(" PFS", &cursor.data->pfsd); + } + } +// cursor.key_beg.key += (1 << 16); +// cursor.key_end = cursor.key_beg; +// cursor.key_end.key = HAMMER_MAX_KEY; + + error = hammer_btree_iterate(&cursor); + if (error) + kprintf("DEBUG: Failed to ITERATE cursor\n"); + } + + } + hammer_done_cursor(&cursor); + + return 0; +} + +static int hammer_ioc_get_data(hammer_transaction_t trans, hammer_inode_t ip, struct hammer_ioc_data *data) diff --git a/sys/vfs/hammer/hammer_ioctl.h b/sys/vfs/hammer/hammer_ioctl.h index 6db417a..790ccbd 100644 --- a/sys/vfs/hammer/hammer_ioctl.h +++ b/sys/vfs/hammer/hammer_ioctl.h @@ -241,6 +241,12 @@ struct hammer_ioc_info { int64_t reservedext[16]; }; +struct hammer_ioc_dummy { + struct hammer_ioc_head head; + + int value; +}; + /* * HAMMERIOC_GET_PSEUDOFS * HAMMERIOC_SET_PSEUDOFS @@ -495,6 +501,6 @@ struct hammer_ioc_data { #define HAMMERIOC_DEDUP _IOWR('h',25,struct hammer_ioc_dedup) #define HAMMERIOC_GET_DATA _IOWR('h',26,struct hammer_ioc_data) #define HAMMERIOC_LIST_VOLUMES _IOWR('h',27,struct hammer_ioc_volume_list) +#define HAMMERIOC_DUMMY _IOWR('h',28, struct hammer_ioc_dummy) #endif -