The series of patches below cleans up quota header files. It does several
things:
1) Rename functions from uppercase to lowercase (compatibility macros
introduced)
2) Remove some unnecessary definitions
3) Split quota.h into two files so that we can properly declare inline
functions.
4) Change macros to inline functions.
So far no filesystem is converted from old function names to new ones -
that is an independent step and I'll hopefully get to that later :).
Andrew, would you merge this series?
Honza
Since there is only a single place which uses info_any_dirty() and that
is a trivial macro, just remove the use of this macro completely.
Signed-off-by: Jan Kara <[email protected]>
---
fs/quota.c | 7 +++++--
include/linux/quota.h | 2 --
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/quota.c b/fs/quota.c
index db1cc9f..f0702f4 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -199,8 +199,11 @@ restart:
list_for_each_entry(sb, &super_blocks, s_list) {
/* This test just improves performance so it needn't be reliable... */
for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++)
- if ((type == cnt || type == -1) && sb_has_quota_enabled(sb, cnt)
- && info_any_dirty(&sb_dqopt(sb)->info[cnt]))
+ if ((type == cnt || type == -1)
+ && sb_has_quota_enabled(sb, cnt)
+ && (info_dirty(&sb_dqopt(sb)->info[cnt])
+ || !list_empty(&sb_dqopt(sb)->
+ info[cnt].dqi_dirty_list)))
dirty = 1;
if (!dirty)
continue;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index dcddfb2..6f1d97d 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -224,8 +224,6 @@ struct super_block;
extern void mark_info_dirty(struct super_block *sb, int type);
#define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags)
-#define info_any_dquot_dirty(info) (!list_empty(&(info)->dqi_dirty_list))
-#define info_any_dirty(info) (info_dirty(info) || info_any_dquot_dirty(info))
#define sb_dqopt(sb) (&(sb)->s_dquot)
#define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type))
--
1.5.2.4
We need definitions from quota.h. So far we depended on fs.h on including
this file for us and this is going to change.
Signed-off-by: Jan Kara <[email protected]>
---
fs/ext4/ext4_jbd2.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index 9255a7d..be2301c 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -17,6 +17,7 @@
#include <linux/fs.h>
#include <linux/jbd2.h>
+#include <linux/quota.h>
#include "ext4.h"
#define EXT4_JOURNAL(inode) (EXT4_SB((inode)->i_sb)->s_journal)
--
1.5.2.4
Split some structure definitions from quota.h to quota_struct.h so that they
can be separately included in fs.h. This makes it possible to declare some
useful inline functions in quota.h because it can now include fs.h.
Signed-off-by: Jan Kara <[email protected]>
---
include/linux/fs.h | 2 +-
include/linux/quota.h | 193 +---------------------------------------------
include/linux/quotaops.h | 1 +
include/linux/syscalls.h | 2 +-
4 files changed, 5 insertions(+), 193 deletions(-)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f413085..c0f70f2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -364,7 +364,7 @@ struct iattr {
/*
* Includes for diskquotas.
*/
-#include <linux/quota.h>
+#include <linux/quota_struct.h>
/**
* enum positive_aop_returns - aop return codes with specific semantics
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 6f1d97d..841c4ae 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -37,13 +37,11 @@
#include <linux/errno.h>
#include <linux/types.h>
+#include <linux/quota_struct.h>
#define __DQUOT_VERSION__ "dquot_6.5.1"
#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
-typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
-typedef __u64 qsize_t; /* Type in which we store sizes */
-
/* Size of blocks in which are counted size limits */
#define QUOTABLOCK_BITS 10
#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
@@ -53,10 +51,6 @@ typedef __u64 qsize_t; /* Type in which we store sizes */
#define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10))
#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
-#define MAXQUOTAS 2
-#define USRQUOTA 0 /* element used for user quotas */
-#define GRPQUOTA 1 /* element used for group quotas */
-
/*
* Definitions for the default names of the quotas files.
*/
@@ -86,49 +80,6 @@ typedef __u64 qsize_t; /* Type in which we store sizes */
#define Q_SETQUOTA 0x800008 /* set user quota structure */
/*
- * Quota structure used for communication with userspace via quotactl
- * Following flags are used to specify which fields are valid
- */
-#define QIF_BLIMITS 1
-#define QIF_SPACE 2
-#define QIF_ILIMITS 4
-#define QIF_INODES 8
-#define QIF_BTIME 16
-#define QIF_ITIME 32
-#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
-#define QIF_USAGE (QIF_SPACE | QIF_INODES)
-#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
-#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
-
-struct if_dqblk {
- __u64 dqb_bhardlimit;
- __u64 dqb_bsoftlimit;
- __u64 dqb_curspace;
- __u64 dqb_ihardlimit;
- __u64 dqb_isoftlimit;
- __u64 dqb_curinodes;
- __u64 dqb_btime;
- __u64 dqb_itime;
- __u32 dqb_valid;
-};
-
-/*
- * Structure used for setting quota information about file via quotactl
- * Following flags are used to specify which fields are valid
- */
-#define IIF_BGRACE 1
-#define IIF_IGRACE 2
-#define IIF_FLAGS 4
-#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
-
-struct if_dqinfo {
- __u64 dqi_bgrace;
- __u64 dqi_igrace;
- __u32 dqi_flags;
- __u32 dqi_valid;
-};
-
-/*
* Definitions for quota netlink interface
*/
#define QUOTA_NL_NOWARN 0
@@ -160,15 +111,7 @@ enum {
#ifdef __KERNEL__
-#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/rwsem.h>
#include <linux/spinlock.h>
-#include <linux/wait.h>
-
-#include <linux/dqblk_xfs.h>
-#include <linux/dqblk_v1.h>
-#include <linux/dqblk_v2.h>
#include <asm/atomic.h>
@@ -181,48 +124,7 @@ extern spinlock_t dq_data_lock;
#define DQUOT_DEL_ALLOC max(V1_DEL_ALLOC, V2_DEL_ALLOC)
#define DQUOT_DEL_REWRITE max(V1_DEL_REWRITE, V2_DEL_REWRITE)
-/*
- * Data for one user/group kept in memory
- */
-struct mem_dqblk {
- __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */
- __u32 dqb_bsoftlimit; /* preferred limit on disk blks */
- qsize_t dqb_curspace; /* current used space */
- __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */
- __u32 dqb_isoftlimit; /* preferred inode limit */
- __u32 dqb_curinodes; /* current # allocated inodes */
- time_t dqb_btime; /* time limit for excessive disk use */
- time_t dqb_itime; /* time limit for excessive inode use */
-};
-
-/*
- * Data for one quotafile kept in memory
- */
-struct quota_format_type;
-
-struct mem_dqinfo {
- struct quota_format_type *dqi_format;
- int dqi_fmt_id; /* Id of the dqi_format - used when turning
- * quotas on after remount RW */
- struct list_head dqi_dirty_list; /* List of dirty dquots */
- unsigned long dqi_flags;
- unsigned int dqi_bgrace;
- unsigned int dqi_igrace;
- qsize_t dqi_maxblimit;
- qsize_t dqi_maxilimit;
- union {
- struct v1_mem_dqinfo v1_i;
- struct v2_mem_dqinfo v2_i;
- } u;
-};
-
-struct super_block;
-
-#define DQF_MASK 0xffff /* Mask for format specific flags */
-#define DQF_INFO_DIRTY_B 16
-#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
-
-extern void mark_info_dirty(struct super_block *sb, int type);
+void mark_info_dirty(struct super_block *sb, int type);
#define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags)
#define sb_dqopt(sb) (&(sb)->s_dquot)
@@ -241,100 +143,9 @@ struct dqstats {
extern struct dqstats dqstats;
-#define DQ_MOD_B 0 /* dquot modified since read */
-#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */
-#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */
-#define DQ_FAKE_B 3 /* no limits only usage */
-#define DQ_READ_B 4 /* dquot was read into memory */
-#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */
-
-struct dquot {
- struct hlist_node dq_hash; /* Hash list in memory */
- struct list_head dq_inuse; /* List of all quotas */
- struct list_head dq_free; /* Free list element */
- struct list_head dq_dirty; /* List of dirty dquots */
- struct mutex dq_lock; /* dquot IO lock */
- atomic_t dq_count; /* Use count */
- wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */
- struct super_block *dq_sb; /* superblock this applies to */
- unsigned int dq_id; /* ID this applies to (uid, gid) */
- loff_t dq_off; /* Offset of dquot on disk */
- unsigned long dq_flags; /* See DQ_* */
- short dq_type; /* Type of quota */
- struct mem_dqblk dq_dqb; /* Diskquota usage */
-};
-
-#define NODQUOT (struct dquot *)NULL
-
#define QUOTA_OK 0
#define NO_QUOTA 1
-/* Operations which must be implemented by each quota format */
-struct quota_format_ops {
- int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */
- int (*read_file_info)(struct super_block *sb, int type); /* Read main info about file - called on quotaon() */
- int (*write_file_info)(struct super_block *sb, int type); /* Write main info about file */
- int (*free_file_info)(struct super_block *sb, int type); /* Called on quotaoff() */
- int (*read_dqblk)(struct dquot *dquot); /* Read structure for one user */
- int (*commit_dqblk)(struct dquot *dquot); /* Write structure for one user */
- int (*release_dqblk)(struct dquot *dquot); /* Called when last reference to dquot is being dropped */
-};
-
-/* Operations working with dquots */
-struct dquot_operations {
- int (*initialize) (struct inode *, int);
- int (*drop) (struct inode *);
- int (*alloc_space) (struct inode *, qsize_t, int);
- int (*alloc_inode) (const struct inode *, unsigned long);
- int (*free_space) (struct inode *, qsize_t);
- int (*free_inode) (const struct inode *, unsigned long);
- int (*transfer) (struct inode *, struct iattr *);
- int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
- int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */
- int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
- int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
- int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
-};
-
-/* Operations handling requests from userspace */
-struct quotactl_ops {
- int (*quota_on)(struct super_block *, int, int, char *, int);
- int (*quota_off)(struct super_block *, int, int);
- int (*quota_sync)(struct super_block *, int);
- int (*get_info)(struct super_block *, int, struct if_dqinfo *);
- int (*set_info)(struct super_block *, int, struct if_dqinfo *);
- int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *);
- int (*set_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *);
- int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
- int (*set_xstate)(struct super_block *, unsigned int, int);
- int (*get_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
- int (*set_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
-};
-
-struct quota_format_type {
- int qf_fmt_id; /* Quota format id */
- struct quota_format_ops *qf_ops; /* Operations of format */
- struct module *qf_owner; /* Module implementing quota format */
- struct quota_format_type *qf_next;
-};
-
-#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
-#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */
-#define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but
- * we have necessary info in
- * memory to turn them on */
-#define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */
-
-struct quota_info {
- unsigned int flags; /* Flags for diskquotas on this device */
- struct mutex dqio_mutex; /* lock device while I/O in progress */
- struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
- struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
- struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
- struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
- struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
-};
-
#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
(sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 0c8f9fe..8b7bdf5 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -13,6 +13,7 @@
#include <linux/smp_lock.h>
#include <linux/fs.h>
+#include <linux/quota.h>
#if defined(CONFIG_QUOTA)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 0522f36..23b7ef0 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -62,7 +62,7 @@ struct getcpu_cache;
#include <linux/sem.h>
#include <asm/siginfo.h>
#include <asm/signal.h>
-#include <linux/quota.h>
+#include <linux/quota_struct.h>
#include <linux/key.h>
asmlinkage long sys_time(time_t __user *tloc);
--
1.5.2.4
Cleanup quotaops.h: Rename functions from uppercase to lowercase (and define
backward compatibility macros), move larger functions to dquot.c and make
them non-inline.
Signed-off-by: Jan Kara <[email protected]>
---
fs/dquot.c | 53 +++++++++++
include/linux/quotaops.h | 226 ++++++++++++++++++++++------------------------
2 files changed, 160 insertions(+), 119 deletions(-)
diff --git a/fs/dquot.c b/fs/dquot.c
index 5ac77da..2664602 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1139,6 +1139,28 @@ int dquot_drop(struct inode *inode)
return 0;
}
+/* Wrapper to remove references to quota structures from inode */
+void vfs_dq_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
+ * are allowed to change only at mount time */
+ if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op
+ && inode->i_sb->dq_op->drop) {
+ int cnt;
+ /* Test before calling to rule out calls from proc and such
+ * where we are not allowed to block. Note that this is
+ * actually reliable test even without the lock - the caller
+ * must assure that nobody can come after the DQUOT_DROP and
+ * add quota pointers back anyway */
+ for (cnt = 0; cnt < MAXQUOTAS; cnt++)
+ if (inode->i_dquot[cnt] != NODQUOT)
+ break;
+ if (cnt < MAXQUOTAS)
+ inode->i_sb->dq_op->drop(inode);
+ }
+}
+
/*
* Following four functions update i_blocks+i_bytes fields and
* quota information (together with appropriate checks)
@@ -1412,6 +1434,18 @@ warn_put_all:
return ret;
}
+/* Wrapper for transferring ownership of an inode */
+int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
+{
+ if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
+ vfs_dq_init(inode);
+ if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA)
+ return 1;
+ }
+ return 0;
+}
+
+
/*
* Write info of quota file to disk
*/
@@ -1752,6 +1786,22 @@ out:
return error;
}
+/* Wrapper to turn on quotas when remounting rw */
+int vfs_dq_quota_on_remount(struct super_block *sb)
+{
+ int cnt;
+ int ret = 0, err;
+
+ if (!sb->s_qcop || !sb->s_qcop->quota_on)
+ return -ENOSYS;
+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
+ err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
+ if (err < 0 && !ret)
+ ret = err;
+ }
+ return ret;
+}
+
/* Generic routine for getting common part of quota structure */
static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di)
{
@@ -2087,8 +2137,11 @@ EXPORT_SYMBOL(dquot_release);
EXPORT_SYMBOL(dquot_mark_dquot_dirty);
EXPORT_SYMBOL(dquot_initialize);
EXPORT_SYMBOL(dquot_drop);
+EXPORT_SYMBOL(vfs_dq_drop);
EXPORT_SYMBOL(dquot_alloc_space);
EXPORT_SYMBOL(dquot_alloc_inode);
EXPORT_SYMBOL(dquot_free_space);
EXPORT_SYMBOL(dquot_free_inode);
EXPORT_SYMBOL(dquot_transfer);
+EXPORT_SYMBOL(vfs_dq_transfer);
+EXPORT_SYMBOL(vfs_dq_quota_on_remount);
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index f867020..0c8f9fe 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -19,34 +19,38 @@
/*
* declaration of quota_function calls in kernel.
*/
-extern void sync_dquots(struct super_block *sb, int type);
-
-extern int dquot_initialize(struct inode *inode, int type);
-extern int dquot_drop(struct inode *inode);
-
-extern int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
-extern int dquot_alloc_inode(const struct inode *inode, unsigned long number);
-
-extern int dquot_free_space(struct inode *inode, qsize_t number);
-extern int dquot_free_inode(const struct inode *inode, unsigned long number);
-
-extern int dquot_transfer(struct inode *inode, struct iattr *iattr);
-extern int dquot_commit(struct dquot *dquot);
-extern int dquot_acquire(struct dquot *dquot);
-extern int dquot_release(struct dquot *dquot);
-extern int dquot_commit_info(struct super_block *sb, int type);
-extern int dquot_mark_dquot_dirty(struct dquot *dquot);
-
-extern int vfs_quota_on(struct super_block *sb, int type, int format_id,
- char *path, int remount);
-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, int remount);
-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);
-extern int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
-extern int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
+void sync_dquots(struct super_block *sb, int type);
+
+int dquot_initialize(struct inode *inode, int type);
+int dquot_drop(struct inode *inode);
+
+int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
+int dquot_alloc_inode(const struct inode *inode, unsigned long number);
+
+int dquot_free_space(struct inode *inode, qsize_t number);
+int dquot_free_inode(const struct inode *inode, unsigned long number);
+
+int dquot_transfer(struct inode *inode, struct iattr *iattr);
+int dquot_commit(struct dquot *dquot);
+int dquot_acquire(struct dquot *dquot);
+int dquot_release(struct dquot *dquot);
+int dquot_commit_info(struct super_block *sb, int type);
+int dquot_mark_dquot_dirty(struct dquot *dquot);
+
+int vfs_quota_on(struct super_block *sb, int type, int format_id,
+ char *path, int remount);
+int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
+ int format_id, int type);
+int vfs_quota_off(struct super_block *sb, int type, int remount);
+int vfs_quota_sync(struct super_block *sb, int type);
+int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
+int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
+int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
+int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
+
+void vfs_dq_drop(struct inode *inode);
+int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
+int vfs_dq_quota_on_remount(struct super_block *sb);
/*
* Operations supported for diskquotas.
@@ -59,38 +63,16 @@ 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 vfs_dq_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)
-{
- /* Here we can get arbitrary inode from clear_inode() so we have
- * to be careful. OTOH we don't need locking as quota operations
- * are allowed to change only at mount time */
- if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op
- && inode->i_sb->dq_op->drop) {
- int cnt;
- /* Test before calling to rule out calls from proc and such
- * where we are not allowed to block. Note that this is
- * actually reliable test even without the lock - the caller
- * must assure that nobody can come after the DQUOT_DROP and
- * add quota pointers back anyway */
- for (cnt = 0; cnt < MAXQUOTAS; cnt++)
- if (inode->i_dquot[cnt] != NODQUOT)
- break;
- if (cnt < MAXQUOTAS)
- inode->i_sb->dq_op->drop(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 vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
{
if (sb_any_quota_enabled(inode->i_sb)) {
/* Used space is updated in alloc_space() */
@@ -102,15 +84,15 @@ static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
return 0;
}
-static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
{
int ret;
- if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr)))
+ if (!(ret = vfs_dq_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 vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
{
if (sb_any_quota_enabled(inode->i_sb)) {
/* Used space is updated in alloc_space() */
@@ -122,25 +104,25 @@ 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 vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
{
int ret;
- if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr)))
+ if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
mark_inode_dirty(inode);
return ret;
}
-static inline int DQUOT_ALLOC_INODE(struct inode *inode)
+static inline int vfs_dq_alloc_inode(struct inode *inode)
{
if (sb_any_quota_enabled(inode->i_sb)) {
- DQUOT_INIT(inode);
+ vfs_dq_init(inode);
if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
return 1;
}
return 0;
}
-static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
+static inline void vfs_dq_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);
@@ -148,35 +130,25 @@ static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
inode_sub_bytes(inode, nr);
}
-static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
+static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
{
- DQUOT_FREE_SPACE_NODIRTY(inode, nr);
+ vfs_dq_free_space_nodirty(inode, nr);
mark_inode_dirty(inode);
}
-static inline void DQUOT_FREE_INODE(struct inode *inode)
+static inline void vfs_dq_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)
-{
- if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
- DQUOT_INIT(inode);
- if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA)
- return 1;
- }
- return 0;
-}
-
/* The following two functions cannot be called inside a transaction */
-static inline void DQUOT_SYNC(struct super_block *sb)
+static inline void vfs_dq_sync(struct super_block *sb)
{
sync_dquots(sb, -1);
}
-static inline int DQUOT_OFF(struct super_block *sb, int remount)
+static inline int vfs_dq_off(struct super_block *sb, int remount)
{
int ret = -ENOSYS;
@@ -185,21 +157,6 @@ static inline int DQUOT_OFF(struct super_block *sb, int remount)
return ret;
}
-static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
-{
- int cnt;
- int ret = 0, err;
-
- if (!sb->s_qcop || !sb->s_qcop->quota_on)
- return -ENOSYS;
- for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
- err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
- if (err < 0 && !ret)
- ret = err;
- }
- return ret;
-}
-
#else
/*
@@ -208,113 +165,144 @@ static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
#define sb_dquot_ops (NULL)
#define sb_quotactl_ops (NULL)
-static inline void DQUOT_INIT(struct inode *inode)
+static inline void vfs_dq_init(struct inode *inode)
{
}
-static inline void DQUOT_DROP(struct inode *inode)
+static inline void vfs_dq_drop(struct inode *inode)
{
}
-static inline int DQUOT_ALLOC_INODE(struct inode *inode)
+static inline int vfs_dq_alloc_inode(struct inode *inode)
{
return 0;
}
-static inline void DQUOT_FREE_INODE(struct inode *inode)
+static inline void vfs_dq_free_inode(struct inode *inode)
{
}
-static inline void DQUOT_SYNC(struct super_block *sb)
+static inline void vfs_dq_sync(struct super_block *sb)
{
}
-static inline int DQUOT_OFF(struct super_block *sb, int remount)
+static inline int vfs_dq_off(struct super_block *sb, int remount)
{
return 0;
}
-static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
+static inline int vfs_dq_quota_on_remount(struct super_block *sb)
{
return 0;
}
-static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
+static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
{
return 0;
}
-static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
{
inode_add_bytes(inode, nr);
return 0;
}
-static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
{
- DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr);
+ vfs_dq_prealloc_space_nodirty(inode, nr);
mark_inode_dirty(inode);
return 0;
}
-static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
{
inode_add_bytes(inode, nr);
return 0;
}
-static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
{
- DQUOT_ALLOC_SPACE_NODIRTY(inode, nr);
+ vfs_dq_alloc_space_nodirty(inode, nr);
mark_inode_dirty(inode);
return 0;
}
-static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
+static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
{
inode_sub_bytes(inode, nr);
}
-static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
+static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
{
- DQUOT_FREE_SPACE_NODIRTY(inode, nr);
+ vfs_dq_free_space_nodirty(inode, nr);
mark_inode_dirty(inode);
}
#endif /* CONFIG_QUOTA */
-static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
{
- return DQUOT_PREALLOC_SPACE_NODIRTY(inode,
+ return vfs_dq_prealloc_space_nodirty(inode,
nr << inode->i_sb->s_blocksize_bits);
}
-static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
{
- return DQUOT_PREALLOC_SPACE(inode,
+ return vfs_dq_prealloc_space(inode,
nr << inode->i_sb->s_blocksize_bits);
}
-static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
{
- return DQUOT_ALLOC_SPACE_NODIRTY(inode,
+ return vfs_dq_alloc_space_nodirty(inode,
nr << inode->i_sb->s_blocksize_bits);
}
-static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr)
+static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
{
- return DQUOT_ALLOC_SPACE(inode,
+ return vfs_dq_alloc_space(inode,
nr << inode->i_sb->s_blocksize_bits);
}
-static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
+static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
{
- DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits);
+ vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits);
}
-static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr)
+static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
{
- DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits);
+ vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits);
}
+/*
+ * Define uppercase equivalents for compatibility with old function names
+ * Can go away when we think all users have been converted (15/04/2008)
+ */
+#define DQUOT_INIT(inode) vfs_dq_init(inode)
+#define DQUOT_DROP(inode) vfs_dq_drop(inode)
+#define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \
+ vfs_dq_prealloc_space_nodirty(inode, nr)
+#define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr)
+#define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \
+ vfs_dq_alloc_space_nodirty(inode, nr)
+#define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr)
+#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \
+ vfs_dq_prealloc_block_nodirty(inode, nr)
+#define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr)
+#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \
+ vfs_dq_alloc_block_nodirty(inode, nr)
+#define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr)
+#define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode)
+#define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \
+ vfs_dq_free_space_nodirty(inode, nr)
+#define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr)
+#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \
+ vfs_dq_free_block_nodirty(inode, nr)
+#define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr)
+#define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode)
+#define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr)
+#define DQUOT_SYNC(sb) vfs_dq_sync(sb)
+#define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount)
+#define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb)
+
#endif /* _LINUX_QUOTAOPS_ */
--
1.5.2.4
Signed-off-by: Jan Kara <[email protected]>
---
include/linux/quota.h | 53 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 841c4ae..04ec8c5 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -125,10 +125,20 @@ extern spinlock_t dq_data_lock;
#define DQUOT_DEL_REWRITE max(V1_DEL_REWRITE, V2_DEL_REWRITE)
void mark_info_dirty(struct super_block *sb, int type);
-#define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags)
+static inline int info_dirty(struct mem_dqinfo *info)
+{
+ return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
+}
-#define sb_dqopt(sb) (&(sb)->s_dquot)
-#define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type))
+static inline struct quota_info *sb_dqopt(struct super_block *sb)
+{
+ return &sb->s_dquot;
+}
+
+static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
+{
+ return sb_dqopt(sb)->info + type;
+}
struct dqstats {
int lookups;
@@ -146,18 +156,31 @@ extern struct dqstats dqstats;
#define QUOTA_OK 0
#define NO_QUOTA 1
-#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
- (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
-
-#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
- sb_has_quota_enabled(sb, GRPQUOTA))
-
-#define sb_has_quota_suspended(sb, type) \
- ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
- (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
-
-#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
- sb_has_quota_suspended(sb, GRPQUOTA))
+static inline int sb_has_quota_enabled(struct super_block *sb, int type)
+{
+ if (type == USRQUOTA)
+ return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED;
+ return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED;
+}
+
+static inline int sb_any_quota_enabled(struct super_block *sb)
+{
+ return sb_has_quota_enabled(sb, USRQUOTA) ||
+ sb_has_quota_enabled(sb, GRPQUOTA);
+}
+
+static inline int sb_has_quota_suspended(struct super_block *sb, int type)
+{
+ if (type == USRQUOTA)
+ return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED;
+ return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED;
+}
+
+static inline int sb_any_quota_suspended(struct super_block *sb)
+{
+ return sb_has_quota_suspended(sb, USRQUOTA) ||
+ sb_has_quota_suspended(sb, GRPQUOTA);
+}
int register_quota_format(struct quota_format_type *fmt);
void unregister_quota_format(struct quota_format_type *fmt);
--
1.5.2.4
We need definitions from quota.h and so far we depended on fs.h to
include this file for us. This will be no longer true.
Signed-off-by: Jan Kara <[email protected]>
---
fs/ext2/super.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index ef50cbc..609df85 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -31,6 +31,7 @@
#include <linux/seq_file.h>
#include <linux/mount.h>
#include <linux/log2.h>
+#include <linux/quota.h>
#include <asm/uaccess.h>
#include "ext2.h"
#include "xattr.h"
--
1.5.2.4
Hi,
On Mon, Jun 2, 2008 at 7:11 PM, Jan Kara <[email protected]> wrote:
> Since there is only a single place which uses info_any_dirty() and that
> is a trivial macro, just remove the use of this macro completely.
>
> Signed-off-by: Jan Kara <[email protected]>
> ---
> fs/quota.c | 7 +++++--
> include/linux/quota.h | 2 --
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/fs/quota.c b/fs/quota.c
> index db1cc9f..f0702f4 100644
> --- a/fs/quota.c
> +++ b/fs/quota.c
> @@ -199,8 +199,11 @@ restart:
> list_for_each_entry(sb, &super_blocks, s_list) {
> /* This test just improves performance so it needn't be reliable... */
> for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++)
> - if ((type == cnt || type == -1) && sb_has_quota_enabled(sb, cnt)
> - && info_any_dirty(&sb_dqopt(sb)->info[cnt]))
> + if ((type == cnt || type == -1)
> + && sb_has_quota_enabled(sb, cnt)
> + && (info_dirty(&sb_dqopt(sb)->info[cnt])
> + || !list_empty(&sb_dqopt(sb)->
> + info[cnt].dqi_dirty_list)))
> dirty = 1;
This is really too hideous in my opinion and looks like a candidate
for its own static inline function.
Or you can try to rewrite the boolean expression on multiple lines
using continue, something like:
- for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++)
- if ((type == cnt || type == -1) && sb_has_quota_enabled(
- && info_any_dirty(&sb_dqopt(sb)->info[cnt]))
- dirty = 1;
+ for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++) {
+ if (type != cnt && type != -1)
+ continue;
+ if (!sb_has_quota_enabled(sb, cnt))
+ continue;
+ if (!info_any_dirty(&sb_dqopt(sb)->info[cnt]))
+ continue;
+ dirty = 1;
+ }
(This uses the original macro, I know. How about moving that from the
header to a new inline function just above this function?)
What do you think?
Vegard
PS: This is a really good clean-up effort. Good work!
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
Hi,
Thanks for reading the patches.
> On Mon, Jun 2, 2008 at 7:11 PM, Jan Kara <[email protected]> wrote:
> > Since there is only a single place which uses info_any_dirty() and that
> > is a trivial macro, just remove the use of this macro completely.
> >
> > Signed-off-by: Jan Kara <[email protected]>
> > ---
> > fs/quota.c | 7 +++++--
> > include/linux/quota.h | 2 --
> > 2 files changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/fs/quota.c b/fs/quota.c
> > index db1cc9f..f0702f4 100644
> > --- a/fs/quota.c
> > +++ b/fs/quota.c
> > @@ -199,8 +199,11 @@ restart:
> > list_for_each_entry(sb, &super_blocks, s_list) {
> > /* This test just improves performance so it needn't be reliable... */
> > for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++)
> > - if ((type == cnt || type == -1) && sb_has_quota_enabled(sb, cnt)
> > - && info_any_dirty(&sb_dqopt(sb)->info[cnt]))
> > + if ((type == cnt || type == -1)
> > + && sb_has_quota_enabled(sb, cnt)
> > + && (info_dirty(&sb_dqopt(sb)->info[cnt])
> > + || !list_empty(&sb_dqopt(sb)->
> > + info[cnt].dqi_dirty_list)))
> > dirty = 1;
>
> This is really too hideous in my opinion and looks like a candidate
> for its own static inline function.
>
> Or you can try to rewrite the boolean expression on multiple lines
> using continue, something like:
>
> - for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++)
> - if ((type == cnt || type == -1) && sb_has_quota_enabled(
> - && info_any_dirty(&sb_dqopt(sb)->info[cnt]))
> - dirty = 1;
> + for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++) {
> + if (type != cnt && type != -1)
> + continue;
> + if (!sb_has_quota_enabled(sb, cnt))
> + continue;
> + if (!info_any_dirty(&sb_dqopt(sb)->info[cnt]))
> + continue;
> + dirty = 1;
> + }
>
> (This uses the original macro, I know. How about moving that from the
> header to a new inline function just above this function?)
I like this one better. I've rewritten it and you don't even need the
'dirty' variable. The resulting patch is below.
> PS: This is a really good clean-up effort. Good work!
Thanks. I'm just cleaning up my own mess... ;)
Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR
---
>From 7509c2a0cf5d64687b1b68bde5ec2f7cb625688e Mon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Mon, 2 Jun 2008 18:27:15 +0200
Subject: [PATCH] quota: Cleanup loop in sync_dquots()
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 <[email protected]>
---
fs/quota.c | 18 ++++++++++++------
include/linux/quota.h | 2 --
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/fs/quota.c b/fs/quota.c
index db1cc9f..7f4386e 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -186,7 +186,7 @@ static void quota_sync_sb(struct super_block *sb, int type)
void sync_dquots(struct super_block *sb, int type)
{
- int cnt, dirty;
+ int cnt;
if (sb) {
if (sb->s_qcop->quota_sync)
@@ -198,11 +198,17 @@ void sync_dquots(struct super_block *sb, int type)
restart:
list_for_each_entry(sb, &super_blocks, s_list) {
/* This test just improves performance so it needn't be reliable... */
- for (cnt = 0, dirty = 0; cnt < MAXQUOTAS; cnt++)
- if ((type == cnt || type == -1) && sb_has_quota_enabled(sb, cnt)
- && info_any_dirty(&sb_dqopt(sb)->info[cnt]))
- dirty = 1;
- if (!dirty)
+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
+ if (type != -1 && type != cnt)
+ continue;
+ if (!sb_has_quota_enabled(sb, cnt))
+ continue;
+ if (!info_dirty(&sb_dqopt(sb)->info[cnt]) &&
+ list_empty(&sb_dqopt(sb)->info[cnt].dqi_dirty_list))
+ continue;
+ break;
+ }
+ if (cnt == MAXQUOTAS)
continue;
sb->s_count++;
spin_unlock(&sb_lock);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index dcddfb2..6f1d97d 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -224,8 +224,6 @@ struct super_block;
extern void mark_info_dirty(struct super_block *sb, int type);
#define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags)
-#define info_any_dquot_dirty(info) (!list_empty(&(info)->dqi_dirty_list))
-#define info_any_dirty(info) (info_dirty(info) || info_any_dquot_dirty(info))
#define sb_dqopt(sb) (&(sb)->s_dquot)
#define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type))
--
1.5.2.4
On Mon, Jun 02, 2008 at 07:11:10PM +0200, Jan Kara wrote:
> Split some structure definitions from quota.h to quota_struct.h so that they
> can be separately included in fs.h. This makes it possible to declare some
> useful inline functions in quota.h because it can now include fs.h.
>
> Signed-off-by: Jan Kara <[email protected]>
> ---
> include/linux/fs.h | 2 +-
> include/linux/quota.h | 193 +---------------------------------------------
> include/linux/quotaops.h | 1 +
> include/linux/syscalls.h | 2 +-
> 4 files changed, 5 insertions(+), 193 deletions(-)
>...
Missing "git-add include/linux/quota_struct.h" ?
> --- a/include/linux/quota.h
> +++ b/include/linux/quota.h
> @@ -37,13 +37,11 @@
>
> #include <linux/errno.h>
> #include <linux/types.h>
> +#include <linux/quota_struct.h>
>...
This breaks our userspace headers.
Please always run "make headers_check" after touching #include's
under include/
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
On Wed 04-06-08 16:56:24, Adrian Bunk wrote:
> On Mon, Jun 02, 2008 at 07:11:10PM +0200, Jan Kara wrote:
> > Split some structure definitions from quota.h to quota_struct.h so that they
> > can be separately included in fs.h. This makes it possible to declare some
> > useful inline functions in quota.h because it can now include fs.h.
> >
> > Signed-off-by: Jan Kara <[email protected]>
> > ---
> > include/linux/fs.h | 2 +-
> > include/linux/quota.h | 193 +---------------------------------------------
> > include/linux/quotaops.h | 1 +
> > include/linux/syscalls.h | 2 +-
> > 4 files changed, 5 insertions(+), 193 deletions(-)
> >...
>
> Missing "git-add include/linux/quota_struct.h" ?
Probably yes, I already noticed this and mailed Andrew a patch with this
file included.
> > --- a/include/linux/quota.h
> > +++ b/include/linux/quota.h
> > @@ -37,13 +37,11 @@
> >
> > #include <linux/errno.h>
> > #include <linux/types.h>
> > +#include <linux/quota_struct.h>
> >...
>
> This breaks our userspace headers.
>
> Please always run "make headers_check" after touching #include's
> under include/
I didn't know this existed :) I'll use it in future. Thanks. The question
is how to fix this. Probably the best would be if didn't have to export new
header file, wouldn't it? We can split the headers into quota.h containing
structures and all other userspace stuff and quota_func.h carrying other
kernel-internal stuff like inline functions etc. Oh well...
Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR
On Wed, Jun 04, 2008 at 04:51:30PM +0200, Jan Kara wrote:
> On Wed 04-06-08 16:56:24, Adrian Bunk wrote:
> > On Mon, Jun 02, 2008 at 07:11:10PM +0200, Jan Kara wrote:
>...
> > > --- a/include/linux/quota.h
> > > +++ b/include/linux/quota.h
> > > @@ -37,13 +37,11 @@
> > >
> > > #include <linux/errno.h>
> > > #include <linux/types.h>
> > > +#include <linux/quota_struct.h>
> > >...
> >
> > This breaks our userspace headers.
> >
> > Please always run "make headers_check" after touching #include's
> > under include/
> I didn't know this existed :) I'll use it in future. Thanks. The question
> is how to fix this. Probably the best would be if didn't have to export new
> header file, wouldn't it? We can split the headers into quota.h containing
> structures and all other userspace stuff and quota_func.h carrying other
> kernel-internal stuff like inline functions etc. Oh well...
Considering that quota.h #include's quota_struct.h it wouldn't be a
problem if the new header also gets exported to userspace.
At least I do not have any strong opinion regarding how to best organize
the quota headers - David (Cc'ed) might have a more input on this.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
On Wed, 2008-06-04 at 18:26 +0300, Adrian Bunk wrote:
> On Wed, Jun 04, 2008 at 04:51:30PM +0200, Jan Kara wrote:
> > On Wed 04-06-08 16:56:24, Adrian Bunk wrote:
> > > On Mon, Jun 02, 2008 at 07:11:10PM +0200, Jan Kara wrote:
> >...
> > > > --- a/include/linux/quota.h
> > > > +++ b/include/linux/quota.h
> > > > @@ -37,13 +37,11 @@
> > > >
> > > > #include <linux/errno.h>
> > > > #include <linux/types.h>
> > > > +#include <linux/quota_struct.h>
> > > >...
> > >
> > > This breaks our userspace headers.
> > >
> > > Please always run "make headers_check" after touching #include's
> > > under include/
> > I didn't know this existed :) I'll use it in future. Thanks. The question
> > is how to fix this. Probably the best would be if didn't have to export new
> > header file, wouldn't it? We can split the headers into quota.h containing
> > structures and all other userspace stuff and quota_func.h carrying other
> > kernel-internal stuff like inline functions etc. Oh well...
>
> Considering that quota.h #include's quota_struct.h it wouldn't be a
> problem if the new header also gets exported to userspace.
>
> At least I do not have any strong opinion regarding how to best organize
> the quota headers - David (Cc'ed) might have a more input on this.
To a large extent it doesn't actually matter for userspace.
All userspace will be using <sys/quota.h> instead, because for a very
long period in our history, <linux/quota.h> would be completely broken
for userspace because it would give the v1 quota stuff. I believe that
was because we were depending on some CONFIG_xxx definition, which
doesn't exist in userspace (we _really_ should add that to headers_check
some time).
That said, the patch looks OK as long as you remember to add the new
file to unifdef-y, and as long as you have #ifdef __KERNEL__ in the
correct places in it (I can't see the updated patch with the new file
actually included, so I haven't checked).
--
dwmw2
On Wed 04-06-08 16:38:06, David Woodhouse wrote:
> On Wed, 2008-06-04 at 18:26 +0300, Adrian Bunk wrote:
> > On Wed, Jun 04, 2008 at 04:51:30PM +0200, Jan Kara wrote:
> > > On Wed 04-06-08 16:56:24, Adrian Bunk wrote:
> > > > On Mon, Jun 02, 2008 at 07:11:10PM +0200, Jan Kara wrote:
> > >...
> > > > > --- a/include/linux/quota.h
> > > > > +++ b/include/linux/quota.h
> > > > > @@ -37,13 +37,11 @@
> > > > >
> > > > > #include <linux/errno.h>
> > > > > #include <linux/types.h>
> > > > > +#include <linux/quota_struct.h>
> > > > >...
> > > >
> > > > This breaks our userspace headers.
> > > >
> > > > Please always run "make headers_check" after touching #include's
> > > > under include/
> > > I didn't know this existed :) I'll use it in future. Thanks. The question
> > > is how to fix this. Probably the best would be if didn't have to export new
> > > header file, wouldn't it? We can split the headers into quota.h containing
> > > structures and all other userspace stuff and quota_func.h carrying other
> > > kernel-internal stuff like inline functions etc. Oh well...
> >
> > Considering that quota.h #include's quota_struct.h it wouldn't be a
> > problem if the new header also gets exported to userspace.
> >
> > At least I do not have any strong opinion regarding how to best organize
> > the quota headers - David (Cc'ed) might have a more input on this.
>
> To a large extent it doesn't actually matter for userspace.
> All userspace will be using <sys/quota.h> instead, because for a very
> long period in our history, <linux/quota.h> would be completely broken
> for userspace because it would give the v1 quota stuff. I believe that
> was because we were depending on some CONFIG_xxx definition, which
> doesn't exist in userspace (we _really_ should add that to headers_check
> some time).
>
> That said, the patch looks OK as long as you remember to add the new
> file to unifdef-y, and as long as you have #ifdef __KERNEL__ in the
Sorry, what does "add the new file to unifdef-y" mean?
> correct places in it (I can't see the updated patch with the new file
> actually included, so I haven't checked).
The updated patch is attached if you're interested. I think __KERNEL__ is
there where it should be...
Thanks for reply.
Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR