diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-10 11:34:50 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:41:36 -0400 |
commit | d82661d96993ac4efc1d54259ea85ffcd9b8bec6 (patch) | |
tree | 0a42b5a3ff34839673e0007fca4335f18078803a /fs/gfs2/quota.h | |
parent | 860b25d4a913a00331d333f8e207a088c7a1b84a (diff) |
[GFS2] Streamline quota lock/check for no-quota case
This patch streamlines the quota checking in the "no quota" case by
making the check inline in the calling function, thus reducing the
number of function calls. Eventually we might be able to remove the
checks from the gfs2_quota_lock() and gfs2_quota_check() functions, but
currently we can't as there are a very few places in the code which need
to call these functions directly still.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Abhijith Das <adas@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.h')
-rw-r--r-- | fs/gfs2/quota.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h index a8be1417051f..3b7f4b0e5dfe 100644 --- a/fs/gfs2/quota.h +++ b/fs/gfs2/quota.h | |||
@@ -32,4 +32,21 @@ int gfs2_quota_init(struct gfs2_sbd *sdp); | |||
32 | void gfs2_quota_scan(struct gfs2_sbd *sdp); | 32 | void gfs2_quota_scan(struct gfs2_sbd *sdp); |
33 | void gfs2_quota_cleanup(struct gfs2_sbd *sdp); | 33 | void gfs2_quota_cleanup(struct gfs2_sbd *sdp); |
34 | 34 | ||
35 | static inline int gfs2_quota_lock_check(struct gfs2_inode *ip) | ||
36 | { | ||
37 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | ||
38 | int ret; | ||
39 | if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) | ||
40 | return 0; | ||
41 | ret = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | ||
42 | if (ret) | ||
43 | return ret; | ||
44 | if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON) | ||
45 | return 0; | ||
46 | ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid); | ||
47 | if (ret) | ||
48 | gfs2_quota_unlock(ip); | ||
49 | return ret; | ||
50 | } | ||
51 | |||
35 | #endif /* __QUOTA_DOT_H__ */ | 52 | #endif /* __QUOTA_DOT_H__ */ |