From: John L. Villalovos <john.l.villalovos@intel.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] Commenting patch
Date: Wed Apr 21 18:46:33 2004 [thread overview]
Message-ID: <40870854.1090005@intel.com> (raw)
So I am working on trying to get mkfs doing all the initialization. So in the process I am commenting the kernel module code so that I will know what is happenning.
So here are some comments I have added.
John
Index: super.c
===================================================================
--- super.c (revision 860)
+++ super.c (working copy)
@@ -961,6 +961,8 @@
osb->publ_map |= (1 << osb->node_num);
osb->vol_state = VOLUME_INIT;
+ // Check if first time this partition has been mounted. If so create
+ // the root Oracle INode.
status = ocfs_create_root_oin (osb, NULL);
if (status >= 0)
osb->vol_state = VOLUME_ENABLED;
Index: oin.c
===================================================================
--- oin.c (revision 860)
+++ oin.c (working copy)
@@ -446,6 +446,11 @@
/* ocfs_create_root_oin()
*
+ * This function will create the root Oracle INode (OIN) on the file system if
+ * this is the first time that this partition has ever been mounted.
+ *
+ * If this is NOT the first time this partition has been mounted (meaning it
+ * has been mounted before) then this function does nothing.
*/
int ocfs_create_root_oin (ocfs_super * osb, struct inode *root)
{
@@ -459,7 +464,15 @@
LOG_ENTRY ();
+ // Is this the first time this partition has been mounted?
if (osb->vol_layout.root_start_off == 0) {
+ // This is our first time being mounted. We need to take care
+ // of setting up the root Oracle inode. In order to do this we
+ // are going to call ocfs_create_root_dir_node. So we need to
+ // get the disk offset to the root directory (root_dirnode).
+ // In order to get that we need to read in the volume header
+ // from the first sector of the disk.
+
status = ocfs_wait_for_disk_lock_release (osb, OCFS_VOLUME_LOCK_OFFSET,
10000, OCFS_DLM_NO_LOCK);
if (status < 0) {
@@ -471,12 +484,14 @@
OCFS_DLM_EXCLUSIVE_LOCK, FLAG_FILE_CREATE,
&lockres, &bh, NULL);
if (status >= 0) {
+ // Read the volume header from the first sector of the
+ // partition and put it into our buffer head
status = ocfs_read_bh(osb, 0, &hdr_bh, 0, NULL);
if (status < 0)
LOG_ERROR_STATUS (status);
tmpstat = ocfs_release_lock (osb, OCFS_VOLUME_LOCK_OFFSET, OCFS_DLM_EXCLUSIVE_LOCK, 0, lockres, bh, NULL);
-
+
if (bh)
brelse(bh);
@@ -492,7 +507,13 @@
LOG_ERROR_STATUS (status);
goto finally;
}
-
+
+ // Get the volume header data from our buffer head. We need to
+ // know the following in order to call
+ // ocfs_create_root_dir_node():
+ // * root_off: disk offset to the ocfs root dirnode
+ // (root_directory)
+ // * internal_off: disk offset tot he data segment
volDiskHdr = (ocfs_vol_disk_hdr *) OCFS_BH_GET_DATA_READ(hdr_bh); /* read */
root_off = volDiskHdr->root_off;
int_off = volDiskHdr->internal_off;
@@ -502,10 +523,13 @@
ocfs_wait_for_disk_lock_release (osb,
OCFS_VOLUME_LOCK_OFFSET,
30000, OCFS_DLM_NO_LOCK);
+ // Setup the root_start_off with the correct value so
+ // that it will not run this function the next time the
+ // filesystem is mounted.
osb->vol_layout.root_start_off = root_off;
osb->vol_layout.root_int_off = int_off;
}
-
+ // Do all the work in creating our root directory
status = ocfs_create_root_dir_node (osb);
if (status < 0) {
LOG_ERROR_STATUS (status);
-------------- next part --------------
Index: super.c
===================================================================
--- super.c (revision 860)
+++ super.c (working copy)
@@ -961,6 +961,8 @@
osb->publ_map |= (1 << osb->node_num);
osb->vol_state = VOLUME_INIT;
+ // Check if first time this partition has been mounted. If so create
+ // the root Oracle INode.
status = ocfs_create_root_oin (osb, NULL);
if (status >= 0)
osb->vol_state = VOLUME_ENABLED;
Index: oin.c
===================================================================
--- oin.c (revision 860)
+++ oin.c (working copy)
@@ -446,6 +446,11 @@
/* ocfs_create_root_oin()
*
+ * This function will create the root Oracle INode (OIN) on the file system if
+ * this is the first time that this partition has ever been mounted.
+ *
+ * If this is NOT the first time this partition has been mounted (meaning it
+ * has been mounted before) then this function does nothing.
*/
int ocfs_create_root_oin (ocfs_super * osb, struct inode *root)
{
@@ -459,7 +464,15 @@
LOG_ENTRY ();
+ // Is this the first time this partition has been mounted?
if (osb->vol_layout.root_start_off == 0) {
+ // This is our first time being mounted. We need to take care
+ // of setting up the root Oracle inode. In order to do this we
+ // are going to call ocfs_create_root_dir_node. So we need to
+ // get the disk offset to the root directory (root_dirnode).
+ // In order to get that we need to read in the volume header
+ // from the first sector of the disk.
+
status = ocfs_wait_for_disk_lock_release (osb, OCFS_VOLUME_LOCK_OFFSET,
10000, OCFS_DLM_NO_LOCK);
if (status < 0) {
@@ -471,12 +484,14 @@
OCFS_DLM_EXCLUSIVE_LOCK, FLAG_FILE_CREATE,
&lockres, &bh, NULL);
if (status >= 0) {
+ // Read the volume header from the first sector of the
+ // partition and put it into our buffer head
status = ocfs_read_bh(osb, 0, &hdr_bh, 0, NULL);
if (status < 0)
LOG_ERROR_STATUS (status);
tmpstat = ocfs_release_lock (osb, OCFS_VOLUME_LOCK_OFFSET, OCFS_DLM_EXCLUSIVE_LOCK, 0, lockres, bh, NULL);
-
+
if (bh)
brelse(bh);
@@ -492,7 +507,13 @@
LOG_ERROR_STATUS (status);
goto finally;
}
-
+
+ // Get the volume header data from our buffer head. We need to
+ // know the following in order to call
+ // ocfs_create_root_dir_node():
+ // * root_off: disk offset to the ocfs root dirnode
+ // (root_directory)
+ // * internal_off: disk offset tot he data segment
volDiskHdr = (ocfs_vol_disk_hdr *) OCFS_BH_GET_DATA_READ(hdr_bh); /* read */
root_off = volDiskHdr->root_off;
int_off = volDiskHdr->internal_off;
@@ -502,10 +523,13 @@
ocfs_wait_for_disk_lock_release (osb,
OCFS_VOLUME_LOCK_OFFSET,
30000, OCFS_DLM_NO_LOCK);
+ // Setup the root_start_off with the correct value so
+ // that it will not run this function the next time the
+ // filesystem is mounted.
osb->vol_layout.root_start_off = root_off;
osb->vol_layout.root_int_off = int_off;
}
-
+ // Do all the work in creating our root directory
status = ocfs_create_root_dir_node (osb);
if (status < 0) {
LOG_ERROR_STATUS (status);
next reply other threads:[~2004-04-21 18:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-21 18:46 John L. Villalovos [this message]
2004-04-21 18:57 ` [Ocfs2-devel] Commenting patch Kurt Hackel
2004-04-21 19:03 ` Sunil Mushran
-- strict thread matches above, loose matches on Subject: below --
2004-04-21 19:07 Villalovos, John L
2004-04-21 19:49 ` Sunil Mushran
2004-04-21 22:34 Villalovos, John L
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=40870854.1090005@intel.com \
--to=john.l.villalovos@intel.com \
--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.