#
bc8e5f07 |
| 13-May-2010 |
Jan Kara <jack@suse.cz> |
quota: Refactor dquot_transfer code so that OCFS2 can pass in its references
Currently, __dquot_transfer() acquires its own references of dquot structures that will be put into inode. But for OCFS2,
quota: Refactor dquot_transfer code so that OCFS2 can pass in its references
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 <jack@suse.cz>
show more ...
|
#
12755627 |
| 08-Apr-2010 |
Dmitry Monakhov <dmonakhov@openvz.org> |
quota: unify quota init condition in setattr
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
quota: unify quota init condition in setattr
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 <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
c472b432 |
| 06-May-2010 |
Christoph Hellwig <hch@infradead.org> |
quota: unify ->set_dqblk
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
quota: unify ->set_dqblk
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
b9b2dd36 |
| 06-May-2010 |
Christoph Hellwig <hch@infradead.org> |
quota: unify ->get_dqblk
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
quota: unify ->get_dqblk
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
dde95888 |
| 26-Apr-2010 |
Dmitry Monakhov <dmonakhov@openvz.org> |
quota: Make quota stat accounting lockless.
Quota stats is mostly writable data structure. Let's alloc percpu bucket for each value.
NOTE: dqstats_read() function is racy against dqstats_{inc,dec}
quota: Make quota stat accounting lockless.
Quota stats is mostly writable data structure. Let's alloc percpu bucket for each value.
NOTE: dqstats_read() function is racy against dqstats_{inc,dec} and may return inconsistent value. But this is ok since absolute accuracy is not required.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
da8d1ba2 |
| 26-Apr-2010 |
Sergey Senozhatsky <sergey.senozhatsky@gmail.com> |
suppress warning: "quotatypes" defined but not used
Suppress compilation warning: "quotatypes" defined but not used. quotatypes is used only when CONFIG_QUOTA_DEBUG or CONFIG_PRINT_QUOTA_WARNING is/
suppress warning: "quotatypes" defined but not used
Suppress compilation warning: "quotatypes" defined but not used. quotatypes is used only when CONFIG_QUOTA_DEBUG or CONFIG_PRINT_QUOTA_WARNING is/are defined.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
eabf290d |
| 27-Mar-2010 |
Dmitry Monakhov <dmonakhov@openvz.org> |
quota: optimize mark_dirty logic
- Skip locking if quota is dirty already. - Return old quota state to help fs-specciffic implementation to optimize case where quota was dirty already.
Signed-off
quota: optimize mark_dirty logic
- Skip locking if quota is dirty already. - Return old quota state to help fs-specciffic implementation to optimize case where quota was dirty already.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
0e05842b |
| 16-May-2010 |
Eric Sandeen <sandeen@redhat.com> |
quota: add the option to not fail with EDQUOT in block
To simplify metadata tracking for delalloc writes, ext4 will simply claim metadata blocks at allocation time, without first speculatively reser
quota: add the option to not fail with EDQUOT in block
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 <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
show more ...
|
#
56246f9a |
| 16-May-2010 |
Eric Sandeen <sandeen@redhat.com> |
quota: use flags interface for dquot alloc/free space
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 slight
quota: use flags interface for dquot alloc/free space
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 <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
show more ...
|
#
62af9b52 |
| 19-Apr-2010 |
Jan Kara <jack@suse.cz> |
quota: Convert __DQUOT_PARANOIA symbol to standard config option
Make __DQUOT_PARANOIA define from the old days a standard config option and turn it off by default.
This gets rid of a quota warning
quota: Convert __DQUOT_PARANOIA symbol to standard config option
Make __DQUOT_PARANOIA define from the old days a standard config option and turn it off by default.
This gets rid of a quota warning about writes before quota is turned on for systems with ext4 root filesystem. Currently there's no way to legally solve this because /etc/mtab has to be written before quota is turned on on most systems.
Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
08261673 |
| 12-Apr-2010 |
Andrew Perepechko <andrew.perepechko@sun.com> |
quota: Fix possible dq_flags corruption
dq_flags are modified non-atomically in do_set_dqblk via __set_bit calls and atomically for example in mark_dquot_dirty or clear_dquot_dirty. Hence a change
quota: Fix possible dq_flags corruption
dq_flags are modified non-atomically in do_set_dqblk via __set_bit calls and atomically for example in mark_dquot_dirty or clear_dquot_dirty. Hence a change done by an atomic operation can be overwritten by a change done by a non-atomic one. Fix the problem by using atomic bitops even in do_set_dqblk.
Signed-off-by: Andrew Perepechko <andrew.perepechko@sun.com> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
4c5e6c0e |
| 06-Apr-2010 |
Jan Kara <jack@suse.cz> |
quota: Hide warnings about writes to the filesystem before quota was turned on
For a root filesystem write to the filesystem before quota is turned on happens regularly and there's no way around it
quota: Hide warnings about writes to the filesystem before quota was turned on
For a root filesystem write to the filesystem before quota is turned on happens regularly and there's no way around it because of writes to syslog, /etc/mtab, and similar. So the warning is rather pointless for ordinary users. It's still useful during development so we just hide the warning behind __DQUOT_PARANOIA config option.
Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
efd8f0e6 |
| 03-Mar-2010 |
Christoph Hellwig <hch@infradead.org> |
quota: stop using QUOTA_OK / NO_QUOTA
Just use 0 / -EDQUOT directly - that's what it translates to anyway.
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
|
#
871a2931 |
| 03-Mar-2010 |
Christoph Hellwig <hch@infradead.org> |
dquot: cleanup dquot initialize routine
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)
dquot: cleanup dquot initialize routine
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
907f4554 |
| 03-Mar-2010 |
Christoph Hellwig <hch@infradead.org> |
dquot: move dquot initialization responsibility into the filesystem
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 an
dquot: move dquot initialization responsibility into the filesystem
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
9f754758 |
| 03-Mar-2010 |
Christoph Hellwig <hch@infradead.org> |
dquot: cleanup dquot drop routine
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
dquot: cleanup dquot drop routine
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
b43fa828 |
| 03-Mar-2010 |
Christoph Hellwig <hch@infradead.org> |
dquot: cleanup dquot transfer routine
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 c
dquot: cleanup dquot transfer routine
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
63936dda |
| 03-Mar-2010 |
Christoph Hellwig <hch@infradead.org> |
dquot: cleanup inode allocation / freeing routines
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
dquot: cleanup inode allocation / freeing routines
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
5dd4056d |
| 03-Mar-2010 |
Christoph Hellwig <hch@infradead.org> |
dquot: cleanup space allocation / freeing routines
Get rid of the alloc_space, free_space, reserve_space, claim_space and release_rsv dquot operations - they are always called from the filesystem an
dquot: cleanup space allocation / freeing routines
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
ab94c39b |
| 22-Feb-2010 |
Jan Kara <jack@suse.cz> |
quota: Properly invalidate caches even for filesystems with blocksize < pagesize
Sometimes invalidate_bdev() can fail to invalidate a part of block device cache because of dirty data. If the filesys
quota: Properly invalidate caches even for filesystems with blocksize < pagesize
Sometimes invalidate_bdev() can fail to invalidate a part of block device cache because of dirty data. If the filesystem has blocksize smaller than page size, this can happen even for pages containing quota files and thus kernel would operate on stale data. Fix the issue by syncing the filesystem before invalidating the cache.
Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
8ddd69d6 |
| 15-Feb-2010 |
Dmitry Monakhov <dmonakhov@openvz.org> |
quota: generalize quota transfer interface
Current quota transfer interface support only uid/gid. This patch extend interface in order to support various quotas types The goal is accomplished withou
quota: generalize quota transfer interface
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 <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
ad1e6e8d |
| 15-Feb-2010 |
Dmitry Monakhov <dmonakhov@openvz.org> |
quota: sb_quota state flags cleanup
- remove hardcoded USRQUOTA/GRPQUOTA flags - convert int to bool for appropriate functions
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: J
quota: sb_quota state flags cleanup
- remove hardcoded USRQUOTA/GRPQUOTA flags - convert int to bool for appropriate functions
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
5fb324ad |
| 16-Feb-2010 |
Christoph Hellwig <hch@infradead.org> |
quota: move code from sync_quota_sb into vfs_quota_sync
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 per
quota: move code from sync_quota_sb into vfs_quota_sync
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 <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
0a5a9c72 |
| 09-Feb-2010 |
Jan Kara <jack@suse.cz> |
quota: Fix warning when a delayed write happens before quota is enabled
If a delayed-allocation write happens before quota is enabled, the kernel spits out a warning: WARNING: at fs/quota/dquot.c:98
quota: Fix warning when a delayed write happens before quota is enabled
If a delayed-allocation write happens before quota is enabled, the kernel spits out a warning: WARNING: at fs/quota/dquot.c:988 dquot_claim_space+0x77/0x112()
because the fact that user has some delayed allocation is not recorded in quota structure.
Make dquot_initialize() update amount of reserved space for user if it sees inode has some space reserved. Also make sure that reserved quota space does not go negative and we warn about the filesystem bug just once.
Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|
#
c469070a |
| 09-Feb-2010 |
Dmitry Monakhov <dmonakhov@openvz.org> |
quota: manage reserved space when quota is not active [v2]
Since we implemented generic reserved space management interface, then it is possible to account reserved space even when quota is not acti
quota: manage reserved space when quota is not active [v2]
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 <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
show more ...
|