27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

20 Jul, 2011

1 commit


13 Jan, 2011

1 commit

  • As Al Viro pointed out path resolution during Q_QUOTAON calls to quotactl
    is prone to deadlocks. We hold s_umount semaphore for reading during the
    path resolution and resolution itself may need to acquire the semaphore
    for writing when e. g. autofs mountpoint is passed.

    Solve the problem by performing the resolution before we get hold of the
    superblock (and thus s_umount semaphore). The whole thing is complicated
    by the fact that some filesystems (OCFS2) ignore the path argument. So to
    distinguish between filesystem which want the path and which do not we
    introduce new .quota_on_meta callback which does not get the path. OCFS2
    then uses this callback instead of old .quota_on.

    CC: Al Viro
    CC: Christoph Hellwig
    CC: Ted Ts'o
    CC: Joel Becker
    Signed-off-by: Jan Kara

    Jan Kara
     

28 May, 2010

1 commit

  • Generic per-cpu counter has some memory overhead but it is negligible for
    modern systems and embedded systems compile without quota support. And code
    reuse is a good thing. This patch should fix complain from preemptive kernels
    which was introduced by dde9588853b1bde.

    [Jan Kara: Fixed patch to work on 32-bit archs as well]

    Reported-by: Rafael J. Wysocki
    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     

24 May, 2010

1 commit


22 May, 2010

3 commits

  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     

05 Mar, 2010

9 commits

  • Just use 0 / -EDQUOT directly - that's what it translates to anyway.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • 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
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     
  • - remove hardcoded USRQUOTA/GRPQUOTA flags
    - convert int to bool for appropriate functions

    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     
  • 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
    Signed-off-by: Jan Kara

    Christoph Hellwig
     

23 Dec, 2009

1 commit

  • Currently inode_reservation is managed by fs itself and this
    reservation is transfered on dquot_transfer(). This means what
    inode_reservation must always be in sync with
    dquot->dq_dqb.dqb_rsvspace. Otherwise dquot_transfer() will result
    in incorrect quota(WARN_ON in dquot_claim_reserved_space() will be
    triggered)
    This is not easy because of complex locking order issues
    for example http://bugzilla.kernel.org/show_bug.cgi?id=14739

    The patch introduce quota reservation field for each fs-inode
    (fs specific inode is used in order to prevent bloating generic
    vfs inode). This reservation is managed by quota code internally
    similar to i_blocks/i_bytes and may not be always in sync with
    internal fs reservation.

    Also perform some code rearrangement:
    - Unify dquot_reserve_space() and dquot_reserve_space()
    - Unify dquot_release_reserved_space() and dquot_free_space()
    - Also this patch add missing warning update to release_rsv()
    dquot_release_reserved_space() must call flush_warnings() as
    dquot_free_space() does.

    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     

10 Dec, 2009

3 commits


03 Dec, 2009

1 commit

  • Sending a message to userspace in a generic format to warn
    of events (e.g. quota exceeded) in the quota subsystem is
    a generically useful feature. This patch makes some minor
    changes to the send_message function from dquot.c renaming
    it quota_send_message, moving it to quota.c and exporting it
    for use by filesystems which do not use the dquot code.

    Signed-off-by: Steven Whitehouse

    Steven Whitehouse
     

26 Mar, 2009

3 commits

  • Remove this macro which is just a definition of NULL. Fix a few coding style
    issues along the way.

    Signed-off-by: Jan Kara

    Jan Kara
     
  • 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
    Signed-off-by: Jan Kara

    Mingming Cao
     
  • 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
    Signed-off-by: Jan Kara

    Mingming Cao
     

06 Jan, 2009

9 commits

  • Unexport header files dqblk_v[12].h since except for quota format ID they
    don't contain information userspace should be interested in. Move ID
    definitions to quota.h.

    Signed-off-by: Jan Kara
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • Increase reported version number of quota support since quota core has changed
    significantly. Also remove __DQUOT_NUM_VERSION__ since nobody uses it.

    Signed-off-by: Jan Kara
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • Quota in a clustered environment needs to synchronize quota information
    among cluster nodes. This means we have to occasionally update some
    information in dquot from disk / network. On the other hand we have to
    be careful not to overwrite changes administrator did via SETQUOTA.
    So indicate in dquot->dq_flags which entries have been set by SETQUOTA
    and quota format can clear these flags when it properly propagated
    the changes.

    Signed-off-by: Jan Kara
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • For clustered filesystems, it can happen that space / inode usage goes
    negative temporarily (because some node is allocating another node
    is freeing and they are not completely in sync). So let quota code
    allow this and change qsize_t so a signed type so that we don't
    underflow the variables.

    Signed-off-by: Jan Kara
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • Coming quota support for OCFS2 is going to need quite a bit
    of additional per-sb quota information. Moreover having fs.h
    include all the types needed for this structure would be a
    pain in the a**. So remove the union from mem_dqinfo and add
    a private pointer for filesystem's use.

    Signed-off-by: Jan Kara
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • If filesystem can handle quota files as system files hidden from users, we can
    skip a lot of cache invalidation, syncing, inode flags setting etc. when
    turning quotas on, off and quota_sync. Allow filesystem to indicate that it is
    hiding quota files from users by DQUOT_QUOTA_SYS_FILE flag.

    Signed-off-by: Jan Kara
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • 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
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • 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
    Signed-off-by: Mark Fasheh

    Jan Kara
     
  • Some filesystems would like to keep private information together with each
    dquot. Add callbacks alloc_dquot and destroy_dquot allowing filesystem to
    allocate larger dquots from their private slab in a similar fashion we
    currently allocate inodes.

    Signed-off-by: Jan Kara
    Signed-off-by: Mark Fasheh

    Jan Kara
     

17 Oct, 2008

1 commit


26 Jul, 2008

4 commits

  • Sometimes it may be useful for userspace to know (e.g. for some hosting
    guys) that some user stopped exceeding his hardlimit or softlimit in
    quotas. Implement sending of such events to userspace via quota netlink
    protocol so that they don't have to poll for such events. Based on idea
    and initial implementation by Vladislav Bogdanov.

    Cc: Vladislav Bogdanov
    Signed-off-by: Jan Kara
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     
  • Signed-off-by: Jan Kara
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     
  • 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.

    [akpm@linux-foundation.org: fix JFS build]
    [akpm@linux-foundation.org: fix UFS build]
    [vegard.nossum@gmail.com: fix QUOTA=n build]
    Signed-off-by: Jan Kara
    Cc: Vegard Nossum
    Cc: Arjen Pool
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     
  • Make loop in sync_dquots() checking whether there's something to write
    more readable, remove useless variable and macro info_any_dirty() which
    is used only in this place.

    Signed-off-by: Jan Kara
    Cc: "Vegard Nossum"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     

01 May, 2008

1 commit