Index: uspace/app/df/df.c
===================================================================
--- uspace/app/df/df.c	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/app/df/df.c	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -38,5 +38,5 @@
 #include <stdlib.h>
 #include <unistd.h>
-#include <stats.h>
+#include <sys/statfs.h>
 #include <errno.h>
 #include <adt/list.h>
@@ -59,7 +59,7 @@
 		mtab_ent_t *mtab_ent = list_get_instance(cur, mtab_ent_t,
 		    link);
-		if (statfs(mtab_ent->mp, &st) < 0)
+		if (statfs(/*mtab_ent->mp*/ "/data", &st) < 0)
 			return 1;
-	
+			
 		printf("%13s %15lld %9lld %9lld %3ld%% %s\n", 
 			mtab_ent->fs_name,
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -43,4 +43,5 @@
 #include <stdio.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <sys/types.h>
 #include <ipc/services.h>
@@ -892,21 +893,44 @@
 }
 
-int statfs(const char *path, struct statfs *buf)
-{
-	sysarg_t rc;
-	//aid_t req;
-
-	if ( NULL == buf )
-		return 1;
-
-	sysarg_t value;
-	async_exch_t *exch = vfs_exchange_begin();	
-	rc = async_req_0_1(exch, VFS_IN_STATFS, &value);
-	if (rc != EOK)
-		goto exit;
-
-	buf->f_bsize = value;
-exit:
-	vfs_exchange_end(exch);
+#include <stdio.h>
+int statfs(const char *path, struct statfs *statfs)
+{
+	sysarg_t rc;
+	sysarg_t rc_orig;
+	aid_t req;
+	size_t pa_size;
+	
+	char *pa = absolutize(path, &pa_size);
+	if (!pa)
+		return ENOMEM;
+	
+	async_exch_t *exch = vfs_exchange_begin();
+	
+	req = async_send_0(exch, VFS_IN_STATFS, NULL);
+	rc = async_data_write_start(exch, pa, pa_size);
+	if (rc != EOK) {
+		vfs_exchange_end(exch);
+		free(pa);
+		async_wait_for(req, &rc_orig);
+		if (rc_orig == EOK)
+			return (int) rc;
+		else
+			return (int) rc_orig;
+	}
+	printf("TRACE: send VFS_IN_STATFS\n");
+	rc = async_data_read_start(exch, statfs, sizeof(struct statfs));
+	if (rc != EOK) {
+		printf("TRACE: error reply\n");
+		vfs_exchange_end(exch);
+		free(pa);
+		async_wait_for(req, &rc_orig);
+		if (rc_orig == EOK)
+			return (int) rc;
+		else
+			return (int) rc_orig;
+	}
+	vfs_exchange_end(exch);
+	free(pa);
+	async_wait_for(req, &rc);
 	return rc;
 }
Index: uspace/lib/c/include/ipc/vfs.h
===================================================================
--- uspace/lib/c/include/ipc/vfs.h	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/c/include/ipc/vfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -99,5 +99,6 @@
 	VFS_OUT_LOOKUP,
 	VFS_OUT_DESTROY,
-	VFS_OUT_LAST
+	VFS_OUT_LAST,
+	VFS_OUT_STATFS
 } vfs_out_request_t;
 
Index: uspace/lib/c/include/sys/statfs.h
===================================================================
--- uspace/lib/c/include/sys/statfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
+++ uspace/lib/c/include/sys/statfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013 Manuele Conti
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_SYS_STATFS_H_
+#define LIBC_SYS_STATFS_H_
+
+#include <sys/types.h>
+
+struct statfs { 
+	short   f_type;     /* type of file system  */
+	long    f_bsize;    /* fundamental file system block size */
+	long    f_blocks;   /* total data blocks in file system */
+	long    f_bfree;    /* free blocks in fs */
+};
+
+extern int statfs(const char *, struct statfs *);
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/c/include/vfs/vfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -49,11 +49,4 @@
 };
 
-struct statfs { 
-	short   f_type;     /* type of file system  */
-	long    f_bsize;    /* fundamental file system block size */
-	long    f_blocks;   /* total data blocks in file system */
-	long    f_bfree;    /* free blocks in fs */
-};
-
 
 extern char *absolutize(const char *, size_t *);
@@ -70,5 +63,4 @@
 extern async_exch_t *vfs_exchange_begin(void);
 extern void vfs_exchange_end(async_exch_t *);
-extern int statfs(const char *path, struct statfs *buf);
 #endif
 
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/fs/libfs.c	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -45,4 +45,5 @@
 #include <mem.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <stdlib.h>
 
@@ -218,4 +219,35 @@
 	async_answer_0(rid, rc);
 }
+#include<stdio.h>
+static void vfs_out_statfs(ipc_callid_t rid, ipc_call_t *req)
+{	
+	printf("TRACE: vfs_out_statfs\n");
+	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
+	
+	fs_node_t *fn;
+	int rc = libfs_ops->node_get(&fn, service_id, index);
+	on_error(rc, answer_and_return(rid, rc));
+	
+	ipc_callid_t callid;
+	size_t size;
+	if ((!async_data_read_receive(&callid, &size)) ||
+	    (size != sizeof(struct stat))) {
+		libfs_ops->node_put(fn);
+		async_answer_0(callid, EINVAL);
+		async_answer_0(rid, EINVAL);
+		return;
+	}
+	
+	struct statfs statfs;
+	memset(&statfs, 0, sizeof(struct statfs));
+	
+	statfs.f_bsize = libfs_ops->size_block(service_id);
+
+	libfs_ops->node_put(fn);
+	
+	async_data_read_finalize(callid, &statfs, sizeof(struct statfs));
+	async_answer_0(rid, EOK);
+}
 
 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
@@ -276,4 +308,7 @@
 		case VFS_OUT_SYNC:
 			vfs_out_sync(callid, &call);
+			break;
+		case VFS_OUT_STATFS:
+			vfs_out_statfs(callid, &call);
 			break;
 		default:
Index: uspace/lib/fs/libfs.h
===================================================================
--- uspace/lib/fs/libfs.h	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/fs/libfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -93,5 +93,5 @@
 	bool (* is_file)(fs_node_t *);
 	service_id_t (* service_get)(fs_node_t *);
-	unsigned int (* size_block)(fs_node_t *);
+	long (* size_block)(service_id_t);
 } libfs_ops_t;
 
Index: uspace/srv/fs/mfs/mfs_ops.c
===================================================================
--- uspace/srv/fs/mfs/mfs_ops.c	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/srv/fs/mfs/mfs_ops.c	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -64,5 +64,5 @@
 static int mfs_check_sanity(struct mfs_sb_info *sbi);
 static bool is_power_of_two(uint32_t n);
-static unsigned int mfs_size_block(fs_node_t *fsnode);
+static long mfs_size_block(service_id_t service_id);
 
 static hash_table_t open_nodes;
@@ -1138,11 +1138,17 @@
 }
 
-static unsigned int
-mfs_size_block(fs_node_t *fsnode)
-{
-	if ( NULL == fsnode )
-		return 0;
-	/* Get block size from superblock */
-	return 512;
+static long
+mfs_size_block(service_id_t service_id)
+{
+	long block_size;
+
+	struct mfs_instance *inst;
+	int rc = mfs_instance_get(service_id, &inst);
+	if (rc != EOK)
+		return rc;
+	if (NULL == inst)
+		return ENOENT;
+	block_size = inst->sbi->block_size;	
+	return block_size;
 }
 
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/srv/vfs/vfs_ops.c	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -1420,9 +1420,54 @@
 void vfs_statfs(ipc_callid_t rid, ipc_call_t *request)
 {
-	long long reply;
-
-	/* Get information about fs */
-	reply = 512;
-	async_answer_1(rid, EOK, reply);
+	char *path;
+	int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
+	if (rc != EOK) {
+		async_answer_0(rid, rc);
+		return;
+	}
+	
+	ipc_callid_t callid;
+	if (!async_data_read_receive(&callid, NULL)) {
+		free(path);
+		async_answer_0(callid, EINVAL);
+		async_answer_0(rid, EINVAL);
+		return;
+	}
+
+	vfs_lookup_res_t lr;
+	fibril_rwlock_read_lock(&namespace_rwlock);
+	rc = vfs_lookup_internal(path, L_NONE, &lr, NULL);
+	free(path);
+	if (rc != EOK) {
+		fibril_rwlock_read_unlock(&namespace_rwlock);
+		async_answer_0(callid, rc);
+		async_answer_0(rid, rc);
+		return;
+	}
+	vfs_node_t *node = vfs_node_get(&lr);
+	if (!node) {
+		fibril_rwlock_read_unlock(&namespace_rwlock);
+		async_answer_0(callid, ENOMEM);
+		async_answer_0(rid, ENOMEM);
+		return;
+	}
+
+	fibril_rwlock_read_unlock(&namespace_rwlock);
+
+	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
+	
+	aid_t msg;
+	msg = async_send_3(exch, VFS_OUT_STATFS, node->service_id,
+	    node->index, false, NULL);
+	async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
+	
+	vfs_exchange_release(exch);
+	
+	sysarg_t rv;
+	async_wait_for(msg, &rv);
+
+	async_answer_0(rid, rv);
+
+	vfs_node_put(node);
 }
 
