Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Definitions for diskquota-operations. When diskquota is configured these |
| 3 | * macros expand to the right source-code. |
| 4 | * |
| 5 | * Author: Marco van Wieringen <mvw@planets.elm.net> |
| 6 | * |
| 7 | * Version: $Id: quotaops.h,v 1.2 1998/01/15 16:22:26 ecd Exp $ |
| 8 | * |
| 9 | */ |
| 10 | #ifndef _LINUX_QUOTAOPS_ |
| 11 | #define _LINUX_QUOTAOPS_ |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/smp_lock.h> |
| 14 | |
| 15 | #include <linux/fs.h> |
| 16 | |
Jan Kara | 74abb98 | 2008-07-25 01:46:51 -0700 | [diff] [blame^] | 17 | #define sb_dqopt(sb) (&(sb)->s_dquot) |
| 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #if defined(CONFIG_QUOTA) |
| 20 | |
| 21 | /* |
| 22 | * declaration of quota_function calls in kernel. |
| 23 | */ |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 24 | void sync_dquots(struct super_block *sb, int type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 26 | int dquot_initialize(struct inode *inode, int type); |
| 27 | int dquot_drop(struct inode *inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 29 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); |
| 30 | int dquot_alloc_inode(const struct inode *inode, unsigned long number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 32 | int dquot_free_space(struct inode *inode, qsize_t number); |
| 33 | int dquot_free_inode(const struct inode *inode, unsigned long number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 35 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
| 36 | int dquot_commit(struct dquot *dquot); |
| 37 | int dquot_acquire(struct dquot *dquot); |
| 38 | int dquot_release(struct dquot *dquot); |
| 39 | int dquot_commit_info(struct super_block *sb, int type); |
| 40 | int dquot_mark_dquot_dirty(struct dquot *dquot); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 42 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
| 43 | char *path, int remount); |
| 44 | int vfs_quota_on_mount(struct super_block *sb, char *qf_name, |
| 45 | int format_id, int type); |
| 46 | int vfs_quota_off(struct super_block *sb, int type, int remount); |
| 47 | int vfs_quota_sync(struct super_block *sb, int type); |
| 48 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
| 49 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
| 50 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
| 51 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
| 52 | |
| 53 | void vfs_dq_drop(struct inode *inode); |
| 54 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); |
| 55 | int vfs_dq_quota_on_remount(struct super_block *sb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
Jan Kara | 74abb98 | 2008-07-25 01:46:51 -0700 | [diff] [blame^] | 57 | #define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type)) |
| 58 | |
| 59 | /* |
| 60 | * Functions for checking status of quota |
| 61 | */ |
| 62 | |
| 63 | #define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ |
| 64 | (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) |
| 65 | |
| 66 | #define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \ |
| 67 | sb_has_quota_enabled(sb, GRPQUOTA)) |
| 68 | |
| 69 | #define sb_has_quota_suspended(sb, type) \ |
| 70 | ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ |
| 71 | (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) |
| 72 | |
| 73 | #define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \ |
| 74 | sb_has_quota_suspended(sb, GRPQUOTA)) |
| 75 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | /* |
| 77 | * Operations supported for diskquotas. |
| 78 | */ |
| 79 | extern struct dquot_operations dquot_operations; |
| 80 | extern struct quotactl_ops vfs_quotactl_ops; |
| 81 | |
| 82 | #define sb_dquot_ops (&dquot_operations) |
| 83 | #define sb_quotactl_ops (&vfs_quotactl_ops) |
| 84 | |
| 85 | /* It is better to call this function outside of any transaction as it might |
| 86 | * need a lot of space in journal for dquot structure allocation. */ |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 87 | static inline void vfs_dq_init(struct inode *inode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | { |
| 89 | BUG_ON(!inode->i_sb); |
| 90 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) |
| 91 | inode->i_sb->dq_op->initialize(inode, -1); |
| 92 | } |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | /* The following allocation/freeing/transfer functions *must* be called inside |
| 95 | * a transaction (deadlocks possible otherwise) */ |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 96 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | { |
| 98 | if (sb_any_quota_enabled(inode->i_sb)) { |
| 99 | /* Used space is updated in alloc_space() */ |
| 100 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) |
| 101 | return 1; |
| 102 | } |
| 103 | else |
| 104 | inode_add_bytes(inode, nr); |
| 105 | return 0; |
| 106 | } |
| 107 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 108 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | { |
| 110 | int ret; |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 111 | if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | mark_inode_dirty(inode); |
| 113 | return ret; |
| 114 | } |
| 115 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 116 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | { |
| 118 | if (sb_any_quota_enabled(inode->i_sb)) { |
| 119 | /* Used space is updated in alloc_space() */ |
| 120 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) |
| 121 | return 1; |
| 122 | } |
| 123 | else |
| 124 | inode_add_bytes(inode, nr); |
| 125 | return 0; |
| 126 | } |
| 127 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 128 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | { |
| 130 | int ret; |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 131 | if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | mark_inode_dirty(inode); |
| 133 | return ret; |
| 134 | } |
| 135 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 136 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | { |
| 138 | if (sb_any_quota_enabled(inode->i_sb)) { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 139 | vfs_dq_init(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) |
| 141 | return 1; |
| 142 | } |
| 143 | return 0; |
| 144 | } |
| 145 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 146 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | { |
| 148 | if (sb_any_quota_enabled(inode->i_sb)) |
| 149 | inode->i_sb->dq_op->free_space(inode, nr); |
| 150 | else |
| 151 | inode_sub_bytes(inode, nr); |
| 152 | } |
| 153 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 154 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 156 | vfs_dq_free_space_nodirty(inode, nr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | mark_inode_dirty(inode); |
| 158 | } |
| 159 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 160 | static inline void vfs_dq_free_inode(struct inode *inode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | { |
| 162 | if (sb_any_quota_enabled(inode->i_sb)) |
| 163 | inode->i_sb->dq_op->free_inode(inode, 1); |
| 164 | } |
| 165 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | /* The following two functions cannot be called inside a transaction */ |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 167 | static inline void vfs_dq_sync(struct super_block *sb) |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 168 | { |
| 169 | sync_dquots(sb, -1); |
| 170 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 172 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | { |
| 174 | int ret = -ENOSYS; |
| 175 | |
Jan Kara | 0ff5af8 | 2008-04-28 02:14:33 -0700 | [diff] [blame] | 176 | if (sb->s_qcop && sb->s_qcop->quota_off) |
| 177 | ret = sb->s_qcop->quota_off(sb, -1, remount); |
| 178 | return ret; |
| 179 | } |
| 180 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | #else |
| 182 | |
Jan Kara | 74abb98 | 2008-07-25 01:46:51 -0700 | [diff] [blame^] | 183 | #define sb_has_quota_enabled(sb, type) 0 |
| 184 | #define sb_any_quota_enabled(sb) 0 |
| 185 | #define sb_has_quota_suspended(sb, type) 0 |
| 186 | #define sb_any_quota_suspended(sb) 0 |
| 187 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | /* |
| 189 | * NO-OP when quota not configured. |
| 190 | */ |
| 191 | #define sb_dquot_ops (NULL) |
| 192 | #define sb_quotactl_ops (NULL) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 193 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 194 | static inline void vfs_dq_init(struct inode *inode) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 195 | { |
| 196 | } |
| 197 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 198 | static inline void vfs_dq_drop(struct inode *inode) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 199 | { |
| 200 | } |
| 201 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 202 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 203 | { |
| 204 | return 0; |
| 205 | } |
| 206 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 207 | static inline void vfs_dq_free_inode(struct inode *inode) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 208 | { |
| 209 | } |
| 210 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 211 | static inline void vfs_dq_sync(struct super_block *sb) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 212 | { |
| 213 | } |
| 214 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 215 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 216 | { |
| 217 | return 0; |
| 218 | } |
| 219 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 220 | static inline int vfs_dq_quota_on_remount(struct super_block *sb) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 221 | { |
| 222 | return 0; |
| 223 | } |
| 224 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 225 | static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) |
Andrew Morton | 50f8c37 | 2008-04-28 02:14:35 -0700 | [diff] [blame] | 226 | { |
| 227 | return 0; |
| 228 | } |
| 229 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 230 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | { |
| 232 | inode_add_bytes(inode, nr); |
| 233 | return 0; |
| 234 | } |
| 235 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 236 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 238 | vfs_dq_prealloc_space_nodirty(inode, nr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | mark_inode_dirty(inode); |
| 240 | return 0; |
| 241 | } |
| 242 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 243 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | { |
| 245 | inode_add_bytes(inode, nr); |
| 246 | return 0; |
| 247 | } |
| 248 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 249 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 251 | vfs_dq_alloc_space_nodirty(inode, nr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | mark_inode_dirty(inode); |
| 253 | return 0; |
| 254 | } |
| 255 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 256 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | { |
| 258 | inode_sub_bytes(inode, nr); |
| 259 | } |
| 260 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 261 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 263 | vfs_dq_free_space_nodirty(inode, nr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | mark_inode_dirty(inode); |
| 265 | } |
| 266 | |
| 267 | #endif /* CONFIG_QUOTA */ |
| 268 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 269 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 270 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 271 | return vfs_dq_prealloc_space_nodirty(inode, |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 272 | nr << inode->i_sb->s_blocksize_bits); |
| 273 | } |
| 274 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 275 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 276 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 277 | return vfs_dq_prealloc_space(inode, |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 278 | nr << inode->i_sb->s_blocksize_bits); |
| 279 | } |
| 280 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 281 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 282 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 283 | return vfs_dq_alloc_space_nodirty(inode, |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 284 | nr << inode->i_sb->s_blocksize_bits); |
| 285 | } |
| 286 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 287 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 288 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 289 | return vfs_dq_alloc_space(inode, |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 290 | nr << inode->i_sb->s_blocksize_bits); |
| 291 | } |
| 292 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 293 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 294 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 295 | vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits); |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 296 | } |
| 297 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 298 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 299 | { |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 300 | vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits); |
Jan Kara | 03f6e92 | 2008-04-28 02:14:32 -0700 | [diff] [blame] | 301 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
Jan Kara | b85f4b8 | 2008-07-25 01:46:50 -0700 | [diff] [blame] | 303 | /* |
| 304 | * Define uppercase equivalents for compatibility with old function names |
| 305 | * Can go away when we think all users have been converted (15/04/2008) |
| 306 | */ |
| 307 | #define DQUOT_INIT(inode) vfs_dq_init(inode) |
| 308 | #define DQUOT_DROP(inode) vfs_dq_drop(inode) |
| 309 | #define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \ |
| 310 | vfs_dq_prealloc_space_nodirty(inode, nr) |
| 311 | #define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr) |
| 312 | #define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \ |
| 313 | vfs_dq_alloc_space_nodirty(inode, nr) |
| 314 | #define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr) |
| 315 | #define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \ |
| 316 | vfs_dq_prealloc_block_nodirty(inode, nr) |
| 317 | #define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr) |
| 318 | #define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \ |
| 319 | vfs_dq_alloc_block_nodirty(inode, nr) |
| 320 | #define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr) |
| 321 | #define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode) |
| 322 | #define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \ |
| 323 | vfs_dq_free_space_nodirty(inode, nr) |
| 324 | #define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr) |
| 325 | #define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \ |
| 326 | vfs_dq_free_block_nodirty(inode, nr) |
| 327 | #define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr) |
| 328 | #define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode) |
| 329 | #define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr) |
| 330 | #define DQUOT_SYNC(sb) vfs_dq_sync(sb) |
| 331 | #define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount) |
| 332 | #define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb) |
| 333 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | #endif /* _LINUX_QUOTAOPS_ */ |