Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision a8c14aaaabfdb8b0dee98a94535967e5153f558b)
+++ uspace/srv/fs/fat/fat_fat.c	(revision 88a27f104d147232adae7ffc1f735ff60014b3cf)
@@ -285,5 +285,5 @@
 }
 
-/** Get cluster from the first FAT.
+/** Get cluster from the first FAT. FAT12 version
  *
  * @param bs		Buffer holding the boot sector for the file system.
@@ -295,5 +295,5 @@
  */
 int
-fat_get_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+fat_get_cluster_fat12(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t *value)
 {
@@ -302,10 +302,5 @@
 	int rc;
 
-	assert(fatno < FATCNT(bs));
-	
-	if (FAT_IS_FAT12(bs))
-		offset = (clst + clst/2);
-	else
-		offset = (clst * FAT_CLST_SIZE(bs));
+	offset = (clst + clst/2);
 
 	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
@@ -314,51 +309,43 @@
 		return rc;
 
-	if (FAT_IS_FAT12(bs)) {
-		/* This cluster access spans a sector boundary. Check only for FAT12 */
-		if ((offset % BPS(bs) + 1 == BPS(bs))) {
-			/* Is it last sector of FAT? */
-			if (offset / BPS(bs) < SF(bs)) {
-				/* No. Reading next sector */
-				rc = block_get(&b1, devmap_handle, 1 + RSCNT(bs) +
-					SF(bs)*fatno + offset / BPS(bs), BLOCK_FLAGS_NONE);
-				if (rc != EOK) {
-					block_put(b);
-					return rc;
-				}
-				/*
-				* Combining value with last byte of current sector and
-				* first byte of next sector
-				*/
-				*value  = *(uint8_t *)(b->data + BPS(bs) - 1);
-				*value |= *(uint8_t *)(b1->data) << 8;
-
-				rc = block_put(b1);
-				if (rc != EOK) {
-					block_put(b);
-					return rc;
-				}
+	/* This cluster access spans a sector boundary. Check only for FAT12 */
+	if ((offset % BPS(bs) + 1 == BPS(bs))) {
+		/* Is it last sector of FAT? */
+		if (offset / BPS(bs) < SF(bs)) {
+			/* No. Reading next sector */
+			rc = block_get(&b1, devmap_handle, 1 + RSCNT(bs) +
+				SF(bs)*fatno + offset / BPS(bs), BLOCK_FLAGS_NONE);
+			if (rc != EOK) {
+				block_put(b);
+				return rc;
 			}
-			else {
-				/* Yes. It is last sector of FAT */
+			/*
+			* Combining value with last byte of current sector and
+			* first byte of next sector
+			*/
+			*value  = *(uint8_t *)(b->data + BPS(bs) - 1);
+			*value |= *(uint8_t *)(b1->data) << 8;
+
+			rc = block_put(b1);
+			if (rc != EOK) {
 				block_put(b);
-				return ERANGE;
+				return rc;
 			}
 		}
-		else
-			*value = *(uint16_t *)(b->data + offset % BPS(bs));
-
-		if (IS_ODD(clst))
-			*value = (*value) >> 4;
-		else
-			*value = (*value) & FAT12_MASK;
-	}
-	else {
-		if (FAT_IS_FAT32(bs))
-			*value = *(uint32_t *)(b->data + offset % BPS(bs)) & FAT32_MASK;
-		else
-			*value = *(uint16_t *)(b->data + offset % BPS(bs));
-	}
-
-	*value = uint32_t_le2host(*value);
+		else {
+			/* Yes. It is last sector of FAT */
+			block_put(b);
+			return ERANGE;
+		}
+	}
+	else
+		*value = *(uint16_t *)(b->data + offset % BPS(bs));
+
+	if (IS_ODD(clst))
+		*value = (*value) >> 4;
+	else
+		*value = (*value) & FAT12_MASK;
+
+	*value = uint16_t_le2host(*value);
 	rc = block_put(b);
 
@@ -366,5 +353,95 @@
 }
 
-/** Set cluster in one instance of FAT.
+/** Get cluster from the first FAT. FAT16 version
+ *
+ * @param bs		Buffer holding the boot sector for the file system.
+ * @param devmap_handle	Device handle for the file system.
+ * @param clst		Cluster which to get.
+ * @param value		Output argument holding the value of the cluster.
+ *
+ * @return		EOK or a negative error code.
+ */
+int
+fat_get_cluster_fat16(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+    fat_cluster_t clst, fat_cluster_t *value)
+{
+	block_t *b;
+	aoff64_t offset;
+	int rc;
+
+	offset = (clst * FAT16_CLST_SIZE);
+
+	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
+	    offset / BPS(bs), BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		return rc;
+
+	*value = uint16_t_le2host(*(uint16_t *)(b->data + offset % BPS(bs)));
+
+	rc = block_put(b);
+
+	return rc;
+}
+
+/** Get cluster from the first FAT. FAT32 version
+ *
+ * @param bs		Buffer holding the boot sector for the file system.
+ * @param devmap_handle	Device handle for the file system.
+ * @param clst		Cluster which to get.
+ * @param value		Output argument holding the value of the cluster.
+ *
+ * @return		EOK or a negative error code.
+ */
+int
+fat_get_cluster_fat32(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+    fat_cluster_t clst, fat_cluster_t *value)
+{
+	block_t *b;
+	aoff64_t offset;
+	int rc;
+
+	offset = (clst * FAT32_CLST_SIZE);
+
+	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
+	    offset / BPS(bs), BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		return rc;
+
+	*value = uint32_t_le2host(*(uint32_t *)(b->data + offset % BPS(bs)) & FAT32_MASK);
+
+	rc = block_put(b);
+
+	return rc;
+}
+
+
+/** Get cluster from the first FAT.
+ *
+ * @param bs		Buffer holding the boot sector for the file system.
+ * @param devmap_handle	Device handle for the file system.
+ * @param clst		Cluster which to get.
+ * @param value		Output argument holding the value of the cluster.
+ *
+ * @return		EOK or a negative error code.
+ */
+int
+fat_get_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+    fat_cluster_t clst, fat_cluster_t *value)
+{
+	int rc;
+
+	assert(fatno < FATCNT(bs));
+
+	if (FAT_IS_FAT12(bs))
+		rc = fat_get_cluster_fat12(bs, devmap_handle, fatno, clst, value);
+	else if (FAT_IS_FAT32(bs))
+		rc = fat_get_cluster_fat32(bs, devmap_handle, fatno, clst, value);
+	else
+		rc = fat_get_cluster_fat16(bs, devmap_handle, fatno, clst, value);
+
+	return rc;
+}
+
+/** Set cluster in one instance of FAT. FAT12 version.
  *
  * @param bs		Buffer holding the boot sector for the file system.
@@ -377,5 +454,5 @@
  */
 int
-fat_set_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+fat_set_cluster_fat12(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t value)
 {
@@ -384,10 +461,5 @@
 	int rc;
 
-	assert(fatno < FATCNT(bs));
-
-	if (FAT_IS_FAT12(bs))
-		offset = (clst + clst/2);
-	else
-		offset = (clst * FAT_CLST_SIZE(bs));
+	offset = (clst + clst/2);
 
 	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
@@ -398,58 +470,49 @@
 	value = host2uint32_t_le(value);
 
-	if (FAT_IS_FAT12(bs)) {
-		uint16_t temp;
-		bool border = false;
-		/* This cluster access spans a sector boundary. Check only for FAT12 */
-		if (offset % BPS(bs)+1 == BPS(bs)) {
-			/* Is it last sector of FAT? */
-			if (offset / BPS(bs) < SF(bs)) {
-				/* No. Reading next sector */
-				rc = block_get(&b1, devmap_handle, 1 + RSCNT(bs) +
-					SF(bs)*fatno + offset / BPS(bs), BLOCK_FLAGS_NONE);
-				if (rc != EOK) {
-					block_put(b);
-					return rc;
-				}
-				/*
-				* Combining value with last byte of current sector and
-				* first byte of next sector
-				*/
-				temp  = *(uint8_t *)(b->data + BPS(bs) - 1);
-				temp |= *(uint8_t *)(b1->data) << 8;
-				border = true;
+	uint16_t temp;
+	bool border = false;
+	/* This cluster access spans a sector boundary. Check only for FAT12 */
+	if (offset % BPS(bs)+1 == BPS(bs)) {
+		/* Is it last sector of FAT? */
+		if (offset / BPS(bs) < SF(bs)) {
+			/* No. Reading next sector */
+			rc = block_get(&b1, devmap_handle, 1 + RSCNT(bs) +
+				SF(bs)*fatno + offset / BPS(bs), BLOCK_FLAGS_NONE);
+			if (rc != EOK) {
+				block_put(b);
+				return rc;
 			}
-			else {
-				/* Yes. It is last sector of fat */
-				block_put(b);
-				return ERANGE;
-			}
-		}
-		else
-			temp = *(uint16_t *)(b->data + offset % BPS(bs));
-
-		if (IS_ODD(clst)) {
-			temp &= 0x000f;
-			temp |= value << 4;
+			/*
+			* Combining value with last byte of current sector and
+			* first byte of next sector
+			*/
+			temp  = *(uint8_t *)(b->data + BPS(bs) - 1);
+			temp |= *(uint8_t *)(b1->data) << 8;
+			border = true;
 		}
 		else {
-			temp &= 0xf000;
-			temp |= value & FAT12_MASK;
-		}
-
-		if (border) {
-			*(uint8_t *)(b->data + BPS(bs) - 1) = temp & 0xff;
-			*(uint8_t *)(b1->data) = temp >> 8;
-			b1->dirty = true;
-		} else
-			*(uint16_t *)(b->data + offset % BPS(bs)) = temp;
+			/* Yes. It is last sector of fat */
+			block_put(b);
+			return ERANGE;
+		}
+	}
+	else
+		temp = *(uint16_t *)(b->data + offset % BPS(bs));
+
+	if (IS_ODD(clst)) {
+		temp &= 0x000f;
+		temp |= value << 4;
 	}
 	else {
-		if (FAT_IS_FAT32(bs)) {
-			*(uint32_t *)(b->data + offset % BPS(bs)) &= 0xf0000000;
-			*(uint32_t *)(b->data + offset % BPS(bs)) |= (value & FAT32_MASK);
-		} else
-			*(uint16_t *)(b->data + offset % BPS(bs)) = value;
-	}
+		temp &= 0xf000;
+		temp |= value & FAT12_MASK;
+	}
+
+	if (border) {
+		*(uint8_t *)(b->data + BPS(bs) - 1) = temp & 0xff;
+		*(uint8_t *)(b1->data) = temp >> 8;
+		b1->dirty = true;
+	} else
+		*(uint16_t *)(b->data + offset % BPS(bs)) = temp;
 
 	if (b1 && b1->dirty) {
@@ -463,4 +526,98 @@
 	b->dirty = true;	/* need to sync block */
 	rc = block_put(b);
+	return rc;
+}
+
+/** Set cluster in one instance of FAT. FAT16 version.
+ *
+ * @param bs		Buffer holding the boot sector for the file system.
+ * @param devmap_handle	Device handle for the file system.
+ * @param fatno		Number of the FAT instance where to make the change.
+ * @param clst		Cluster which is to be set.
+ * @param value		Value to set the cluster with.
+ *
+ * @return		EOK on success or a negative error code.
+ */
+int
+fat_set_cluster_fat16(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+    fat_cluster_t clst, fat_cluster_t value)
+{
+	block_t *b;
+	aoff64_t offset;
+	int rc;
+
+	offset = (clst * FAT16_CLST_SIZE);
+
+	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
+	    offset / BPS(bs), BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		return rc;
+
+	*(uint16_t *)(b->data + offset % BPS(bs)) = host2uint32_t_le(value);
+
+	b->dirty = true;	/* need to sync block */
+	rc = block_put(b);
+	return rc;
+}
+
+/** Set cluster in one instance of FAT. FAT32 version.
+ *
+ * @param bs		Buffer holding the boot sector for the file system.
+ * @param devmap_handle	Device handle for the file system.
+ * @param fatno		Number of the FAT instance where to make the change.
+ * @param clst		Cluster which is to be set.
+ * @param value		Value to set the cluster with.
+ *
+ * @return		EOK on success or a negative error code.
+ */
+int
+fat_set_cluster_fat32(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+    fat_cluster_t clst, fat_cluster_t value)
+{
+	block_t *b;
+	aoff64_t offset;
+	int rc;
+
+	offset = (clst * FAT32_CLST_SIZE);
+
+	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
+	    offset / BPS(bs), BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		return rc;
+
+	value = host2uint32_t_le(value);
+	*(uint32_t *)(b->data + offset % BPS(bs)) &= 0xf0000000;
+	*(uint32_t *)(b->data + offset % BPS(bs)) |= (value & FAT32_MASK);
+
+	b->dirty = true;	/* need to sync block */
+	rc = block_put(b);
+	return rc;
+}
+
+/** Set cluster in one instance of FAT.
+ *
+ * @param bs		Buffer holding the boot sector for the file system.
+ * @param devmap_handle	Device handle for the file system.
+ * @param fatno		Number of the FAT instance where to make the change.
+ * @param clst		Cluster which is to be set.
+ * @param value		Value to set the cluster with.
+ *
+ * @return		EOK on success or a negative error code.
+ */
+int
+fat_set_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
+    fat_cluster_t clst, fat_cluster_t value)
+{
+	int rc;
+
+	assert(fatno < FATCNT(bs));
+
+	if (FAT_IS_FAT12(bs))
+		rc = fat_set_cluster_fat12(bs, devmap_handle, fatno, clst, value);
+	else if (FAT_IS_FAT32(bs))
+		rc = fat_set_cluster_fat32(bs, devmap_handle, fatno, clst, value);
+	else
+		rc = fat_set_cluster_fat16(bs, devmap_handle, fatno, clst, value);
+
 	return rc;
 }
Index: uspace/srv/fs/fat/fat_fat.h
===================================================================
--- uspace/srv/fs/fat/fat_fat.h	(revision a8c14aaaabfdb8b0dee98a94535967e5153f558b)
+++ uspace/srv/fs/fat/fat_fat.h	(revision 88a27f104d147232adae7ffc1f735ff60014b3cf)
@@ -44,10 +44,4 @@
 #define FAT_CLST_FIRST	  0x0002
 
-#define FAT12_CLST_BAD	  0x0ff7
-#define FAT12_CLST_LAST1  0x0ff8
-#define FAT12_CLST_LAST8  0x0fff
-#define FAT16_CLST_BAD    0xfff7
-#define FAT16_CLST_LAST1  0xfff8
-#define FAT16_CLST_LAST8  0xffff
 #define FAT32_CLST_BAD    0x0ffffff7
 #define FAT32_CLST_LAST1  0x0ffffff8
@@ -86,14 +80,4 @@
 #define FAT_IS_FAT32(bs)	(CC(bs) >= FAT16_CLST_MAX)
 
-#define FAT_CLST_LAST1(bs) \
-    (FAT_IS_FAT12(bs) ? FAT12_CLST_LAST1 : \
-    (FAT_IS_FAT32(bs) ? FAT32_CLST_LAST1 : FAT16_CLST_LAST1))
-#define FAT_CLST_LAST8(bs) \
-    (FAT_IS_FAT12(bs) ? FAT12_CLST_LAST8 : \
-    (FAT_IS_FAT32(bs) ? FAT32_CLST_LAST8 : FAT16_CLST_LAST8))
-#define FAT_CLST_BAD(bs) \
-    (FAT_IS_FAT12(bs) ? FAT12_CLST_BAD : \
-    (FAT_IS_FAT32(bs) ? FAT32_CLST_BAD : FAT16_CLST_BAD))
-
 #define FAT_CLST_SIZE(bs) \
     (FAT_IS_FAT32(bs) ? FAT32_CLST_SIZE : FAT16_CLST_SIZE)
@@ -102,4 +86,8 @@
     (FAT_IS_FAT12(bs) ? FAT12_MASK : \
     (FAT_IS_FAT32(bs) ? FAT32_MASK : FAT16_MASK))
+
+#define FAT_CLST_LAST1(bs)      (FAT32_CLST_LAST1 & FAT_MASK((bs)))
+#define FAT_CLST_LAST8(bs)      (FAT32_CLST_LAST8 & FAT_MASK((bs)))
+#define FAT_CLST_BAD(bs)        (FAT32_CLST_BAD & FAT_MASK((bs)))
 
 #define FAT_ROOT_CLST(bs) \
@@ -133,6 +121,18 @@
 extern int fat_alloc_shadow_clusters(struct fat_bs *, devmap_handle_t,
     fat_cluster_t *, unsigned);
+extern int fat_get_cluster_fat12(struct fat_bs *, devmap_handle_t, unsigned,
+    fat_cluster_t, fat_cluster_t *);
+extern int fat_get_cluster_fat16(struct fat_bs *, devmap_handle_t, unsigned,
+    fat_cluster_t, fat_cluster_t *);
+extern int fat_get_cluster_fat32(struct fat_bs *, devmap_handle_t, unsigned,
+    fat_cluster_t, fat_cluster_t *);
 extern int fat_get_cluster(struct fat_bs *, devmap_handle_t, unsigned,
     fat_cluster_t, fat_cluster_t *);
+extern int fat_set_cluster_fat12(struct fat_bs *, devmap_handle_t, unsigned,
+    fat_cluster_t, fat_cluster_t);
+extern int fat_set_cluster_fat16(struct fat_bs *, devmap_handle_t, unsigned,
+    fat_cluster_t, fat_cluster_t);
+extern int fat_set_cluster_fat32(struct fat_bs *, devmap_handle_t, unsigned,
+    fat_cluster_t, fat_cluster_t);
 extern int fat_set_cluster(struct fat_bs *, devmap_handle_t, unsigned,
     fat_cluster_t, fat_cluster_t);
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision a8c14aaaabfdb8b0dee98a94535967e5153f558b)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 88a27f104d147232adae7ffc1f735ff60014b3cf)
@@ -105,8 +105,8 @@
 	node->dirty = false;
 	node->lastc_cached_valid = false;
-	node->lastc_cached_value = FAT16_CLST_LAST1;
+	node->lastc_cached_value = FAT32_CLST_LAST1;
 	node->currc_cached_valid = false;
 	node->currc_cached_bn = 0;
-	node->currc_cached_value = FAT16_CLST_LAST1;
+	node->currc_cached_value = FAT32_CLST_LAST1;
 }
 
