[Ocfs2-tools-commits] smushran commits r885 - in trunk: fsck.ocfs2
libocfs2/include mkfs.ocfs2 tunefs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu May 12 15:41:28 CDT 2005
Author: smushran
Signed-off-by: mfasheh
Signed-off-by: jlbec
Signed-off-by: masingh
Date: 2005-05-12 15:41:26 -0500 (Thu, 12 May 2005)
New Revision: 885
Modified:
trunk/fsck.ocfs2/pass4.c
trunk/libocfs2/include/ocfs2_fs.h
trunk/mkfs.ocfs2/mkfs.c
trunk/tunefs.ocfs2/tunefs.c
Log:
changes to support orphandir per node
changes in fsck, mkfs and tunefs
Signed-off-by: mfasheh
Signed-off-by: jlbec
Signed-off-by: masingh
Modified: trunk/fsck.ocfs2/pass4.c
===================================================================
--- trunk/fsck.ocfs2/pass4.c 2005-05-11 04:02:25 UTC (rev 884)
+++ trunk/fsck.ocfs2/pass4.c 2005-05-12 20:41:26 UTC (rev 885)
@@ -146,22 +146,26 @@
char name[PATH_MAX];
uint64_t ino;
int bytes;
+ int i;
+ int num_nodes = OCFS2_RAW_SB(ost->ost_fs->fs_super)->s_max_nodes;
- bytes = ocfs2_sprintf_system_inode_name(name, PATH_MAX,
- ORPHAN_DIR_SYSTEM_INODE, 0);
- if (bytes < 1) {
- ret = OCFS2_ET_INTERNAL_FAILURE;
- goto out;
- }
+ for (i = 0; i < num_nodes; ++i) {
+ bytes = ocfs2_sprintf_system_inode_name(name, PATH_MAX,
+ ORPHAN_DIR_SYSTEM_INODE, i);
+ if (bytes < 1) {
+ ret = OCFS2_ET_INTERNAL_FAILURE;
+ goto out;
+ }
- ret = ocfs2_lookup(ost->ost_fs, ost->ost_fs->fs_sysdir_blkno, name,
- bytes, NULL, &ino);
- if (ret)
- goto out;
+ ret = ocfs2_lookup(ost->ost_fs, ost->ost_fs->fs_sysdir_blkno,
+ name, bytes, NULL, &ino);
+ if (ret)
+ goto out;
- ret = ocfs2_dir_iterate(ost->ost_fs, ino,
- OCFS2_DIRENT_FLAG_EXCLUDE_DOTS, NULL,
- replay_orphan_iterate, ost);
+ ret = ocfs2_dir_iterate(ost->ost_fs, ino,
+ OCFS2_DIRENT_FLAG_EXCLUDE_DOTS, NULL,
+ replay_orphan_iterate, ost);
+ }
out:
return ret;
Modified: trunk/libocfs2/include/ocfs2_fs.h
===================================================================
--- trunk/libocfs2/include/ocfs2_fs.h 2005-05-11 04:02:25 UTC (rev 884)
+++ trunk/libocfs2/include/ocfs2_fs.h 2005-05-12 20:41:26 UTC (rev 885)
@@ -157,8 +157,8 @@
#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
ORPHAN_DIR_SYSTEM_INODE,
-#define OCFS2_LAST_GLOBAL_SYSTEM_INODE ORPHAN_DIR_SYSTEM_INODE
EXTENT_ALLOC_SYSTEM_INODE,
INODE_ALLOC_SYSTEM_INODE,
JOURNAL_SYSTEM_INODE,
@@ -176,9 +176,9 @@
[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 },
- [ORPHAN_DIR_SYSTEM_INODE] { "orphan_dir", 0, S_IFDIR | 0755 },
/* Node-specific system inodes (one copy per node) */
+ [ORPHAN_DIR_SYSTEM_INODE] { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
[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 },
Modified: trunk/mkfs.ocfs2/mkfs.c
===================================================================
--- trunk/mkfs.ocfs2/mkfs.c 2005-05-11 04:02:25 UTC (rev 884)
+++ trunk/mkfs.ocfs2/mkfs.c 2005-05-12 20:41:26 UTC (rev 885)
@@ -92,7 +92,7 @@
{ "slot_map", SFI_OTHER, 1, S_IFREG | 0644 },
{ "heartbeat", SFI_HEARTBEAT, 1, S_IFREG | 0644 },
{ "global_bitmap", SFI_CLUSTER, 1, S_IFREG | 0644 },
- { "orphan_dir", SFI_OTHER, 1, S_IFDIR | 0755 },
+ { "orphan_dir:%04d", SFI_OTHER, 0, S_IFDIR | 0755 },
{ "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 },
@@ -138,7 +138,7 @@
SystemFileDiskRecord system_dir_rec;
SystemFileDiskRecord lostfound_dir_rec;
int i, j, num;
- DirData *orphan_dir;
+ DirData *orphan_dir[OCFS2_MAX_NODES];
DirData *root_dir;
DirData *system_dir;
DirData *lostfound_dir;
@@ -212,7 +212,8 @@
root_dir = alloc_directory(s);
system_dir = alloc_directory(s);
- orphan_dir = alloc_directory(s);
+ for (i = 0; i < s->initial_nodes; ++i)
+ orphan_dir[i] = alloc_directory(s);
lostfound_dir = alloc_directory(s);
need = (s->volume_size_in_clusters + 7) >> 3;
@@ -320,11 +321,13 @@
alloc_bytes_from_bitmap(s, need, s->global_bm, &tmprec->extent_off, &tmprec->extent_len);
tmprec->file_size = need;
- tmprec = &record[ORPHAN_DIR_SYSTEM_INODE][0];
- orphan_dir->record = tmprec;
- alloc_from_bitmap(s, 1, s->global_bm, &tmprec->extent_off, &tmprec->extent_len);
- add_entry_to_directory(s, orphan_dir, ".", tmprec->fe_off, OCFS2_FT_DIR);
- add_entry_to_directory(s, orphan_dir, "..", system_dir_rec.fe_off, OCFS2_FT_DIR);
+ for (i = 0; i < s->initial_nodes; ++i) {
+ tmprec = &record[ORPHAN_DIR_SYSTEM_INODE][i];
+ orphan_dir[i]->record = tmprec;
+ alloc_from_bitmap(s, 1, s->global_bm, &tmprec->extent_off, &tmprec->extent_len);
+ add_entry_to_directory(s, orphan_dir[i], ".", tmprec->fe_off, OCFS2_FT_DIR);
+ add_entry_to_directory(s, orphan_dir[i], "..", system_dir_rec.fe_off, OCFS2_FT_DIR);
+ }
tmprec = &(record[SLOT_MAP_SYSTEM_INODE][0]);
alloc_from_bitmap(s, 1, s->global_bm, &tmprec->extent_off, &tmprec->extent_len);
@@ -373,7 +376,8 @@
write_directory_data(s, root_dir);
write_directory_data(s, system_dir);
- write_directory_data(s, orphan_dir);
+ for (i = 0; i < s->initial_nodes; ++i)
+ write_directory_data(s, orphan_dir[i]);
write_directory_data(s, lostfound_dir);
tmprec = &(record[HEARTBEAT_SYSTEM_INODE][0]);
Modified: trunk/tunefs.ocfs2/tunefs.c
===================================================================
--- trunk/tunefs.ocfs2/tunefs.c 2005-05-11 04:02:25 UTC (rev 884)
+++ trunk/tunefs.ocfs2/tunefs.c 2005-05-12 20:41:26 UTC (rev 885)
@@ -354,6 +354,7 @@
uint64_t blkno;
int i, j;
char *display_str = NULL;
+ int ftype;
for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1; i < NUM_SYSTEM_INODES; ++i) {
for (j = old_num; j < opts.num_nodes; ++j) {
@@ -375,9 +376,19 @@
if (ret)
goto bail;
+ ftype = (S_ISDIR(ocfs2_system_inodes[i].si_mode) ?
+ OCFS2_FT_DIR : OCFS2_FT_REG_FILE);
+
+ /* if dir, alloc space to it */
+ if (ftype == OCFS2_FT_DIR) {
+ ret = ocfs2_expand_dir(fs, blkno, fs->fs_sysdir_blkno);
+ if (ret)
+ goto bail;
+ }
+
/* Add the inode to the system dir */
ret = ocfs2_link(fs, fs->fs_sysdir_blkno, fname, blkno,
- OCFS2_FT_REG_FILE);
+ ftype);
if (!ret)
goto next_file;
if (ret == OCFS2_ET_DIR_NO_SPACE) {
@@ -385,8 +396,7 @@
fs->fs_sysdir_blkno);
if (!ret)
ret = ocfs2_link(fs, fs->fs_sysdir_blkno,
- fname, blkno,
- OCFS2_FT_REG_FILE);
+ fname, blkno, ftype);
} else
goto bail;
next_file:
More information about the Ocfs2-tools-commits
mailing list