[Ocfs2-tools-commits] mfasheh commits r893 - in trunk:
debugfs.ocfs2 debugfs.ocfs2/include libocfs2 libocfs2/include
mkfs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue May 17 16:55:44 CDT 2005
Author: mfasheh
Date: 2005-05-17 16:55:42 -0500 (Tue, 17 May 2005)
New Revision: 893
Modified:
trunk/debugfs.ocfs2/commands.c
trunk/debugfs.ocfs2/dump.c
trunk/debugfs.ocfs2/include/dump.h
trunk/libocfs2/alloc.c
trunk/libocfs2/include/ocfs2_fs.h
trunk/mkfs.ocfs2/mkfs.c
trunk/mkfs.ocfs2/mkfs.h
Log:
* support a per node truncate log, this speeds up multi-node truncate
performance, making it roughly equivalent to single node in time.
Modified: trunk/debugfs.ocfs2/commands.c
===================================================================
--- trunk/debugfs.ocfs2/commands.c 2005-05-16 23:39:25 UTC (rev 892)
+++ trunk/debugfs.ocfs2/commands.c 2005-05-17 21:55:42 UTC (rev 893)
@@ -699,6 +699,8 @@
ret = traverse_chains(gbls.fs, &(inode->id2.i_chain), out);
else if (S_ISLNK(inode->i_mode) && !inode->i_clusters)
dump_fast_symlink(out, inode->id2.i_symlink);
+ else if (inode->i_flags & OCFS2_DEALLOC_FL)
+ dump_truncate_log(out, &(inode->id2.i_dealloc));
else
ret = traverse_extents(gbls.fs, &(inode->id2.i_list), out);
Modified: trunk/debugfs.ocfs2/dump.c
===================================================================
--- trunk/debugfs.ocfs2/dump.c 2005-05-16 23:39:25 UTC (rev 892)
+++ trunk/debugfs.ocfs2/dump.c 2005-05-17 21:55:42 UTC (rev 893)
@@ -84,6 +84,28 @@
}
/*
+ * dump_truncate_log()
+ *
+ */
+void dump_truncate_log (FILE *out, ocfs2_truncate_log *tl)
+{
+ int i;
+
+ fprintf(out, "\tTotal Records: %u Used: %u\n",
+ le16_to_cpu(tl->tl_count), le16_to_cpu(tl->tl_used));
+
+ fprintf(out, "\t## %-10s %-10s\n", "Start Cluster",
+ "Num Clusters");
+
+ for(i = 0; i < le16_to_cpu(tl->tl_used); i++)
+ fprintf(out, "\t%-2d %-10u %-10u\n",
+ i, le32_to_cpu(tl->tl_recs[i].t_start),
+ le32_to_cpu(tl->tl_recs[i].t_clusters));
+
+ return ;
+}
+
+/*
* dump_fast_symlink()
*
*/
@@ -149,6 +171,8 @@
g_string_append (flags, "Heartbeat ");
if (in->i_flags & OCFS2_CHAIN_FL)
g_string_append (flags, "Chain ");
+ if (in->i_flags & OCFS2_DEALLOC_FL)
+ g_string_append (flags, "Dealloc ");
fprintf(out, "\tInode: %"PRIu64" Mode: 0%0o Generation: %u\n",
in->i_blkno, mode, in->i_generation);
Modified: trunk/debugfs.ocfs2/include/dump.h
===================================================================
--- trunk/debugfs.ocfs2/include/dump.h 2005-05-16 23:39:25 UTC (rev 892)
+++ trunk/debugfs.ocfs2/include/dump.h 2005-05-17 21:55:42 UTC (rev 893)
@@ -35,6 +35,7 @@
void dump_super_block (FILE *out, ocfs2_super_block *sb);
void dump_local_alloc (FILE *out, ocfs2_local_alloc *loc);
+void dump_truncate_log (FILE *out, ocfs2_truncate_log *tl);
void dump_inode (FILE *out, ocfs2_dinode *in);
void dump_extent_list (FILE *out, ocfs2_extent_list *ext);
void dump_chain_list (FILE *out, ocfs2_chain_list *cl);
Modified: trunk/libocfs2/alloc.c
===================================================================
--- trunk/libocfs2/alloc.c 2005-05-16 23:39:25 UTC (rev 892)
+++ trunk/libocfs2/alloc.c 2005-05-17 21:55:42 UTC (rev 893)
@@ -127,6 +127,7 @@
{
ocfs2_extent_list *fel;
int cs_bits = OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits;
+ unsigned int tl_recs;
di->i_generation = fs->fs_super->i_generation;
di->i_fs_generation = fs->fs_super->i_fs_generation;
@@ -161,6 +162,12 @@
return ;
}
+ if (flags & OCFS2_DEALLOC_FL) {
+ tl_recs = ocfs2_truncate_recs_per_inode(fs->fs_blocksize);
+ di->id2.i_dealloc.tl_count = cpu_to_le16(tl_recs);
+ return ;
+ }
+
if (flags & OCFS2_SUPER_BLOCK_FL)
return ;
Modified: trunk/libocfs2/include/ocfs2_fs.h
===================================================================
--- trunk/libocfs2/include/ocfs2_fs.h 2005-05-16 23:39:25 UTC (rev 892)
+++ trunk/libocfs2/include/ocfs2_fs.h 2005-05-17 21:55:42 UTC (rev 893)
@@ -116,6 +116,7 @@
#define OCFS2_JOURNAL_FL (0x00000100) /* Node journal */
#define OCFS2_HEARTBEAT_FL (0x00000200) /* Heartbeat area */
#define OCFS2_CHAIN_FL (0x00000400) /* Chain allocator */
+#define OCFS2_DEALLOC_FL (0x00000800) /* Truncate log */
/*
* Journal Flags (ocfs2_dinode.id1.journal1.i_flags)
@@ -163,6 +164,7 @@
INODE_ALLOC_SYSTEM_INODE,
JOURNAL_SYSTEM_INODE,
LOCAL_ALLOC_SYSTEM_INODE,
+ TRUNCATE_LOG_SYSTEM_INODE,
NUM_SYSTEM_INODES
};
@@ -182,7 +184,8 @@
[EXTENT_ALLOC_SYSTEM_INODE] = { "extent_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
[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 }
+ [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 }
};
/* Parameter passed from mount.ocfs2 to module */
@@ -253,6 +256,11 @@
__u64 c_blkno; /* Physical disk offset (blocks) of 1st group */
} ocfs2_chain_rec;
+typedef struct _ocfs2_truncate_rec {
+ __u32 t_start; /* 1st cluster in this log */
+ __u32 t_clusters; /* Number of total clusters covered */
+} ocfs2_truncate_rec;
+
/*
* On disk extent list for OCFS2 (node in the tree). Note that this
* is contained inside ocfs2_dinode or ocfs2_extent_block, so the
@@ -287,6 +295,18 @@
} ocfs2_chain_list;
/*
+ * On disk deallocation log for OCFS2. Note that this is
+ * contained inside ocfs2_dinode, so the offsets are relative to
+ * ocfs2_dinode.id2.i_dealloc.
+ */
+typedef struct _ocfs2_truncate_log {
+/*00*/ __u16 tl_count; /* Total records in this log */
+ __u16 tl_used; /* Number of records in use */
+ __u32 tl_reserved1;
+/*08*/ ocfs2_truncate_rec tl_recs[0]; /* Truncate records */
+} ocfs2_truncate_log;
+
+/*
* On disk extent block (indirect block) for OCFS2
*/
typedef struct _ocfs2_extent_block
@@ -403,11 +423,12 @@
} journal1;
} id1; /* Inode type dependant 1 */
/*C0*/ union {
- ocfs2_super_block i_super;
- ocfs2_local_alloc i_lab;
- ocfs2_chain_list i_chain;
- ocfs2_extent_list i_list;
- __u8 i_symlink[0];
+ ocfs2_super_block i_super;
+ ocfs2_local_alloc i_lab;
+ ocfs2_chain_list i_chain;
+ ocfs2_extent_list i_list;
+ ocfs2_truncate_log i_dealloc;
+ __u8 i_symlink[0];
} id2;
/* Actual on-disk size is one block */
} ocfs2_dinode;
@@ -503,6 +524,16 @@
return size;
}
+
+static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb)
+{
+ int size;
+
+ size = sb->s_blocksize -
+ offsetof(struct _ocfs2_dinode, id2.i_dealloc.tl_recs);
+
+ return size / sizeof(struct _ocfs2_truncate_rec);
+}
#else
static inline int ocfs2_fast_symlink_chars(int blocksize)
{
@@ -558,6 +589,16 @@
return size;
}
+
+static inline int ocfs2_truncate_recs_per_inode(int blocksize)
+{
+ int size;
+
+ size = blocksize -
+ offsetof(struct _ocfs2_dinode, id2.i_dealloc.tl_recs);
+
+ return size / sizeof(struct _ocfs2_truncate_rec);
+}
#endif /* __KERNEL__ */
Modified: trunk/mkfs.ocfs2/mkfs.c
===================================================================
--- trunk/mkfs.ocfs2/mkfs.c 2005-05-16 23:39:25 UTC (rev 892)
+++ trunk/mkfs.ocfs2/mkfs.c 2005-05-17 21:55:42 UTC (rev 893)
@@ -96,7 +96,8 @@
{ "extent_alloc:%04d", SFI_CHAIN, 0, S_IFREG | 0644 },
{ "inode_alloc:%04d", SFI_CHAIN, 0, S_IFREG | 0644 },
{ "journal:%04d", SFI_JOURNAL, 0, S_IFREG | 0644 },
- { "local_alloc:%04d", SFI_LOCAL_ALLOC, 0, S_IFREG | 0644 }
+ { "local_alloc:%04d", SFI_LOCAL_ALLOC, 0, S_IFREG | 0644 },
+ { "truncate_log:%04d", SFI_TRUNCATE_LOG, 0, S_IFREG | 0644 }
};
@@ -1561,6 +1562,12 @@
goto write_out;
}
+ if (rec->flags & OCFS2_DEALLOC_FL) {
+ di->id2.i_dealloc.tl_count =
+ cpu_to_le16(ocfs2_truncate_recs_per_inode(s->blocksize));
+ goto write_out;
+ }
+
if (rec->flags & OCFS2_BITMAP_FL) {
di->id1.bitmap1.i_used = cpu_to_le32(rec->bi.used_bits);
di->id1.bitmap1.i_total = cpu_to_le32(rec->bi.total_bits);
@@ -1871,6 +1878,9 @@
case SFI_CHAIN:
rec->flags |= (OCFS2_BITMAP_FL|OCFS2_CHAIN_FL);
break;
+ case SFI_TRUNCATE_LOG:
+ rec->flags |= OCFS2_DEALLOC_FL;
+ break;
case SFI_OTHER:
break;
}
Modified: trunk/mkfs.ocfs2/mkfs.h
===================================================================
--- trunk/mkfs.ocfs2/mkfs.h 2005-05-16 23:39:25 UTC (rev 892)
+++ trunk/mkfs.ocfs2/mkfs.h 2005-05-17 21:55:42 UTC (rev 893)
@@ -99,6 +99,7 @@
SFI_LOCAL_ALLOC,
SFI_HEARTBEAT,
SFI_CHAIN,
+ SFI_TRUNCATE_LOG,
SFI_OTHER
};
More information about the Ocfs2-tools-commits
mailing list