aboutsummaryrefslogtreecommitdiff
path: root/include/linux/quotaops.h
AgeCommit message (Collapse)AuthorFilesLines
2010-05-21quota: Refactor dquot_transfer code so that OCFS2 can pass in its referencesJan Kara1-0/+1
Currently, __dquot_transfer() acquires its own references of dquot structures that will be put into inode. But for OCFS2, this creates a lock inversion between dq_lock (waited on in dqget) and transaction start (started in ocfs2_setattr). Currently, deadlock is impossible because dq_lock is acquired only during dquot_acquire and dquot_release and we already hold a reference to dquot structures in ocfs2_setattr so neither of these functions can be called while we call dquot_transfer. But this is rather subtle and it is hard to teach lockdep about it. So provide __dquot_transfer function that can be passed dquot references directly. OCFS2 can then pass acquired dquot references directly to __dquot_transfer with proper locking. Signed-off-by: Jan Kara <[email protected]>
2010-05-21quota: unify quota init condition in setattrDmitry Monakhov1-0/+8
Quota must being initialized if size or uid/git changes requested. But initialization performed in two different places: in case of i_size file system is responsible for dquot init , but in case of uid/gid init will be called internally in dquot_transfer(). This ambiguity makes code harder to understand. Let's move this logic to one common helper function. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-05-21quota: unify ->set_dqblkChristoph Hellwig1-1/+2
Pass the larger struct fs_disk_quota to the ->set_dqblk operation so that the Q_SETQUOTA and Q_XSETQUOTA operations can be implemented with a single filesystem operation and we can retire the ->set_xquota operation. The additional information (RT-subvolume accounting and warn counts) are left zero for the VFS quota implementation. Add new fieldmask values for setting the numer of blocks and inodes values which is required for the VFS quota, but wasn't for XFS. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-05-21quota: unify ->get_dqblkChristoph Hellwig1-1/+2
Pass the larger struct fs_disk_quota to the ->get_dqblk operation so that the Q_GETQUOTA and Q_XGETQUOTA operations can be implemented with a single filesystem operation and we can retire the ->get_xquota operation. The additional information (RT-subvolume accounting and warn counts) are left zero for the VFS quota implementation. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-05-16quota: add the option to not fail with EDQUOT in blockEric Sandeen1-0/+12
To simplify metadata tracking for delalloc writes, ext4 will simply claim metadata blocks at allocation time, without first speculatively reserving the worst case and then freeing what was not used. To do this, we need a mechanism to track allocations in the quota subsystem, but potentially allow that allocation to actually go over quota. This patch adds a DQUOT_SPACE_NOFAIL flag and function variants for this purpose. Signed-off-by: Eric Sandeen <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2010-05-16quota: use flags interface for dquot alloc/free spaceEric Sandeen1-11/+14
Switch __dquot_alloc_space and __dquot_free_space to take flags to indicate whether to warn and/or to reserve (or free reserve). This is slightly more readable at the callpoints, and makes it cleaner to add a "nofail" option in the next patch. Signed-off-by: Eric Sandeen <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2010-03-05dquot: cleanup dquot initialize routineChristoph Hellwig1-13/+4
Get rid of the initialize dquot operation - it is now always called from the filesystem and if a filesystem really needs it's own (which none currently does) it can just call into it's own routine directly. Rename the now static low-level dquot_initialize helper to __dquot_initialize and vfs_dq_init to dquot_initialize to have a consistent namespace. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05dquot: move dquot initialization responsibility into the filesystemChristoph Hellwig1-0/+4
Currently various places in the VFS call vfs_dq_init directly. This means we tie the quota code into the VFS. Get rid of that and make the filesystem responsible for the initialization. For most metadata operations this is a straight forward move into the methods, but for truncate and open it's a bit more complicated. For truncate we currently only call vfs_dq_init for the sys_truncate case because open already takes care of it for ftruncate and open(O_TRUNC) - the new code causes an additional vfs_dq_init for those which is harmless. For open the initialization is moved from do_filp_open into the open method, which means it happens slightly earlier now, and only for regular files. The latter is fine because we don't need to initialize it for operations on special files, and we already do it as part of the namespace operations for directories. Add a dquot_file_open helper that filesystems that support generic quotas can use to fill in ->open. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05dquot: cleanup dquot drop routineChristoph Hellwig1-3/+2
Get rid of the drop dquot operation - it is now always called from the filesystem and if a filesystem really needs it's own (which none currently does) it can just call into it's own routine directly. Rename the now static low-level dquot_drop helper to __dquot_drop and vfs_dq_drop to dquot_drop to have a consistent namespace. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05dquot: cleanup dquot transfer routineChristoph Hellwig1-3/+2
Get rid of the transfer dquot operation - it is now always called from the filesystem and if a filesystem really needs it's own (which none currently does) it can just call into it's own routine directly. Rename the now static low-level dquot_transfer helper to __dquot_transfer and vfs_dq_transfer to dquot_transfer to have a consistent namespace, and make the new dquot_transfer return a normal negative errno value which all callers expect. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05dquot: cleanup inode allocation / freeing routinesChristoph Hellwig1-20/+4
Get rid of the alloc_inode and free_inode dquot operations - they are always called from the filesystem and if a filesystem really needs their own (which none currently does) it can just call into it's own routine directly. Also get rid of the vfs_dq_alloc/vfs_dq_free wrappers and always call the lowlevel dquot_alloc_inode / dqout_free_inode routines directly, which now lose the number argument which is always 1. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05dquot: cleanup space allocation / freeing routinesChristoph Hellwig1-150/+58
Get rid of the alloc_space, free_space, reserve_space, claim_space and release_rsv dquot operations - they are always called from the filesystem and if a filesystem really needs their own (which none currently does) it can just call into it's own routine directly. Move shared logic into the common __dquot_alloc_space, dquot_claim_space_nodirty and __dquot_free_space low-level methods, and rationalize the wrappers around it to move as much as possible code into the common block for CONFIG_QUOTA vs not. Also rename all these helpers to be named dquot_* instead of vfs_dq_*. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05quota: generalize quota transfer interfaceDmitry Monakhov1-1/+1
Current quota transfer interface support only uid/gid. This patch extend interface in order to support various quotas types The goal is accomplished without changes in most frequently used vfs_dq_transfer() func. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05quota: sb_quota state flags cleanupDmitry Monakhov1-14/+17
- remove hardcoded USRQUOTA/GRPQUOTA flags - convert int to bool for appropriate functions Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05quota: move code from sync_quota_sb into vfs_quota_syncChristoph Hellwig1-16/+1
Currenly sync_quota_sb does a lot of sync and truncate action that only applies to "VFS" style quotas and is actively harmful for the sync performance in XFS. Move it into vfs_quota_sync and add a wait parameter to ->quota_sync to tell if we need it or not. My audit of the GFS2 code says it's also not needed given the way GFS2 implements quotas, but I'd be happy if this can get a detailed review. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05quota: clean up Q_XQUOTASYNCChristoph Hellwig1-1/+1
Currently Q_XQUOTASYNC calls into the quota_sync method, but XFS does something entirely different in it than the rest of the filesystems. xfs_quota which calls Q_XQUOTASYNC expects an asynchronous data writeout to flush delayed allocations, while the "VFS" quota support wants to flush changes to the quota file. So make Q_XQUOTASYNC call into the writeback code directly and make the quota_sync method optional as XFS doesn't need in the sense expected by the rest of the quota code. GFS2 was using limited XFS-style quota and has a quota_sync method fitting neither the style used by vfs_quota_sync nor xfs_fs_quota_sync. I left it in for now as per discussion with Steve it expects to be called from the sync path this way. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2010-03-05quota: manage reserved space when quota is not active [v2]Dmitry Monakhov1-2/+9
Since we implemented generic reserved space management interface, then it is possible to account reserved space even when quota is not active (similar to i_blocks/i_bytes). Without this patch following testcase result in massive comlain from WARN_ON in dquot_claim_space() TEST_CASE: mount /dev/sdb /mnt -oquota dd if=/dev/zero of=/mnt/test bs=1M count=1 quotaon /mnt # fs_reserved_spave == 1Mb # quota_reserved_space == 0, because quota was disabled dd if=/dev/zero of=/mnt/test seek=1 bs=1M count=1 # fs_reserved_spave == 2Mb # quota_reserved_space == 1Mb sync # ->dquot_claim_space() -> WARN_ON Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2009-09-22const: make struct super_block::s_qcop constAlexey Dobriyan1-1/+1
Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-09-22const: make struct super_block::dq_op constAlexey Dobriyan1-1/+1
Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-07-12headers: smp_lock.h reduxAlexey Dobriyan1-1/+0
* Remove smp_lock.h from files which don't need it (including some headers!) * Add smp_lock.h to files which do need it * Make smp_lock.h include conditional in hardirq.h It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT This will make hardirq.h inclusion cheaper for every PREEMPT=n config (which includes allmodconfig/allyesconfig, BTW) Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-06-11quota: Introduce writeout_quota_sb() (version 4)Jan Kara1-0/+9
Introduce this function which just writes all the quota structures but avoids all the syncing and cache pruning work to expose quota structures to userspace. Use this function from __sync_filesystem when wait == 0. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2009-06-11quota: cleanup dquota sync functions (version 4)Christoph Hellwig1-8/+3
Currently the VFS calls vfs_dq_sync to sync out disk quotas for a given superblock. This is a small wrapper around sync_dquots which for the case of a non-NULL superblock is a small wrapper around quota_sync_sb. Just make quota_sync_sb global (rename it to sync_quota_sb) and call it directly. Also call it directly for those cases in quota.c that have a superblock and leave sync_dquots purely an iterator over sync_quota_sb and remove it's superblock argument. To make this nicer move the check for the lack of a quota_sync method from the callers into sync_quota_sb. [folded build fix from Alexander Beregalov <[email protected]>] Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2009-03-26quota: Remove uppercase aliases for quota functions.Jan Kara1-31/+0
Since all users have been converted, remove uppercase names of quota functions. Signed-off-by: Jan Kara <[email protected]>
2009-03-26quota: Use inode->i_blkbits to get block bitsMingming Cao1-14/+8
Andrew has suggested to use inode->i_blkbits to get the block bits info, rather than use super block's blockbits. That should be faster and emit less code. Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2009-03-26quota: Add quota reservation claim and released operationsMingming Cao1-0/+53
Reserved quota will be claimed at the block allocation time. Over-booked quota could be returned back with the release callback function. Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2009-03-26quota: Add quota reservation supportMingming Cao1-0/+21
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash. This patch adds quota reservation for delayed allocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time. Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Jan Kara <[email protected]>
2009-01-16quota: Improve lockingJan Kara1-2/+0
We implement dqget() and dqput() that need neither dqonoff_mutex nor dqptr_sem. Then move dqget() and dqput() calls so that they are not called from under dqptr_sem. This is important because filesystem callbacks aren't called from under dqptr_sem which used to cause *lots* of problems with lock ranking (and with OCFS2 they became close to unsolvable). The patch also removes two functions which were introduced solely because OCFS2 needed them to cope with the old locking scheme. As time showed, they were not enough for OCFS2 anyway and it would be unnecessary work to adapt them to the new locking scheme in which they aren't needed. As a result OCFS2 needs the following patch to compile properly with quotas. Sorry to any bisecters which hit this in advance. Signed-off-by: Jan Kara <[email protected]>
2009-01-05quota: Export dquot_alloc() and dquot_destroy() functionsJan Kara1-0/+2
These are default functions for creating and destroying quota structures and they should be used from filesystems. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
2009-01-05quota: Implement function for scanning active dquotsJan Kara1-0/+3
OCFS2 needs to scan all active dquots once in a while and sync quota information among cluster nodes. Provide a helper function for it so that it does not have to reimplement internally a list which VFS already has. Moreover this function is probably going to be useful for other clustered filesystems if they decide to use VFS quotas. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
2009-01-05quota: Add helpers to allow ocfs2 specific quota initialization, freeing and ↵Jan Kara1-0/+4
recovery OCFS2 needs to peek whether quota structure is already in memory so that it can avoid expensive cluster locking in that case. Similarly when freeing dquots, it checks whether it is the last quota structure user or not. Finally, it needs to get reference to dquot structure for specified id and quota type when recovering quota file after crash. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
2009-01-05quota: Remove compatibility function sb_any_quota_enabled()Jan Kara1-6/+0
Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
2009-01-05quota: Allow to separately enable quota accounting and enforcing limitsJan Kara1-20/+71
Split DQUOT_USR_ENABLED (and DQUOT_GRP_ENABLED) into DQUOT_USR_USAGE_ENABLED and DQUOT_USR_LIMITS_ENABLED. This way we are able to separately enable / disable whether we should: 1) ignore quotas completely 2) just keep uptodate information about usage 3) actually enforce quota limits This is going to be useful when quota is treated as filesystem metadata - we then want to keep quota information uptodate all the time and just enable / disable limits enforcement. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
2009-01-05quota: Make _SUSPENDED just a flagJan Kara1-2/+4
Upto now, DQUOT_USR_SUSPENDED behaved like a state - i.e., either quota was enabled or suspended or none. Now allowed states are 0, ENABLED, ENABLED | SUSPENDED. This will be useful later when we implement separate enabling of quota usage tracking and limits enforcement because we need to keep track of a state which has been suspended. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
2009-01-05quota: Increase size of variables for limits and inode usageJan Kara1-2/+2
So far quota was fine with quota block limits and inode limits/numbers in a 32-bit type. Now with rapid increase in storage sizes there are coming requests to be able to handle quota limits above 4TB / more that 2^32 inodes. So bump up sizes of types in mem_dqblk structure to 64-bits to be able to handle this. Also update inode allocation / checking functions to use qsize_t and make global structure keep quota limits in bytes so that things are consistent. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
2008-10-16quota: remove CVS keywordsAdrian Bunk1-3/+0
Remove CVS keywords that weren't updated for a long time from comments. Signed-off-by: Adrian Bunk <[email protected]> Acked-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-08-01[PATCH] fix races and leaks in vfs_quota_on() usersAl Viro1-0/+2
* new helper: vfs_quota_on_path(); equivalent of vfs_quota_on() sans the pathname resolution. * callers of vfs_quota_on() that do their own pathname resolution and checks based on it are switched to vfs_quota_on_path(); that way we avoid the races. * reiserfs leaked dentry/vfsmount references on several failure exits. Signed-off-by: Al Viro <[email protected]>
2008-07-25quota: convert macros to inline functionsJan Kara1-16/+49
Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-07-25quota: move function-macros from quota.h to quotaops.hJan Kara1-0/+26
Move declarations of some macros, which should be in fact functions to quotaops.h. This way they can be later converted to inline functions because we can now use declarations from quota.h. Also add necessary includes of quotaops.h to a few files. [[email protected]: fix JFS build] [[email protected]: fix UFS build] [[email protected]: fix QUOTA=n build] Signed-off-by: Jan Kara <[email protected]> Cc: Vegard Nossum <[email protected]> Cc: Arjen Pool <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-07-25quota: rename quota functions from upper case, make bigger ones non-inlineJan Kara1-119/+107
Cleanup quotaops.h: Rename functions from uppercase to lowercase (and define backward compatibility macros), move larger functions to dquot.c and make them non-inline. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-28quota: convert stub functions from macros into inlinesAndrew Morton1-8/+37
Fixes things like this: fs/super.c: In function `deactivate_super': fs/super.c:182: warning: statement with no effect fs/super.c: In function `do_remount_sb': fs/super.c:644: warning: statement with no effect Cc: Jan Kara <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-28quota: quota core changes for quotaon on remountJan Kara1-6/+23
Currently, we just turn quotas off on remount of filesystem to read-only state. The patch below adds necessary framework so that we can turn quotas off on remount RO but we are able to automatically reenable them again when filesystem is remounted to RW state. All we need to do is to keep references to inodes of quota files when remounting RO and using these references to reenable quotas when remounting RW. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-28quota: various style cleanupsJan Kara1-21/+50
Cleanups in quota code: Change __inline__ to inline. Change some macros to inline functions. Remove vfs_quota_off_mount() macro. DQUOT_OFF() should be (0) is CONFIG_QUOTA is disabled. Move declaration of mark_dquot_dirty and dirty_dquot from quota.h to dquot.c [[email protected]: coding-style fixes] Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-05-08make remove_inode_dquot_ref() staticAdrian Bunk1-3/+0
remove_inode_dquot_ref() can now become static. Signed-off-by: Adrian Bunk <[email protected]> Acked-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-12-07[PATCH] proper prototype for remove_inode_dquot_ref()Adrian Bunk1-0/+3
Add a proper prototype for remove_inode_dquot_ref() in include/linux/quotaops.h Signed-off-by: Adrian Bunk <[email protected]> Acked-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-04-26Don't include linux/config.h from anywhere else in include/David Woodhouse1-1/+0
Signed-off-by: David Woodhouse <[email protected]>
2006-02-03[PATCH] quota: remove unused sync_dquots_dev()Herbert Poetzl1-1/+0
The already removed sync_dquots_dev(dev,type) is still defined in the no-quota case. Signed-off-by: Herbert Pötzl <[email protected]> Acked-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-11-07[PATCH] quota: small cleanupsAdrian Bunk1-6/+6
- "extern inline" -> "static inline" - every file should #include the headers containing the prototypes for it's global functions Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-06-23[PATCH] quota: consolidate code surrounding vfs_quota_on_mountChristoph Hellwig1-1/+2
Move some code duplicated in both callers into vfs_quota_on_mount Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+246
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!