diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:26:37 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:26:37 -0400 |
| commit | e4ce30f3779c2ddaa7dfaa4042209e5dbacbada5 (patch) | |
| tree | cc64c1dcd16b5dbf71ebc8338b339e6fb04abaee /include/linux | |
| parent | b899ebeb05da4287ce845976727e3e83dadd25d5 (diff) | |
| parent | 14ece1028b3ed53ffec1b1213ffc6acaf79ad77c (diff) | |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (40 commits)
ext4: Make fsync sync new parent directories in no-journal mode
ext4: Drop whitespace at end of lines
ext4: Fix compat EXT4_IOC_ADD_GROUP
ext4: Conditionally define compat ioctl numbers
tracing: Convert more ext4 events to DEFINE_EVENT
ext4: Add new tracepoints to track mballoc's buddy bitmap loads
ext4: Add a missing trace hook
ext4: restart ext4_ext_remove_space() after transaction restart
ext4: Clear the EXT4_EOFBLOCKS_FL flag only when warranted
ext4: Avoid crashing on NULL ptr dereference on a filesystem error
ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
ext4: Convert calls of ext4_error() to EXT4_ERROR_INODE()
ext4: Convert callers of ext4_get_blocks() to use ext4_map_blocks()
ext4: Add new abstraction ext4_map_blocks() underneath ext4_get_blocks()
ext4: Use our own write_cache_pages()
ext4: Show journal_checksum option
ext4: Fix for ext4_mb_collect_stats()
ext4: check for a good block group before loading buddy pages
ext4: Prevent creation of files larger than RLIMIT_FSIZE using fallocate
ext4: Remove extraneous newlines in ext4_msg() calls
...
Fixed up trivial conflict in fs/ext4/fsync.c
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/quotaops.h | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 370abb1e99cb..e38ae53f3529 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
| @@ -9,6 +9,10 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
| 11 | 11 | ||
| 12 | #define DQUOT_SPACE_WARN 0x1 | ||
| 13 | #define DQUOT_SPACE_RESERVE 0x2 | ||
| 14 | #define DQUOT_SPACE_NOFAIL 0x4 | ||
| 15 | |||
| 12 | static inline struct quota_info *sb_dqopt(struct super_block *sb) | 16 | static inline struct quota_info *sb_dqopt(struct super_block *sb) |
| 13 | { | 17 | { |
| 14 | return &sb->s_dquot; | 18 | return &sb->s_dquot; |
| @@ -41,9 +45,8 @@ int dquot_scan_active(struct super_block *sb, | |||
| 41 | struct dquot *dquot_alloc(struct super_block *sb, int type); | 45 | struct dquot *dquot_alloc(struct super_block *sb, int type); |
| 42 | void dquot_destroy(struct dquot *dquot); | 46 | void dquot_destroy(struct dquot *dquot); |
| 43 | 47 | ||
| 44 | int __dquot_alloc_space(struct inode *inode, qsize_t number, | 48 | int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags); |
| 45 | int warn, int reserve); | 49 | void __dquot_free_space(struct inode *inode, qsize_t number, int flags); |
| 46 | void __dquot_free_space(struct inode *inode, qsize_t number, int reserve); | ||
| 47 | 50 | ||
| 48 | int dquot_alloc_inode(const struct inode *inode); | 51 | int dquot_alloc_inode(const struct inode *inode); |
| 49 | 52 | ||
| @@ -242,17 +245,17 @@ static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) | |||
| 242 | } | 245 | } |
| 243 | 246 | ||
| 244 | static inline int __dquot_alloc_space(struct inode *inode, qsize_t number, | 247 | static inline int __dquot_alloc_space(struct inode *inode, qsize_t number, |
| 245 | int warn, int reserve) | 248 | int flags) |
| 246 | { | 249 | { |
| 247 | if (!reserve) | 250 | if (!(flags & DQUOT_SPACE_RESERVE)) |
| 248 | inode_add_bytes(inode, number); | 251 | inode_add_bytes(inode, number); |
| 249 | return 0; | 252 | return 0; |
| 250 | } | 253 | } |
| 251 | 254 | ||
| 252 | static inline void __dquot_free_space(struct inode *inode, qsize_t number, | 255 | static inline void __dquot_free_space(struct inode *inode, qsize_t number, |
| 253 | int reserve) | 256 | int flags) |
| 254 | { | 257 | { |
| 255 | if (!reserve) | 258 | if (!(flags & DQUOT_SPACE_RESERVE)) |
| 256 | inode_sub_bytes(inode, number); | 259 | inode_sub_bytes(inode, number); |
| 257 | } | 260 | } |
| 258 | 261 | ||
| @@ -268,7 +271,13 @@ static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) | |||
| 268 | 271 | ||
| 269 | static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) | 272 | static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
| 270 | { | 273 | { |
| 271 | return __dquot_alloc_space(inode, nr, 1, 0); | 274 | return __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN); |
| 275 | } | ||
| 276 | |||
| 277 | static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr) | ||
| 278 | { | ||
| 279 | __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN|DQUOT_SPACE_NOFAIL); | ||
| 280 | mark_inode_dirty(inode); | ||
| 272 | } | 281 | } |
| 273 | 282 | ||
| 274 | static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) | 283 | static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) |
| @@ -286,6 +295,11 @@ static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr) | |||
| 286 | return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); | 295 | return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); |
| 287 | } | 296 | } |
| 288 | 297 | ||
| 298 | static inline void dquot_alloc_block_nofail(struct inode *inode, qsize_t nr) | ||
| 299 | { | ||
| 300 | dquot_alloc_space_nofail(inode, nr << inode->i_blkbits); | ||
| 301 | } | ||
| 302 | |||
| 289 | static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) | 303 | static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) |
| 290 | { | 304 | { |
| 291 | return dquot_alloc_space(inode, nr << inode->i_blkbits); | 305 | return dquot_alloc_space(inode, nr << inode->i_blkbits); |
| @@ -293,7 +307,7 @@ static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) | |||
| 293 | 307 | ||
| 294 | static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr) | 308 | static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
| 295 | { | 309 | { |
| 296 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0, 0); | 310 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0); |
| 297 | } | 311 | } |
| 298 | 312 | ||
| 299 | static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) | 313 | static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) |
| @@ -308,7 +322,8 @@ static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) | |||
| 308 | 322 | ||
| 309 | static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) | 323 | static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) |
| 310 | { | 324 | { |
| 311 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 1, 1); | 325 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, |
| 326 | DQUOT_SPACE_WARN|DQUOT_SPACE_RESERVE); | ||
| 312 | } | 327 | } |
| 313 | 328 | ||
| 314 | static inline int dquot_claim_block(struct inode *inode, qsize_t nr) | 329 | static inline int dquot_claim_block(struct inode *inode, qsize_t nr) |
| @@ -345,7 +360,7 @@ static inline void dquot_free_block(struct inode *inode, qsize_t nr) | |||
| 345 | static inline void dquot_release_reservation_block(struct inode *inode, | 360 | static inline void dquot_release_reservation_block(struct inode *inode, |
| 346 | qsize_t nr) | 361 | qsize_t nr) |
| 347 | { | 362 | { |
| 348 | __dquot_free_space(inode, nr << inode->i_blkbits, 1); | 363 | __dquot_free_space(inode, nr << inode->i_blkbits, DQUOT_SPACE_RESERVE); |
| 349 | } | 364 | } |
| 350 | 365 | ||
| 351 | #endif /* _LINUX_QUOTAOPS_ */ | 366 | #endif /* _LINUX_QUOTAOPS_ */ |
