From: "edison.jiang" <jiangzhipeng@xxxxxxxxxx> Android-R /sdcard mount FUSE filesystem type, use "dd" command to filli up /sdcard dir, Android will not boot normal, becase this system need at least 128M userspace. Test: open adb port, adb shell "dd if=dev/zero of=sdcard/ae bs=1024000 count=xxx" Result: if not limit size,Android system can not boot normal. Signed-off-by: edison.jiang <jiangzhipeng@xxxxxxxxxx> --- fs/fuse/inode.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index b0e18b4..f4e54505 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -477,6 +477,21 @@ static void convert_fuse_statfs(struct kstatfs *stbuf, struct fuse_kstatfs *attr stbuf->f_files = attr->files; stbuf->f_ffree = attr->ffree; stbuf->f_namelen = attr->namelen; +#ifdef LIMIT_SDCARD_SIZE + u32 data_free_size_th = 128*1024*1024; + + stbuf->f_blocks -= (u32)data_free_size_th/attr->bsize; + + if (stbuf->f_bfree < ((u32)data_free_size_th/attr->bsize)) + stbuf->f_bfree = 0; + else + stbuf->f_bfree -= (u32)data_free_size_th/attr->bsize; + + if (stbuf->f_bavail < ((u32)data_free_size_th/attr->bsize)) + stbuf->f_bavail = 0; + else + stbuf->f_bavail -= (u32)data_free_size_th/attr->bsize; +#endif /* fsid is left zero */ } -- 1.9.1