65 Commits

Author SHA1 Message Date
Azat Khuzhin
031f974c36 fix another inode leaking in simplefs_create_fs_object()
There we iterate over inodes using simplefs_get_inode(), while instead
we already have last inode number, just use it instead, and increment
some paddings to it (start inode, reserved inodes).

And form after this patch kedr shows that there is no leaks.
(but we must recheck it in the future.)
2013-09-30 02:34:05 +04:00
Azat Khuzhin
98bbe99632 Fix leaking of inode memory.
Release bh in simplefs_get_inode() and use kmalloc() instead, and also
add super_operations.destory_inode handler, to free allocated memory.

This is not optimal and it must be replaced by slab allocators.
2013-09-30 02:13:24 +04:00
Azat Khuzhin
7130573869 read: drop static "done" variable, we already have file_size in inode. 2013-09-29 20:22:03 +04:00
Azat Khuzhin
d976c4f65e test: read file after truncate it to more smaller size.
Just write less bytes.
2013-09-29 20:18:49 +04:00
Azat Khuzhin
d67a2974e5 test: add some read operations after unmount/mount 2013-09-29 20:12:51 +04:00
Azat Khuzhin
86d7a8ff80 Add new helper - simplefs_inode_save()
And use it next functions:
- simplefs_write()
- simplefs_create_fs_object()
2013-09-29 20:01:35 +04:00
Azat Khuzhin
2d95ccf1a3 Start implementing verbose logging depends on macros. (SIMPLEFS_DEBUG)
In many cases we don't need such verbose loggin, just add macros to
print loggin only if SIMPLEFS_DEBUG isset.
And it will be installed by default. (in Makefile)
2013-09-29 18:09:44 +04:00
Azat Khuzhin
f9aa71628d Add new helper simplefs_inode_search() 2013-09-29 16:41:48 +04:00
Azat Khuzhin
c199cecbce simplefs_create_fs_object(): release mutexes when we can't acquire sb_lock
We need more pretty code for this.
2013-09-25 18:09:01 +04:00
Azat Khuzhin
ee1efa11df sb: use s_maxbytes field instead of hardcoded check in simplefs_write()
generic_write_checks() will do this for us now, using s_maxbytes field
from sb.
2013-09-25 15:41:39 +04:00
Azat Khuzhin
ab68a5176a simplefs_write(): use generic_write_checks() 2013-09-25 15:36:01 +04:00
Azat Khuzhin
274a98ae14 Add TODO about moving version depend code into separate header. 2013-09-25 00:48:31 +04:00
Azat Khuzhin
f72fbd4db6 Add new const SIMPLEFS_START_INO instead of magic number 2013-09-18 23:43:50 +04:00
Azat Khuzhin
f61cf26333 simple.h: drop trailing whitespaces 2013-09-18 23:43:17 +04:00
Azat Khuzhin
82a2041957 simplefs_create_fs_object(): avoid extra allocation of memory
We can just use already existed bh->b_data for this, and copy filename
and inode number directly to it.
2013-09-18 23:17:42 +04:00
Azat Khuzhin
0e14ca0edc simplefs_fill_super() drop deprecated FIXME (see 9aee1ce) 2013-09-18 23:07:11 +04:00
Azat Khuzhin
569e7cd0ce mkfs: avoid leaking of "block_padding" 2013-09-18 23:00:34 +04:00
Azat Khuzhin
1a11834f73 Add shell script to do some simple operations with simplefs
- create fs
- create files in it
- create dirs in it
- read files in it
- write files in it
2013-09-17 23:07:13 +04:00
Azat Khuzhin
3cae84d822 Drop explicit cast sb_bread() return value to buffer_head
Since sb_bread() already have such a return value.
2013-09-16 02:31:13 +04:00
Azat Khuzhin
9aee1ce302 Release bh in simplefs_fill_super() 2013-09-16 02:28:46 +04:00
Azat Khuzhin
90ca0e557c Add FS_REQUIRES_DEV to fs_flags 2013-09-16 02:13:52 +04:00
Azat Khuzhin
23d554cda7 Use kill_block_super() in simplefs_kill_superblock() 2013-09-16 02:12:45 +04:00
Azat Khuzhin
8382ab7e81 simple.c: drop trailing whitespace 2013-09-16 02:10:49 +04:00
Azat Khuzhin
6d606a796c simplefs_create_fs_object: fix memory leaking of temporary record 2013-09-14 13:48:15 +04:00
Azat Khuzhin
a315571b05 Use d_alloc_root() instead of d_make_root() in linux kernel < 3.3
d_alloc_root() is gone in 32991ab305ace7017c62f8eecbe5eb36dc32e13b.

Link: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=32991ab305ace7017c62f8eecbe5eb36dc32e13b
2013-09-10 23:45:45 +04:00
Azat Khuzhin
18df3131a2 Don't change filp->f_pos in fops->iterate. (linux kernel >= 3.11)
iterate_dir() already change filp->f_pos (using ctx->f_pos).
Thanks to Ivan.

Discussion: 3f472cec01 (commitcomment-4057234)
2013-09-10 22:21:59 +04:00
Sankar சங்கர்
83cf8c8906 Update README 2013-08-15 14:51:20 +05:30
Sankar சங்கர்
2be71baea4 Merge pull request #2 from azat/fix-includes
Use "" instead of <> to include files from simplefs
2013-08-15 02:15:47 -07:00
Sankar சங்கர்
3f472cec01 Merge pull request #1 from azat/readdir-to-iterate
Implement file_operations.iterate instead of deprecated readdir
2013-08-15 02:14:53 -07:00
Azat Khuzhin
b42b87a9bc Implement file_operations.iterate instead of deprecated readdir
In newer version of kernel, since 3.11, readdir was dropped and the
replacment is iterate.
2013-08-15 01:08:56 +04:00
Azat Khuzhin
000b97517f Use "" instead of <> to include files from simplefs 2013-08-15 00:58:44 +04:00
Sankar சங்கர்
0d484e8e3b Update README for the 1.0 release 1.0 2013-08-06 21:15:01 +05:30
Sankar சங்கர்
46c5efbd1e Update README with test instructions covering all supported filesystem operations 2013-08-05 22:47:32 +05:30
Sankar சங்கர்
7e6b073449 Update parent directory inode children count on new file/subdir creation. 2013-08-05 22:46:19 +05:30
Sankar சங்கர்
bcd9210b10 Update CREDITS 2013-07-28 22:48:11 +05:30
Sankar சங்கர்
39b8ce10aa Update README with TODO and test instructions 2013-07-28 22:44:10 +05:30
Sankar சங்கர்
4032ad3c09 Update README with architecture notes 2013-07-28 22:37:37 +05:30
Sankar சங்கர்
59ebefe597 Added a LICENSE file explicitly 2013-07-28 22:37:15 +05:30
Sankar சங்கர்
30a0ffafe4 Update README with build and testing instructions 2013-07-28 21:32:06 +05:30
Sankar சங்கர்
a68d101c93 basic write support 2013-07-28 21:26:46 +05:30
Sankar சங்கர்
22f33bcd32 mkidr support for simplefs 2013-07-27 18:45:38 +05:30
Sankar சங்கர்
6c591e9eb3 create file support 2013-07-27 01:02:11 +05:30
Sankar சங்கர்
356bceb273 read support for existing files 2013-07-24 17:29:50 +05:30
Sankar சங்கர்
a96e3142dd Code comments 2013-04-23 14:42:36 +05:30
Sankar சங்கர்
3ad58de506 Lindent sources 2013-04-23 14:29:30 +05:30
Sankar சங்கர்
b5aa56df68 readdir and lookup support so ls works fine without errors 2013-04-23 14:27:02 +05:30
Sankar சங்கர்
233991006f Update README with the latest build/test/debug instructions 2013-04-22 23:58:35 +05:30
Sankar சங்கர்
f5cf481557 mkfs creates a welcome file. readdir(ls) tries to list this file 2013-04-22 23:53:59 +05:30
Sankar சங்கர்
fec3cb7f9b Added a convenince inline function for generic inode to simplefs inode conversion 2013-04-22 21:16:25 +05:30
Sankar சங்கர்
c8275e0bf6 Start using the convenience inline functions 2013-04-22 21:12:52 +05:30