summaryrefslogtreecommitdiffstats
path: root/fs/ramfs.c
Commit message (Collapse)AuthorAgeFilesLines
* fs: ramfs: Drop unnecessary check in ramfs_mknod()Andrey Smirnov2019-03-131-4/+2
| | | | | | | | There's already an early exit statement triggered by "inode" being NULL. Drop an extra check that will always be true. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ramfs: Drop unused 'chunks' conterAndrey Smirnov2019-03-131-4/+0
| | | | | | | This variable doesn't appear to be used anywhere in the code. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ramfs: Drop unused 'handle' filed from struct ramfs_inodeAndrey Smirnov2019-03-131-2/+0
| | | | | | | There are no users of this field in the code. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ramfs: Drop needless OOM checkAndrey Smirnov2019-02-271-2/+0
| | | | | | | Drop needless OOM check since xzalloc() will never return NULL. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: let truncate take a loff_t argumentSascha Hauer2019-02-061-1/+1
| | | | | | | loff_t is the correct type for file sizes. Use it to allow to truncate to sizes bigger than 32bit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Drop trivial .lseek() implementaitons in FS driversAndrey Smirnov2019-01-291-6/+0
| | | | | | | | | | | | | | | There are no FS drivers that do not implement .lseek callback in the codebase, so there doesn't seem to exist a use-case where lseek() would return -ENOSYS due to fsdrv->lseek being NULL. At the same time a large number of FS drivers implement only the most basic "always succeeds" custom .lseek() hook. Change the code of lseek() to treat absense of .lseek() to mean that no special actions needs to be taken by FS driver and seek is always successful and drop all of the trivial .lseek() implementations. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Update FILE position in lseek()Andrey Smirnov2019-01-291-2/+1
| | | | | | | | | | Instead on relying on driver callbacks to update 'pos' in FILE, do it as a part of lseek() code. This allows us to drop a bit of repeating code as well as making lseek() implementation consistent with write() and read(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: improve ramfs_truncate speedMarcin Niestroj2018-10-081-1/+3
| | | | | | | | | | | | | | | | | | During sequential writes into single file, fs layer is consequently calling ramfs_truncate() function. When file size grows ramfs_truncate() takes more and more time to complete, due to interations through all already written data chunks. As an example loading ~450M image using usb fastboot protocol took over 500s to complete. Use ramfs_find_chunk() function to search for last chunk of data in ramfs_truncate() implementation, which saves a lot of loop iterations. As a result loading ~450M image using usb fastboot protocol takes around 25s now. Tested-by: Maciej Zagrabski <m.zagrabski@grinn-global.com> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ramfs: make chunk counting in truncate() better readableSascha Hauer2018-09-271-5/+4
| | | | | | | | | | | | | | In ramfs_truncate() "newchunks" denotes the number of chunks we want to have after the call. We decrease that number while iterating over the existing chunks and decrease it further with every newly allocated chunk until "newchunks" is zero. This is a bit hard to read. Instead we drop the decreasing while iterating over existing chunks and increase "oldchunks" while allocating until it reaches "newchunks". This is mainly done to make the next patch easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ramfs: Free data when file is unlinkedSascha Hauer2018-09-261-1/+23
| | | | | | | | | Since the switch to dentry cache implementation the memory is no longer freed when a file in ramfs is deleted. Fix this. Fixes: b283b72639 ("fs: ramfs: Switch to dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/memcmds'Sascha Hauer2018-08-131-1/+1
|\
| * fs: ramfs: get chunks zero initializedSascha Hauer2018-08-101-1/+1
| | | | | | | | | | | | | | Initialize new chunks to zero, otherwise a ->truncate call may result in uninitialized data in files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: ramfs: Switch to dentry cache implementationSascha Hauer2018-07-111-302/+99
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: syntax fix in ramfs.cStefan Christ2015-10-011-1/+1
| | | | | Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix 'new blank line at EOF' formatting errorAntony Pavlov2015-07-021-1/+0
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: rename inode member of struct filep to privSascha Hauer2015-03-091-4/+4
| | | | | | | Because that's what it is. 'inode' will become confusing once we support real inodes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-3/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ramfs: add symlink and readlink supportJean-Christophe PLAGNIOL-VILLARD2012-09-051-6/+55
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* use loff_t for file offsetsSascha Hauer2012-06-301-1/+1
| | | | | | | This is a first step for 64bit file support: Make the file sizes/offsets 64bit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ramfs: rember last accessed chunkJan Weitzel2012-05-161-10/+37
| | | | | | | | | | | | | | | | Writing big files takes longer and longer because of the chunk list By storing a pointer of the recent used chunk in the inode, access times are improved. Testet on with tftp 10M: OMAP4 chunk size 4096: 12244ms 8192: 4239ms patched 2647ms 2785ms i.MX35 chunk size 8192: 7225ms patched 2691ms No impact on much smaller files seen Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: get fs device using container_ofSascha Hauer2012-02-251-1/+0
| | | | | | This reduces the usage of dev->type_data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ramfs: increase chunk size to 8192 bytesSascha Hauer2011-12-051-1/+1
| | | | | | | | dlmalloc seems to work more efficient with this chunk size. Copying a bigger file (3MB) takes 271ms vs. 125ms on a i.MX27 board. Even bigger chunk sizes do not further improve performance. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: remove unused field 'type' from struct fs_driver_dSascha Hauer2011-04-111-1/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ramfs: increase chunk size to 4 kbyteSascha Hauer2011-03-101-1/+1
| | | | | | This greatly increases speed on ramfs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ramfs: sparse fixesSascha Hauer2010-10-211-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* make sure ramfs/devfs are initialised when neededSascha Hauer2009-07-211-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Get rid of DEVICE_TYPE_FS usageSascha Hauer2009-07-211-2/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ramfs: add missing remove functionSascha Hauer2009-07-211-0/+6
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove warningfredo2008-12-181-1/+1
| | | | | Signed-off-by: Frederic RODO <fred.rodo@gmail.com>
* - introduce ioctl callSascha Hauer2008-06-061-0/+7
| | | | - pass open/close/lseek through to drivers
* change files and dirs to rwxrwxrwxSascha Hauer2007-10-041-1/+1
|
* change files and directories to 0777Sascha Hauer2007-10-031-7/+7
|
* remove debug printf, replace with debugSascha Hauer2007-10-031-23/+19
|
* declare lots of functions staticSascha Hauer2007-09-281-17/+17
|
* fix bug in ramfs when creating files whose parents do not existSascha Hauer2007-09-271-2/+5
|
* svn_rev_706Sascha Hauer2007-07-051-0/+22
| | | | add file headers
* svn_rev_420Sascha Hauer2007-07-051-6/+6
| | | | | | | | | | | - do more POSIX: - use DIR instead of struct dirent - use (struct dirent)->d_name instead of (struct dirent)->name - switch to a new layout for U_BOOT_CMD: - use C99 initializers to be able to add more fields to the command struct - add aliases for commands (needed mainly for help -> ? and test -> [ - This is not done for all commands yet, but the compiler will tell you ;)
* svn_rev_396Sascha Hauer2007-07-051-4/+12
| | | | fix truncate (again). This still looks ugly
* svn_rev_378Sascha Hauer2007-07-051-3/+9
| | | | fix truncate
* svn_rev_369Sascha Hauer2007-07-051-1/+0
| | | | include asm-generic in errno.h instead of all other files
* svn_rev_325Sascha Hauer2007-07-051-60/+179
| | | | implement . and .. entries
* svn_rev_286Sascha Hauer2007-07-051-20/+18
|
* svn_rev_281Sascha Hauer2007-07-051-2/+50
| | | | read support for ramfs
* svn_rev_272Sascha Hauer2007-07-051-52/+110
| | | | more FS work
* svn_rev_270Sascha Hauer2007-07-051-26/+104
| | | | WIP FS support
* svn_rev_268Sascha Hauer2007-07-051-71/+18
| | | | WIP
* svn_rev_261Sascha Hauer2007-07-051-0/+282
WIP Filesystem support