Index: uspace/srv/fs/fat/fat_idx.c
===================================================================
--- uspace/srv/fs/fat/fat_idx.c	(revision ac49f5d191c87e582124edc9c891664f85efefd6)
+++ uspace/srv/fs/fat/fat_idx.c	(revision 9a3d5f0d0c12e51832c4770d65a3472c07e267b1)
@@ -339,4 +339,50 @@
 }
 
+static fat_idx_t *fat_idx_get_new_core(dev_handle_t dev_handle)
+{
+	fat_idx_t *fidx;
+
+	fidx = (fat_idx_t *) malloc(sizeof(fat_idx_t));
+	if (!fidx) 
+		return NULL;
+	if (!fat_idx_alloc(dev_handle, &fidx->index)) {
+		free(fidx);
+		return NULL;
+	}
+		
+	link_initialize(&fidx->uph_link);
+	link_initialize(&fidx->uih_link);
+	futex_initialize(&fidx->lock, 1);
+	fidx->dev_handle = dev_handle;
+	fidx->pfc = FAT_CLST_RES0;	/* no parent yet */
+	fidx->pdi = 0;
+	fidx->nodep = NULL;
+
+	return fidx;
+}
+
+fat_idx_t *fat_idx_get_new(dev_handle_t dev_handle)
+{
+	fat_idx_t *fidx;
+
+	futex_down(&used_futex);
+	fidx = fat_idx_get_new_core(dev_handle);
+	if (!fidx) {
+		futex_up(&used_futex);
+		return NULL;
+	}
+		
+	unsigned long ikey[] = {
+		[UIH_DH_KEY] = dev_handle,
+		[UIH_INDEX_KEY] = fidx->index,
+	};
+	
+	hash_table_insert(&ui_hash, ikey, &fidx->uih_link);
+	futex_down(&fidx->lock);
+	futex_up(&used_futex);
+
+	return fidx;
+}
+
 fat_idx_t *
 fat_idx_get_by_pos(dev_handle_t dev_handle, fat_cluster_t pfc, unsigned pdi)
@@ -355,11 +401,6 @@
 		fidx = hash_table_get_instance(l, fat_idx_t, uph_link);
 	} else {
-		fidx = (fat_idx_t *) malloc(sizeof(fat_idx_t));
+		fidx = fat_idx_get_new_core(dev_handle);
 		if (!fidx) {
-			futex_up(&used_futex);
-			return NULL;
-		}
-		if (!fat_idx_alloc(dev_handle, &fidx->index)) {
-			free(fidx);
 			futex_up(&used_futex);
 			return NULL;
@@ -371,11 +412,6 @@
 		};
 	
-		link_initialize(&fidx->uph_link);
-		link_initialize(&fidx->uih_link);
-		futex_initialize(&fidx->lock, 1);
-		fidx->dev_handle = dev_handle;
 		fidx->pfc = pfc;
 		fidx->pdi = pdi;
-		fidx->nodep = NULL;
 
 		hash_table_insert(&up_hash, pkey, &fidx->uph_link);
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision ac49f5d191c87e582124edc9c891664f85efefd6)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 9a3d5f0d0c12e51832c4770d65a3472c07e267b1)
@@ -103,35 +103,7 @@
 }
 
-/** Internal version of fat_node_get().
- *
- * @param idxp		Locked index structure.
- */
-static void *fat_node_get_core(fat_idx_t *idxp)
-{
-	block_t *b;
-	fat_bs_t *bs;
-	fat_dentry_t *d;
-	fat_node_t *nodep = NULL;
-	unsigned bps;
-	unsigned spc;
-	unsigned dps;
-
-	if (idxp->nodep) {
-		/*
-		 * We are lucky.
-		 * The node is already instantiated in memory.
-		 */
-		futex_down(&idxp->nodep->lock);
-		if (!idxp->nodep->refcnt++)
-			list_remove(&idxp->nodep->ffn_link);
-		futex_up(&idxp->nodep->lock);
-		return idxp->nodep;
-	}
-
-	/*
-	 * We must instantiate the node from the file system.
-	 */
-	
-	assert(idxp->pfc);
+static fat_node_t *fat_node_get_new(void)
+{
+	fat_node_t *nodep;
 
 	futex_down(&ffn_futex);
@@ -163,4 +135,43 @@
 	}
 	fat_node_initialize(nodep);
+	
+	return nodep;
+}
+
+/** Internal version of fat_node_get().
+ *
+ * @param idxp		Locked index structure.
+ */
+static void *fat_node_get_core(fat_idx_t *idxp)
+{
+	block_t *b;
+	fat_bs_t *bs;
+	fat_dentry_t *d;
+	fat_node_t *nodep = NULL;
+	unsigned bps;
+	unsigned spc;
+	unsigned dps;
+
+	if (idxp->nodep) {
+		/*
+		 * We are lucky.
+		 * The node is already instantiated in memory.
+		 */
+		futex_down(&idxp->nodep->lock);
+		if (!idxp->nodep->refcnt++)
+			list_remove(&idxp->nodep->ffn_link);
+		futex_up(&idxp->nodep->lock);
+		return idxp->nodep;
+	}
+
+	/*
+	 * We must instantiate the node from the file system.
+	 */
+	
+	assert(idxp->pfc);
+
+	nodep = fat_node_get_new();
+	if (!nodep)
+		return NULL;
 
 	bs = block_bb_get(idxp->dev_handle);
