+
+#ifdef DIRINFO_DEBUG
+ printf("e2fsck_get_dir_info %u...", ino);
+#endif
+
+#ifdef CONFIG_TDB
+ if (db->tdb) {
+ static struct dir_info ret_dir_info;
+ TDB_DATA key, data;
+ struct dir_info_ent *buf;
+
+ key.dptr = (unsigned char *) &ino;
+ key.dsize = sizeof(ext2_ino_t);
+
+ data = tdb_fetch(db->tdb, key);
+ if (!data.dptr) {
+ if (tdb_error(db->tdb) != TDB_ERR_NOEXIST)
+ printf("fetch failed: %s\n",
+ tdb_errorstr(db->tdb));
+ return 0;
+ }
+
+ buf = (struct dir_info_ent *) data.dptr;
+ ret_dir_info.ino = ino;
+ ret_dir_info.dotdot = buf->dotdot;
+ ret_dir_info.parent = buf->parent;
+#ifdef DIRINFO_DEBUG
+ printf("(%u,%u,%u)\n", ino, buf->dotdot, buf->parent);
+#endif
+ free(data.dptr);
+ return &ret_dir_info;
+ }
+#endif
+
+ if (db->last_lookup && db->last_lookup->ino == ino)
+ return db->last_lookup;
+
+ low = 0;
+ high = ctx->dir_info->count - 1;
+ if (ino == ctx->dir_info->array[low].ino) {
+#ifdef DIRINFO_DEBUG
+ printf("(%u,%u,%u)\n", ino,
+ ctx->dir_info->array[low].dotdot,
+ ctx->dir_info->array[low].parent);
+#endif
+ return &ctx->dir_info->array[low];
+ }
+ if (ino == ctx->dir_info->array[high].ino) {
+#ifdef DIRINFO_DEBUG
+ printf("(%u,%u,%u)\n", ino,
+ ctx->dir_info->array[high].dotdot,
+ ctx->dir_info->array[high].parent);
+#endif
+ return &ctx->dir_info->array[high];
+ }