Re: [patch 14/19] Filesystem: Ext4 filesystem defrag

Previous thread: [hpwdt] BUG: unable to handle kernel paging request by S.Çağlar on Thursday, June 5, 2008 - 8:37 am. (4 messages)

Next thread: different conditions in arch_get_unmapped_area_topdown by Vitaly Mayatskikh on Thursday, June 5, 2008 - 8:43 am. (2 messages)
To: Andrew Morton <akpm@...>
Cc: LKML <linux-kernel@...>, Adrian Bunk <bunk@...>
Date: Thursday, June 5, 2008 - 8:42 am

Hello Andrew,

after Adrian's comments and a bit of thinking, I've decided to split
quota headers differently which also solves the issue with new header file
which should be exported. I found out it is enough to move some functions
into quotaops.h where they logically also fit nicely. So please replace
my patches:
+ ext4-add-explicit-include-of-linux-quotah-into-ext4_jbd2h.patch
+ ext2-add-explicit-include-of-linux-quotah-into-superc.patch
+ quota-split-out-quota_structh-out-of-quotah.patch
+ quota-convert-macros-to-inline-functions.patch

with the two patches which will follow. Thanks and sorry for additional
work.

Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
--

To: Pekka Enberg <penberg@...>
Cc: <akpm@...>, Christoph Lameter <clameter@...>, Christoph Lameter <cl@...>, <linux-kernel@...>, <linux-fsdevel@...>, Mel Gorman <mel@...>, <andi@...>, Rik van Riel <riel@...>, <mpm@...>, Dave Chinner <david@...>
Date: Friday, May 9, 2008 - 10:21 pm

Support defragmentation for extX filesystem inodes

Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>

---
fs/ext4/super.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux-2.6/fs/ext4/super.c
===================================================================
--- linux-2.6.orig/fs/ext4/super.c 2008-07-31 12:18:12.000000000 -0500
+++ linux-2.6/fs/ext4/super.c 2008-07-31 12:18:15.000000000 -0500
@@ -607,6 +607,12 @@
inode_init_once(&ei->vfs_inode);
}

+static void *ext4_get_inodes(struct kmem_cache *s, int nr, void **v)
+{
+ return fs_get_inodes(s, nr, v,
+ offsetof(struct ext4_inode_info, vfs_inode));
+}
+
static int init_inodecache(void)
{
ext4_inode_cachep = kmem_cache_create("ext4_inode_cache",
@@ -616,6 +622,8 @@
init_once);
if (ext4_inode_cachep == NULL)
return -ENOMEM;
+ kmem_cache_setup_defrag(ext4_inode_cachep,
+ ext4_get_inodes, kick_inodes);
return 0;
}

--
--

To: Christoph Lameter <cl@...>
Cc: Pekka Enberg <penberg@...>, <akpm@...>, Christoph Lameter <clameter@...>, <linux-kernel@...>, <linux-fsdevel@...>, Mel Gorman <mel@...>, <andi@...>, Rik van Riel <riel@...>, <mpm@...>, Dave Chinner <david@...>
Date: Saturday, August 2, 2008 - 9:54 pm

Acked-by: "Theodore Ts'o" <tytso@mit.edu>

- Ted
--

To: Theodore Tso <tytso@...>, Christoph Lameter <cl@...>, Pekka Enberg <penberg@...>, <akpm@...>, Christoph Lameter <clameter@...>, <linux-kernel@...>, <linux-fsdevel@...>, Mel Gorman <mel@...>, <andi@...>, Rik van Riel <riel@...>, <mpm@...>, Dave Chinner <david@...>
Date: Wednesday, August 13, 2008 - 3:26 am

Thanks!
--

To: Andrew Morton <akpm@...>
Cc: LKML <linux-kernel@...>, Adrian Bunk <bunk@...>
Date: Thursday, June 5, 2008 - 8:49 am

Signed-off-by: Jan Kara <jack@suse.cz>
---
include/linux/quota.h | 5 +++-
include/linux/quotaops.h | 65 +++++++++++++++++++++++++++++++++++----------
2 files changed, 54 insertions(+), 16 deletions(-)

diff --git a/include/linux/quota.h b/include/linux/quota.h
index f9983ea..4e004fe 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -223,7 +223,10 @@ struct super_block;
#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */

extern 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);
+}

struct dqstats {
int lookups;
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 7fc1743..5644280 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -52,25 +52,45 @@ 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);

-#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;
+}

/*
* Functions for checking status of quota
*/

-#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
- (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
+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;
+}

-#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
- sb_has_quota_...

To: Andrew Morton <akpm@...>
Cc: LKML <linux-kernel@...>, Adrian Bunk <bunk@...>
Date: Thursday, June 5, 2008 - 8:48 am

Move declarations of some macros, which should be in fact functions
to quotaops.h. This way they can be later converted to inline functions
because we can now use declarations from quota.h. Also add necessary
includes of quotaops.h to a few files.

Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext2/super.c | 1 +
fs/quota_v1.c | 1 +
fs/quota_v2.c | 1 +
include/linux/quota.h | 22 +++-------------------
include/linux/quotaops.h | 25 +++++++++++++++++++++++++
5 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index ef50cbc..31308a3 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/quotaops.h>
#include <asm/uaccess.h>
#include "ext2.h"
#include "xattr.h"
diff --git a/fs/quota_v1.c b/fs/quota_v1.c
index a6cf926..5ae15b1 100644
--- a/fs/quota_v1.c
+++ b/fs/quota_v1.c
@@ -1,6 +1,7 @@
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/quota.h>
+#include <linux/quotaops.h>
#include <linux/dqblk_v1.h>
#include <linux/quotaio_v1.h>
#include <linux/kernel.h>
diff --git a/fs/quota_v2.c b/fs/quota_v2.c
index 234ada9..b53827d 100644
--- a/fs/quota_v2.c
+++ b/fs/quota_v2.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/quotaops.h>

#include <asm/byteorder.h>

diff --git a/include/linux/quota.h b/include/linux/quota.h
index 6f1d97d..f9983ea 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -41,9 +41,6 @@
#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 b...

Previous thread: [hpwdt] BUG: unable to handle kernel paging request by S.Çağlar on Thursday, June 5, 2008 - 8:37 am. (4 messages)

Next thread: different conditions in arch_get_unmapped_area_topdown by Vitaly Mayatskikh on Thursday, June 5, 2008 - 8:43 am. (2 messages)