From: Max Kellermann <max.kellermann@ionos.com>
To: linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH v2 27/35] quota.h: move declarations to quota_types.h
Date: Fri, 9 Feb 2024 17:40:19 +0100 [thread overview]
Message-ID: <20240209164027.2582906-28-max.kellermann@ionos.com> (raw)
In-Reply-To: <20240209164027.2582906-1-max.kellermann@ionos.com>
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
fs/gfs2/incore.h | 1 +
fs/xfs/xfs_qm.h | 1 +
fs/xfs/xfs_qm_syscalls.c | 2 ++
fs/xfs/xfs_quotaops.c | 1 +
fs/xfs/xfs_super.c | 1 +
fs/xfs/xfs_trans_dquot.c | 2 ++
include/linux/fs.h | 2 +-
include/linux/quota.h | 33 +-----------------
include/linux/quota_types.h | 68 +++++++++++++++++++++++++++++++++++++
9 files changed, 78 insertions(+), 33 deletions(-)
create mode 100644 include/linux/quota_types.h
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 95a334d64da2..94f945dc4bdb 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -18,6 +18,7 @@
#include <linux/rbtree.h>
#include <linux/ktime.h>
#include <linux/percpu.h>
+#include <linux/quota.h>
#include <linux/lockref.h>
#include <linux/rhashtable.h>
#include <linux/mutex.h>
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index d5c9fc4ba591..bb111cbc3567 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -9,6 +9,7 @@
#include "xfs_dquot_item.h"
#include "xfs_dquot.h"
+struct qc_dqblk;
struct xfs_inode;
extern struct kmem_cache *xfs_dqtrx_cache;
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 392cb39cc10c..1de4443bed40 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -19,6 +19,8 @@
#include "xfs_qm.h"
#include "xfs_icache.h"
+#include <linux/quota.h>
+
int
xfs_qm_scall_quotaoff(
xfs_mount_t *mp,
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index 9c162e69976b..eda56d032734 100644
--- a/fs/xfs/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -15,6 +15,7 @@
#include "xfs_icache.h"
#include "xfs_qm.h"
+#include <linux/quota.h>
static void
xfs_qm_fill_state(
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 5013d71143c2..615ba5b1bd1c 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -49,6 +49,7 @@
#include <linux/magic.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
+#include <linux/quota.h>
static const struct super_operations xfs_super_operations;
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index aa00cf67ad72..94214f0baa2b 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -18,6 +18,8 @@
#include "xfs_trace.h"
#include "xfs_error.h"
+#include <linux/quota.h>
+
STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
/*
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1cfe76f7544e..a7e65358ebc0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -260,7 +260,7 @@ struct iattr {
/*
* Includes for diskquotas.
*/
-#include <linux/quota.h>
+#include <linux/quota_types.h>
/*
* Maximum number of layers of fs stack. Needs to be limited to
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 956281c84850..2a3040e61072 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -32,9 +32,8 @@
#ifndef _LINUX_QUOTA_
#define _LINUX_QUOTA_
-#include <linux/list.h>
+#include <linux/quota_types.h>
#include <linux/mutex_types.h>
-#include <linux/rwsem_types.h>
#include <linux/spinlock_types.h>
#include <linux/percpu_counter.h>
@@ -45,7 +44,6 @@
#include <linux/atomic.h>
#include <linux/uidgid_types.h>
#include <linux/projid.h>
-#include <uapi/linux/quota.h>
#undef USRQUOTA
#undef GRPQUOTA
@@ -61,9 +59,6 @@ enum quota_type {
#define QTYPE_MASK_GRP (1 << GRPQUOTA)
#define QTYPE_MASK_PRJ (1 << PRJQUOTA)
-typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
-typedef long long qsize_t; /* Type in which we store sizes */
-
struct kqid { /* Type in which we store the quota identifier */
union {
kuid_t uid;
@@ -213,24 +208,6 @@ struct mem_dqblk {
time64_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 [dq_list_lock] */
- unsigned long dqi_flags; /* DFQ_ flags [dq_data_lock] */
- unsigned int dqi_bgrace; /* Space grace time [dq_data_lock] */
- unsigned int dqi_igrace; /* Inode grace time [dq_data_lock] */
- qsize_t dqi_max_spc_limit; /* Maximum space limit [static] */
- qsize_t dqi_max_ino_limit; /* Maximum inode limit [static] */
- void *dqi_priv;
-};
-
struct super_block;
/* Mask for flags passed to userspace */
@@ -517,14 +494,6 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
}
#endif /* CONFIG_QUOTA_NETLINK_INTERFACE */
-struct quota_info {
- unsigned int flags; /* Flags for diskquotas on this device */
- struct rw_semaphore dqio_sem; /* Lock quota file while I/O in progress */
- struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
- struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
- const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
-};
-
int register_quota_format(struct quota_format_type *fmt);
void unregister_quota_format(struct quota_format_type *fmt);
diff --git a/include/linux/quota_types.h b/include/linux/quota_types.h
new file mode 100644
index 000000000000..7f52ee2604bb
--- /dev/null
+++ b/include/linux/quota_types.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Elz at The University of Melbourne.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _LINUX_QUOTA_TYPES_
+#define _LINUX_QUOTA_TYPES_
+
+#include <linux/list.h>
+#include <linux/rwsem_types.h>
+#include <uapi/linux/quota.h>
+
+typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
+typedef long long qsize_t; /* Type in which we store sizes */
+
+/*
+ * 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 [dq_list_lock] */
+ unsigned long dqi_flags; /* DFQ_ flags [dq_data_lock] */
+ unsigned int dqi_bgrace; /* Space grace time [dq_data_lock] */
+ unsigned int dqi_igrace; /* Inode grace time [dq_data_lock] */
+ qsize_t dqi_max_spc_limit; /* Maximum space limit [static] */
+ qsize_t dqi_max_ino_limit; /* Maximum inode limit [static] */
+ void *dqi_priv;
+};
+
+struct quota_info {
+ unsigned int flags; /* Flags for diskquotas on this device */
+ struct rw_semaphore dqio_sem; /* Lock quota file while I/O in progress */
+ struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
+ struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
+ const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
+};
+
+#endif /* _LINUX_QUOTA_TYPES_ */
--
2.39.2
next prev parent reply other threads:[~2024-02-09 16:41 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 16:39 [PATCH v2 00/35] Fast kernel headers: reduce header dependencies Max Kellermann
2024-02-09 16:39 ` [PATCH v2 01/35] include: add missing includes Max Kellermann
2024-02-09 16:39 ` [PATCH v2 02/35] include: remove unnecessary #include directives Max Kellermann
2024-02-10 12:36 ` kernel test robot
2024-02-10 12:58 ` kernel test robot
2024-02-09 16:39 ` [PATCH v2 03/35] include: reduce header dependencies by using "*_types.h" Max Kellermann
2024-02-09 16:39 ` [PATCH v2 04/35] workqueue.h: move struct delayed_work to workqueue_types.h Max Kellermann
2024-02-09 16:39 ` [PATCH v2 05/35] kref.h: move declarations to kref_types.h Max Kellermann
2024-02-09 16:39 ` [PATCH v2 06/35] kobject.h: move declarations to kobject_types.h Max Kellermann
2024-02-09 16:39 ` [PATCH v2 07/35] sysfs.h: move declarations to sysfs_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 08/35] maple_tree.h: move declarations to maple_tree_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 09/35] rwsem.h: move declarations to rwsem_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 10/35] uprobes.h: move declarations to uprobes_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 11/35] percpu_counter.h: move declarations to percpu_counter_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 12/35] bvec.h: move declarations to bvec_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 13/35] wait.h: move declarations to wait_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 14/35] swait.h: move declarations to swait_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 15/35] completion.h: move declarations to completion_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 16/35] device.h: move declarations to device_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 17/35] xarray.h: move declarations to xarray_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 18/35] blkdev.h: move blk_op_is_passthrough() to blk_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 19/35] bio.h: move bio_has_data() and bio_no_advance_iter() " Max Kellermann
2024-02-09 16:40 ` [PATCH v2 20/35] bio.h: move declarations to bio_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 21/35] percpu-refcount.h: move declarations to percpu-refcount_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 22/35] blkdev.h: move declarations to blkdev_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 23/35] sbitmap.h: move declarations to sbitmap_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 24/35] list_lru.h: move declarations to list_lru_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 25/35] list_bl.h: move declarations to list_bl_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 26/35] percpu-rwsem.h: move declarations to percpu-rwsem_types.h Max Kellermann
2024-02-09 16:40 ` Max Kellermann [this message]
2024-02-09 16:40 ` [PATCH v2 28/35] radix-tree.h: move declarations to radix-tree_types.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 29/35] linux/random.h: reduce dependencies on linux/kernel.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 30/35] linux/kernel.h: move might_sleep(), ... to sched/debug_atomic_sleep.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 31/35] linux/kernel.h: move READ and WRITE to direction.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 32/35] linux/kernel.h: move VERIFY_OCTAL_PERMISSIONS() to octal_permissions.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 33/35] linux/kernel.h: move upper/lower_*_bits macros to wordpart.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 34/35] linux/kernel.h: move PTR_IF() to ptr_util.h Max Kellermann
2024-02-09 16:40 ` [PATCH v2 35/35] include: remove lots of unnecessary <linux/kernel.h> includes Max Kellermann
2024-02-10 12:26 ` kernel test robot
2024-03-25 13:05 ` [PATCH v2 00/35] Fast kernel headers: reduce header dependencies Andy Shevchenko
2024-03-29 13:31 ` Max Kellermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240209164027.2582906-28-max.kellermann@ionos.com \
--to=max.kellermann@ionos.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox