Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94115
b: refs/heads/master
c: 03f6e92
h: refs/heads/master
i:
  94113: 13efe25
  94111: bac4e81
v: v3
  • Loading branch information
Jan Kara authored and Linus Torvalds committed Apr 28, 2008
1 parent 9e8bf8b commit 38ba572
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8794b5b246cf6f67baf57bd9db386e79ca5cac33
refs/heads/master: 03f6e92bdd467aed9d7571a571868563ae6ad288
10 changes: 9 additions & 1 deletion trunk/fs/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,15 @@ static void wait_on_dquot(struct dquot *dquot)
mutex_unlock(&dquot->dq_lock);
}

#define mark_dquot_dirty(dquot) ((dquot)->dq_sb->dq_op->mark_dirty(dquot))
static inline int dquot_dirty(struct dquot *dquot)
{
return test_bit(DQ_MOD_B, &dquot->dq_flags);
}

static inline int mark_dquot_dirty(struct dquot *dquot)
{
return dquot->dq_sb->dq_op->mark_dirty(dquot);
}

int dquot_mark_dquot_dirty(struct dquot *dquot)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/reiserfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static int finish_unfinished(struct super_block *s)
/* Turn quotas off */
for (i = 0; i < MAXQUOTAS; i++) {
if (sb_dqopt(s)->files[i])
vfs_quota_off_mount(s, i);
vfs_quota_off(s, i);
}
if (ms_active_set)
/* Restore the flag back */
Expand Down
5 changes: 0 additions & 5 deletions trunk/include/linux/quota.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,6 @@ struct quota_info {
struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
};

/* Inline would be better but we need to dereference super_block which is not defined yet */
int mark_dquot_dirty(struct dquot *dquot);

#define dquot_dirty(dquot) test_bit(DQ_MOD_B, &(dquot)->dq_flags)

#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
(sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))

Expand Down
71 changes: 50 additions & 21 deletions trunk/include/linux/quotaops.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *p
extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
int format_id, int type);
extern int vfs_quota_off(struct super_block *sb, int type);
#define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type)
extern int vfs_quota_sync(struct super_block *sb, int type);
extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
Expand All @@ -59,15 +58,15 @@ extern struct quotactl_ops vfs_quotactl_ops;

/* It is better to call this function outside of any transaction as it might
* need a lot of space in journal for dquot structure allocation. */
static __inline__ void DQUOT_INIT(struct inode *inode)
static inline void DQUOT_INIT(struct inode *inode)
{
BUG_ON(!inode->i_sb);
if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
inode->i_sb->dq_op->initialize(inode, -1);
}

/* The same as with DQUOT_INIT */
static __inline__ void DQUOT_DROP(struct inode *inode)
static inline void DQUOT_DROP(struct inode *inode)
{
/* Here we can get arbitrary inode from clear_inode() so we have
* to be careful. OTOH we don't need locking as quota operations
Expand All @@ -90,7 +89,7 @@ static __inline__ void DQUOT_DROP(struct inode *inode)

/* The following allocation/freeing/transfer functions *must* be called inside
* a transaction (deadlocks possible otherwise) */
static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
if (sb_any_quota_enabled(inode->i_sb)) {
/* Used space is updated in alloc_space() */
Expand All @@ -102,15 +101,15 @@ static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t
return 0;
}

static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
{
int ret;
if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr)))
mark_inode_dirty(inode);
return ret;
}

static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
if (sb_any_quota_enabled(inode->i_sb)) {
/* Used space is updated in alloc_space() */
Expand All @@ -122,15 +121,15 @@ static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
return 0;
}

static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
{
int ret;
if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr)))
mark_inode_dirty(inode);
return ret;
}

static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode)
static inline int DQUOT_ALLOC_INODE(struct inode *inode)
{
if (sb_any_quota_enabled(inode->i_sb)) {
DQUOT_INIT(inode);
Expand All @@ -140,27 +139,27 @@ static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode)
return 0;
}

static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
if (sb_any_quota_enabled(inode->i_sb))
inode->i_sb->dq_op->free_space(inode, nr);
else
inode_sub_bytes(inode, nr);
}

static __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
{
DQUOT_FREE_SPACE_NODIRTY(inode, nr);
mark_inode_dirty(inode);
}

static __inline__ void DQUOT_FREE_INODE(struct inode *inode)
static inline void DQUOT_FREE_INODE(struct inode *inode)
{
if (sb_any_quota_enabled(inode->i_sb))
inode->i_sb->dq_op->free_inode(inode, 1);
}

static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
{
if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
DQUOT_INIT(inode);
Expand All @@ -171,9 +170,12 @@ static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
}

/* The following two functions cannot be called inside a transaction */
#define DQUOT_SYNC(sb) sync_dquots(sb, -1)
static inline void DQUOT_SYNC(struct super_block *sb)
{
sync_dquots(sb, -1);
}

static __inline__ int DQUOT_OFF(struct super_block *sb)
static inline int DQUOT_OFF(struct super_block *sb)
{
int ret = -ENOSYS;

Expand All @@ -194,7 +196,7 @@ static __inline__ int DQUOT_OFF(struct super_block *sb)
#define DQUOT_ALLOC_INODE(inode) (0)
#define DQUOT_FREE_INODE(inode) do { } while(0)
#define DQUOT_SYNC(sb) do { } while(0)
#define DQUOT_OFF(sb) do { } while(0)
#define DQUOT_OFF(sb) (0)
#define DQUOT_TRANSFER(inode, iattr) (0)
static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
Expand Down Expand Up @@ -235,11 +237,38 @@ static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)

#endif /* CONFIG_QUOTA */

#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_PREALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits)
#define DQUOT_PREALLOC_BLOCK(inode, nr) DQUOT_PREALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits)
#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_ALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits)
#define DQUOT_ALLOC_BLOCK(inode, nr) DQUOT_ALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits)
#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) DQUOT_FREE_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits)
#define DQUOT_FREE_BLOCK(inode, nr) DQUOT_FREE_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits)
static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
{
return DQUOT_PREALLOC_SPACE_NODIRTY(inode,
nr << inode->i_sb->s_blocksize_bits);
}

static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr)
{
return DQUOT_PREALLOC_SPACE(inode,
nr << inode->i_sb->s_blocksize_bits);
}

static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
{
return DQUOT_ALLOC_SPACE_NODIRTY(inode,
nr << inode->i_sb->s_blocksize_bits);
}

static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr)
{
return DQUOT_ALLOC_SPACE(inode,
nr << inode->i_sb->s_blocksize_bits);
}

static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
{
DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits);
}

static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr)
{
DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits);
}

#endif /* _LINUX_QUOTAOPS_ */

0 comments on commit 38ba572

Please sign in to comment.