From: Jan Kara <jack@suse.cz>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 23/29] ocfs2: Assign feature bits and system inodes to quota feature and quota files
Date: Sat, 25 Oct 2008 00:08:16 +0200 [thread overview]
Message-ID: <12248861042935-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <122488610212-git-send-email-jack@suse.cz>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ocfs2/inode.c | 2 ++
fs/ocfs2/ocfs2_fs.h | 23 ++++++++++++++++++++---
fs/ocfs2/super.c | 17 +++++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 4903688..da3a360 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -292,6 +292,8 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
mlog(0, "local alloc inode: i_ino=%lu\n", inode->i_ino);
} else if (fe->i_flags & cpu_to_le32(OCFS2_BITMAP_FL)) {
OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP;
+ } else if (fe->i_flags & cpu_to_le32(OCFS2_QUOTA_FL)) {
+ inode->i_flags |= S_NOQUOTA;
} else if (fe->i_flags & cpu_to_le32(OCFS2_SUPER_BLOCK_FL)) {
mlog(0, "superblock inode: i_ino=%lu\n", inode->i_ino);
/* we can't actually hit this as read_inode can't
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index f24ce3d..dd17137 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -93,7 +93,9 @@
| OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \
| OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK \
| OCFS2_FEATURE_INCOMPAT_XATTR)
-#define OCFS2_FEATURE_RO_COMPAT_SUPP OCFS2_FEATURE_RO_COMPAT_UNWRITTEN
+#define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \
+ | OCFS2_FEATURE_RO_COMPAT_USRQUOTA \
+ | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
/*
* Heartbeat-only devices are missing journals and other files. The
@@ -157,6 +159,12 @@
*/
#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN 0x0001
+/*
+ * Maintain quota information for this filesystem
+ */
+#define OCFS2_FEATURE_RO_COMPAT_USRQUOTA 0x0002
+#define OCFS2_FEATURE_RO_COMPAT_GRPQUOTA 0x0004
+
/* The byte offset of the first backup block will be 1G.
* The following will be 4G, 16G, 64G, 256G and 1T.
*/
@@ -186,6 +194,7 @@
#define OCFS2_HEARTBEAT_FL (0x00000200) /* Heartbeat area */
#define OCFS2_CHAIN_FL (0x00000400) /* Chain allocator */
#define OCFS2_DEALLOC_FL (0x00000800) /* Truncate log */
+#define OCFS2_QUOTA_FL (0x00001000) /* Quota file */
/*
* Flags on ocfs2_dinode.i_dyn_features
@@ -323,13 +332,17 @@ enum {
#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
HEARTBEAT_SYSTEM_INODE,
GLOBAL_BITMAP_SYSTEM_INODE,
-#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GLOBAL_BITMAP_SYSTEM_INODE
+ USER_QUOTA_SYSTEM_INODE,
+ GROUP_QUOTA_SYSTEM_INODE,
+#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GROUP_QUOTA_SYSTEM_INODE
ORPHAN_DIR_SYSTEM_INODE,
EXTENT_ALLOC_SYSTEM_INODE,
INODE_ALLOC_SYSTEM_INODE,
JOURNAL_SYSTEM_INODE,
LOCAL_ALLOC_SYSTEM_INODE,
TRUNCATE_LOG_SYSTEM_INODE,
+ LOCAL_USER_QUOTA_SYSTEM_INODE,
+ LOCAL_GROUP_QUOTA_SYSTEM_INODE,
NUM_SYSTEM_INODES
};
@@ -343,6 +356,8 @@ static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
[SLOT_MAP_SYSTEM_INODE] = { "slot_map", 0, S_IFREG | 0644 },
[HEARTBEAT_SYSTEM_INODE] = { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },
[GLOBAL_BITMAP_SYSTEM_INODE] = { "global_bitmap", 0, S_IFREG | 0644 },
+ [USER_QUOTA_SYSTEM_INODE] = { "aquota.user", OCFS2_QUOTA_FL, S_IFREG | 0644 },
+ [GROUP_QUOTA_SYSTEM_INODE] = { "aquota.group", OCFS2_QUOTA_FL, S_IFREG | 0644 },
/* Slot-specific system inodes (one copy per slot) */
[ORPHAN_DIR_SYSTEM_INODE] = { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
@@ -350,7 +365,9 @@ static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
[INODE_ALLOC_SYSTEM_INODE] = { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
[JOURNAL_SYSTEM_INODE] = { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },
[LOCAL_ALLOC_SYSTEM_INODE] = { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },
- [TRUNCATE_LOG_SYSTEM_INODE] = { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 }
+ [TRUNCATE_LOG_SYSTEM_INODE] = { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 },
+ [LOCAL_USER_QUOTA_SYSTEM_INODE] = { "aquota%04d.user", OCFS2_QUOTA_FL, S_IFREG | 0644 },
+ [LOCAL_GROUP_QUOTA_SYSTEM_INODE] = { "aquota%04d.group", OCFS2_QUOTA_FL, S_IFREG | 0644 },
};
/* Parameter passed from mount.ocfs2 to module */
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 304b63a..4712bc7 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -221,6 +221,19 @@ static int ocfs2_sync_fs(struct super_block *sb, int wait)
return 0;
}
+static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino)
+{
+ if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA)
+ && (ino == USER_QUOTA_SYSTEM_INODE
+ || ino == LOCAL_USER_QUOTA_SYSTEM_INODE))
+ return 0;
+ if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
+ && (ino == GROUP_QUOTA_SYSTEM_INODE
+ || ino == LOCAL_GROUP_QUOTA_SYSTEM_INODE))
+ return 0;
+ return 1;
+}
+
static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
{
struct inode *new = NULL;
@@ -247,6 +260,8 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
for (i = OCFS2_FIRST_ONLINE_SYSTEM_INODE;
i <= OCFS2_LAST_GLOBAL_SYSTEM_INODE; i++) {
+ if (!ocfs2_need_system_inode(osb, i))
+ continue;
new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
if (!new) {
ocfs2_release_system_inodes(osb);
@@ -277,6 +292,8 @@ static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb)
for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1;
i < NUM_SYSTEM_INODES;
i++) {
+ if (!ocfs2_need_system_inode(osb, i))
+ continue;
new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
if (!new) {
ocfs2_release_system_inodes(osb);
--
1.5.2.4
next prev parent reply other threads:[~2008-10-24 22:08 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 22:07 [Ocfs2-devel] [PATCH 00/00] Implement quotas for OCFS2 (version 2) Jan Kara
2008-10-24 22:07 ` [Ocfs2-devel] [PATCH 01/29] quota: Add callbacks for allocating and destroying dquot structures Jan Kara
2008-10-24 22:07 ` [Ocfs2-devel] [PATCH 02/29] quota: Increase size of variables for limits and inode usage Jan Kara
2008-10-24 22:07 ` [Ocfs2-devel] [PATCH 03/29] quota: Remove bogus 'optimization' in check_idq() and check_bdq() Jan Kara
2008-10-24 22:07 ` [Ocfs2-devel] [PATCH 04/29] quota: Make _SUSPENDED just a flag Jan Kara
2008-10-24 22:07 ` [Ocfs2-devel] [PATCH 05/29] quota: Allow to separately enable quota accounting and enforcing limits Jan Kara
2008-10-24 22:07 ` [Ocfs2-devel] [PATCH 06/29] ext3: Use sb_any_quota_loaded() instead of sb_any_quota_enabled() Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 07/29] ext4: " Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 08/29] reiserfs: " Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 09/29] quota: Remove compatibility function sb_any_quota_enabled() Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 10/29] quota: Introduce DQUOT_QUOTA_SYS_FILE flag Jan Kara
2008-10-29 23:09 ` Mark Fasheh
2008-10-30 7:24 ` Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 11/29] quota: Move quotaio_v[12].h from include/linux/ to fs/ Jan Kara
2008-10-29 23:10 ` Mark Fasheh
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 12/29] quota: Split off quota tree handling into a separate file Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 13/29] quota: Convert union in mem_dqinfo to a pointer Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 14/29] quota: Allow negative usage of space and inodes Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 15/29] quota: Keep which entries were set by SETQUOTA quotactl Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 16/29] quota: Add helpers to allow ocfs2 specific quota initialization, freeing and recovery Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 17/29] quota: Implement function for scanning active dquots Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 18/29] mm: Export pdflush_operation() Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 19/29] ocfs2: Fix check of return value of ocfs2_start_trans() Jan Kara
2008-10-30 23:34 ` Mark Fasheh
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 20/29] ocfs2: Support nested transactions Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 21/29] ocfs2: Fix checking of return value of new_inode() Jan Kara
2008-10-30 23:51 ` Mark Fasheh
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 22/29] ocfs2: Let inode be really deleted when ocfs2_mknod_locked() fails Jan Kara
2008-10-30 23:52 ` Mark Fasheh
2008-10-31 5:05 ` Jan Kara
2008-10-24 22:08 ` Jan Kara [this message]
2008-10-28 22:16 ` [Ocfs2-devel] [PATCH 23/29] ocfs2: Assign feature bits and system inodes to quota feature and quota files Joel Becker
2008-10-29 2:32 ` Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 24/29] ocfs2: Mark system files as not subject to quota accounting Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 25/29] ocfs2: Implementation of local and global quota file handling Jan Kara
2008-10-28 19:07 ` Joel Becker
2008-10-28 19:36 ` Joel Becker
2008-10-29 2:29 ` Jan Kara
2008-10-29 10:51 ` Joel Becker
2008-10-30 7:33 ` Jan Kara
2008-10-30 20:31 ` Joel Becker
2008-10-31 5:00 ` Jan Kara
2008-11-05 22:49 ` Mark Fasheh
2008-11-20 14:53 ` Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 26/29] ocfs2: Add quota calls for allocation and freeing of inodes and space Jan Kara
2008-11-06 0:06 ` Mark Fasheh
2008-11-20 15:19 ` Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 27/29] ocfs2: Implement quota syncing thread Jan Kara
2008-11-06 0:27 ` Mark Fasheh
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 28/29] ocfs2: Implement quota recovery Jan Kara
2008-11-06 0:52 ` Mark Fasheh
2008-11-20 16:51 ` Jan Kara
2008-10-24 22:08 ` [Ocfs2-devel] [PATCH 29/29] ocfs2: Enable quota accounting on mount, disable on umount Jan Kara
2008-10-28 19:11 ` Joel Becker
2008-10-29 2:30 ` Jan Kara
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=12248861042935-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=ocfs2-devel@oss.oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.