aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-03-05pass writeback_control to ->write_inodeChristoph Hellwig1-1/+1
This gives the filesystem more information about the writeback that is happening. Trond requested this for the NFS unstable write handling, and other filesystems might benefit from this too by beeing able to distinguish between the different callers in more detail. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2009-12-15fs/ubifs: use %pUB to print UUIDsJoe Perches1-6/+1
Signed-off-by: Joe Perches <joe@perches.com> Cc: Artem Bityutskiy <dedekind@infradead.org> Cc: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-11-24UBIFS: support mounting of UBI volume character devicesCorentin Chary1-5/+15
This patch makes it possible to mount UBI character device nodes, and use something like: $ mount -t ubifs /dev/ubi_volume_name /mnt/ubifs instead of the old restrictive 'nodev' semantics: $ mount -t ubifs ubi0_0 /mnt/ubifs [Comments and the patch were amended a bit by Artem] Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-09-21Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into linux-nextArtem Bityutskiy1-0/+2
Conflicts: fs/ubifs/super.c Merge the upstream tree in order to resolve a conflict with the per-bdi writeback changes from the linux-2.6-block tree.
2009-09-16fs: Assign bdi in super_blockJens Axboe1-0/+1
We do this automatically in get_sb_bdev() from the set_bdev_super() callback. Filesystems that have their own private backing_dev_info must assign that in ->fill_super(). Note that ->s_bdi assignment is required for proper writeback! Acked-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-09-11writeback: add name to backing_dev_infoJens Axboe1-0/+1
This enables us to track who does what and print info. Its main use is catching dirty inodes on the default_backing_dev_info, so we can fix that up. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-09-11writeback: get rid of generic_sync_sb_inodes() exportJens Axboe1-7/+1
This adds two new exported functions: - writeback_inodes_sb(), which only attempts to writeback dirty inodes on this super_block, for WB_SYNC_NONE writeout. - sync_inodes_sb(), which writes out all dirty inodes on this super_block and also waits for the IO to complete. Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-09-10UBIFS: add inode size debugging checkArtem Bityutskiy1-0/+2
Add one more check to UBIFS - a check that makes sure that there are no data nodes beyond inode size. And few commantaries fixes along the line. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
2009-07-24UBIFS: remove unneeded call from ubifs_sync_fsArtem Bityutskiy1-17/+7
Nowadays VFS always synchronizes all dirty inodes and pages before calling '->sync_fs()', so remove unneeded 'generic_sync_sb_inodes()' from 'ubifs_sync_fs()'. It used to be needed, but not any longer. Pointed-out-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-24UBIFS: kill BKLArtem Bityutskiy1-12/+1
The BKL was pushed down from VFS to the file-systems. It used to serialize mount/unmount/remount and prevented more than one instance of the same file-system from doing mount/umount/remount at the same time. But it is OK for UBIFS and it does not need any additional locking for these cases. Thus, kick the BKL out of UBIFS. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-05UBIFS: allow more than one volume to be mountedDaniel Mack1-1/+2
UBIFS uses a bdi device per volume, but does not care to hand out unique names to each of them. This causes an error when trying to mount more than one volumes. Append the UBI volume and device ID to avoid that. [Amended a bit by Artem Bityutskiy] Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Artem Bityutskiy <dedekind@infradead.org> Cc: Adrian Hunter <ext-adrian.hunter@nokia.com> Cc: linux-mtd@lists.infradead.org Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-05UBIFS: fix assertion warningArtem Bityutskiy1-0/+3
When debugging is enabled and an unclean file-system is mounter, the following assertion is triggered: UBIFS assert failed in ubifs_tnc_start_commit at 805 (pid 1081) Call Trace: [cfaffbd0] [c0006cf8] show_stack+0x44/0x16c (unreliable) [cfaffc10] [c011b738] ubifs_tnc_start_commit+0xbb8/0xd18 [cfaffc90] [c0112670] do_commit+0x150/0xa44 [cfaffd10] [c0125234] ubifs_rcvry_gc_commit+0xd8/0x544 [cfaffd60] [c0100e9c] ubifs_fill_super+0xe78/0x15f8 [cfaffdf0] [c0102118] ubifs_get_sb+0x20c/0x320 [cfaffe70] [c007f764] vfs_kern_mount+0x58/0xe0 [cfaffe90] [c007f83c] do_kern_mount+0x40/0xf8 [cfaffeb0] [c0095c24] do_mount+0x550/0x758 [cfafff10] [c0095ebc] sys_mount+0x90/0xe0 [cfafff40] [c000ed4c] ret_from_syscall+0x0/0x3c The reason is that we initialize 'c->min_leb_idx' early, and do not re-calculate it after journal replay. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-05UBIFS: few spelling fixesArtem Bityutskiy1-1/+1
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-05UBIFS: slightly optimize write-buffer timer usageArtem Bityutskiy1-4/+2
This patch adds the following minor optimization: 1. If write-buffer does not use the timer, indicate it with the wbuf->no_timer variable, instead of using the wbuf->softlimit variable. This is better because wbuf->softlimit is of ktime_t type, and the ktime_to_ns function contains 64-bit multiplication. 2. Do not call the 'hrtimer_cancel()' function for write-buffers which do not use timers. 3. Do not cancel the timer in 'ubifs_put_super()' because the synchronization function does this. This patch also removes a confusing comment. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-17Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6Linus Torvalds1-25/+48
* 'linux-next' of git://git.infradead.org/ubifs-2.6: UBIFS: start using hrtimers hrtimer: export ktime_add_safe UBIFS: do not forget to register BDI device UBIFS: allow sync option in rootflags UBIFS: remove dead code UBIFS: use anonymous device UBIFS: return proper error code if the compr is not present UBIFS: return error if link and unlink race UBIFS: reset no_space flag after inode deletion
2009-06-16ubifs: register backing_dev_infoJens Axboe1-0/+3
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-06-11Push BKL down into ->remount_fs()Alessio Igor Bogani1-1/+8
[xfs, btrfs, capifs, shmem don't need BKL, exempt] Signed-off-by: Alessio Igor Bogani <abogani@texware.it> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2009-06-11push BKL down into ->put_superChristoph Hellwig1-0/+5
Move BKL into ->put_super from the only caller. A couple of filesystems had trivial enough ->put_super (only kfree and NULLing of s_fs_info + stuff in there) to not get any locking: coda, cramfs, efs, hugetlbfs, omfs, qnx4, shmem, all others got the full treatment. Most of them probably don't need it, but I'd rather sort that out individually. Preferably after all the other BKL pushdowns in that area. [AV: original used to move lock_super() down as well; these changes are removed since we don't do lock_super() at all in generic_shutdown_super() now] [AV: fuse, btrfs and xfs are known to need no damn BKL, exempt] Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2009-06-11enforce ->sync_fs is only called for rw superblockChristoph Hellwig1-3/+0
Make sure a superblock really is writeable by checking MS_RDONLY under s_umount. sync_filesystems needed some re-arragement for that, but all but one sync_filesystem caller had the correct locking already so that we could add that check there. cachefiles grew s_umount locking. I've also added a WARN_ON to sync_filesystem to assert this for future callers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2009-06-08UBIFS: start using hrtimersArtem Bityutskiy1-3/+3
UBIFS uses timers for write-buffer write-back. It is not crucial for us to write-back exactly on time. We are fine to write-back a little earlier or later. And this means we may optimize UBIFS timer so that it could be groped with a close timer event, so that the CPU would not be waken up just to do the write back. This is optimization to lessen power consumption, which is important in embedded devices UBIFS is used for. hrtimers have a nice feature: they are effectively range timers, and we may defind the soft and hard limits for it. Standard timers do not have these feature. They may only be made deferrable, but this means there is effectively no hard limit. So, we will better use hrtimers. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-08UBIFS: do not forget to register BDI deviceArtem Bityutskiy1-0/+3
Reviewed-by: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-02UBIFS: allow sync option in rootflagsArtem Bityutskiy1-5/+35
When passing UBIFS parameters via kernel command line, the sync option will be passed to UBIFS as a string, not as an MS_SYNCHRONOUS flag. Teach UBIFS interpreting this flag. Reported-by: Aurélien GÉRÔME <ag@debian.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-26UBIFS: use anonymous deviceArtem Bityutskiy1-17/+4
UBIFS has erroneuosly set 'sb->s_dev' to the UBI volume character device major/minor. This may lead to clashes if there is another FS mounted to a block device with the same major/minor numbers. User-space programs which use 'stat->st_dev' may get confused because of this. This problem was found by Al Viro. He also pointed the way to fix the problem - use 'set_anon_super()' and 'kill_anon_super()' VFS helpers. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-25UBIFS: return proper error code if the compr is not presentCorentin Chary1-0/+1
If the compressor is not present, mount_ubifs need to return an error code. This way ubifs_fill_super will stop and handle the error. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-09Convert obvious places to deactivate_locked_super()Al Viro1-2/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2009-05-06UBIFS: reset no_space flag after inode deletionAdrian Hunter1-0/+5
When UBIFS runs out of space it spends a lot of time trying to find more space before returning ENOSPC. As there is no point repeating that unless something has changed, UBIFS has an optimization to record that the file system is 100% full and not try to find space. That flag was not being reset when a pending deletion was finally done. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Reviewed-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-06Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6Linus Torvalds1-10/+27
* 'linux-next' of git://git.infradead.org/ubifs-2.6: UBIFS: fix recovery bug UBIFS: add R/O compatibility UBIFS: fix compiler warnings UBIFS: fully sort GCed nodes UBIFS: fix commentaries UBIFS: introduce a helpful variable UBIFS: use KERN_CONT UBIFS: fix lprops committing bug UBIFS: fix bogus assertion UBIFS: fix bug where page is marked uptodate when out of space UBIFS: amend key_hash return value UBIFS: improve find function interface UBIFS: list usage cleanup UBIFS: fix dbg_chk_lpt_sz()
2009-03-27vfs: simple_set_mnt() should return voidSukadev Bhattiprolu1-1/+2
simple_set_mnt() is defined as returning 'int' but always returns 0. Callers assume simple_set_mnt() never fails and don't properly cleanup if it were to _ever_ fail. For instance, get_sb_single() and get_sb_nodev() should: up_write(sb->s_unmount); deactivate_super(sb); if simple_set_mnt() fails. Since simple_set_mnt() never fails, would be cleaner if it did not return anything. [akpm@linux-foundation.org: fix build] Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Acked-by: Serge Hallyn <serue@us.ibm.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2009-03-26UBIFS: add R/O compatibilityArtem Bityutskiy1-2/+12
Now UBIFS is supported by u-boot. If we ever decide to change the media format, then people will have to upgrade their u-boots to mount new format images. However, very often it is possible to preserve R/O forward-compatibility, even though the write forward-compatibility is not preserved. This patch introduces a new super-block field which stores the R/O compatibility version. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Acked-by: Adrian Hunter <Adrian.Hunter@nokia.com>
2009-03-20UBIFS: fix compiler warningsHunter Adrian1-4/+4
fs/ubifs/super.c: In function ‘ubifs_show_options’: fs/ubifs/super.c:425: warning: format not a string literal and no format arguments fs/ubifs/super.c: In function ‘mount_ubifs’: fs/ubifs/super.c:1204: warning: format not a string literal and no format arguments fs/ubifs/super.c: In function ‘ubifs_remount_rw’: fs/ubifs/super.c:1557: warning: format not a string literal and no format arguments Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-16UBIFS: introduce a helpful variableArtem Bityutskiy1-0/+3
This patch introduces a helpful @c->idx_leb_size variable. The patch also fixes some spelling issues and makes comments use "LEB" instead of "eraseblock", which is more correct. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-15UBIFS: fix bogus assertionArtem Bityutskiy1-4/+8
Empty journal head LEBs are accounted as taken empty as well, so the GC LEB does not have to be the only taken empty LEB when nounting/remounting. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-29UBIFS: remove fast unmountingArtem Bityutskiy1-45/+5
This UBIFS feature has never worked properly, and it was a mistake to add it because we simply have no use-cases. So, lets still accept the fast_unmount mount option, but ignore it. This does not change much, because UBIFS commit in sync_fs anyway, and sync_fs is called while unmounting. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-29UBIFS: return sensible error codesArtem Bityutskiy1-8/+3
When mounting/re-mounting, UBIFS returns EINVAL even if the ENOSPC or EROFS codes are are much better, just because we have not found references to ENOSPC/EROFS in mount (2) man pages. This patch changes this behaviour and makes UBIFS return real error code, because: 1. It is just less confusing and more logical 2. mount is not described in SuSv3, so it seems to be not really well-standartized 3. we do not cover all cases, and any random undocumented in man pages error code may be returned anyway Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-29UBIFS: remount ro fixesAdrian Hunter1-7/+7
- preserve the idx_gc list - it will be needed in the same state, should UBIFS be remounted rw again - prevent remounting ro if we have switched to read only mode (due to a fatal error) Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-29UBIFS: sync wbufs after syncing inodes and pagesAdrian Hunter1-10/+10
All writes go through wbufs so they must be sync'd after syncing inodes and pages. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-26UBIFS: fix assertionsArtem Bityutskiy1-6/+7
I introduce wrong assertions in one of the previous commits, this patch fixes them. Also, initialize debugfs after the debugging check. This is a little nicer because we want the FS data to be accessible to external users after everything has been initialized. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-26UBIFS: ensure orphan area head is initializedAdrian Hunter1-0/+6
When mounting read-only the orphan area head is not initialized. It must be initialized when remounting read/write, but it was not. This patch fixes that. [Artem: sorry, added comment tweaking noise] Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-26UBIFS: always clean up GC LEB spaceArtem Bityutskiy1-14/+33
When we mount UBIFS, GC LEB may contain out-of-date information, and UBIFS should update lprops and set free space for thei LEB. Currently UBIFS does this only if mounted R/W. But for R/O mount we have to do the same, because otherwise we will have incorrect FS free space reported to user-space. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-26UBIFS: add re-mount debugging checksArtem Bityutskiy1-4/+10
We observe space corrupted accounting when re-mounting. So add some debbugging checks to catch problems like this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-26UBIFS: fix LEB list freeingArtem Bityutskiy1-15/+27
When freeing the c->idx_lebs list, we have to release the LEBs as well, because we might be called from mount to read-only mode code. Otherwise the LEBs stay taken forever, which may cause problems when we re-mount back ro RW mode. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-20UBIFS: document dark_wm and dead_wm betterArtem Bityutskiy1-9/+2
Just add more commentaries. Also some commentary fixes for lprops flags. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-18UBIFS: constify operationsArtem Bityutskiy1-1/+1
Mark super, file, and inode operation structcutes with 'const'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-18UBIFS: do not commit twiceArtem Bityutskiy1-4/+5
VFS calls '->sync_fs()' twice - first time with @wait = 0, second time with @wait = 1. As a result, we may commit and synchronize write-buffers twice. Avoid doing this by returning immediatelly if @wait = 0. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-06UBIFS: do not use WB_SYNC_HOLDArtem Bityutskiy1-1/+8
WB_SYNC_HOLD is going to be zapped so we should not use it. Use %WB_SYNC_NONE instead. Here is what akpm said: "I think I'll just switch that to WB_SYNC_NONE. The `wait==0' mode is just an advisory thing to help the fs shove lots of data into the queues. If some gets missed then it'll be picked up on the second ->sync_fs call, with wait==1." Thanks to Randy Dunlap for catching this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Cc: Nick Piggin <npiggin@suse.de> Cc: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-12-31UBIFS: add more useful debugging printsArtem Bityutskiy1-0/+12
Print node sizes and maximum node sizes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-31UBIFS: allow mounting when short of spaceArtem Bityutskiy1-11/+29
It is fine if there is not free space - we should still allow mounting this FS. This patch relaxes the free space requirements and adds info dumps. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-31UBIFS: always commit on unmountArtem Bityutskiy1-11/+15
UBIFS commits on unmount to make the next mount faster. Currently, it commits only if there is more than LEB size bytes in the journal. This is not very good, because journal size may be large (512KiB). And there may be few deletions in the journal which do not take much journal space, but which do introduce a lot of TNC changes and make mount slow. Thus, jurt remove this condition and always commit. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-31UBIFS: use ubi_syncArtem Bityutskiy1-6/+1
UBI now has (fake for now, though) synchronization call - use it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-31UBIFS: always commit in sync_fsArtem Bityutskiy1-20/+18
Always run commit in sync_fs, because even if the journal seems to be almost empty, there may be a deletion which removes a large file, which affects the index greatly. And because we want better free space predictions after 'sync_fs()', we have to commit. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>