[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lustre-cvs
Subject:    [Lustre-cvs] CVS: lustre/llite super.c,1.116,1.117 super25.c,1.5,1.6
From:       Andreas Dilger <adilger () users ! sourceforge ! net>
Date:       2002-10-31 7:39:21
[Download RAW message or body]

Update of /cvsroot/lustre/lustre/llite
In directory usw-pr-cvs1:/tmp/cvs-serv13186a/llite

Modified Files:
	super.c super25.c 
Log Message:
Hack to force an MDS flush and also get the last_xid/last_committed from
the MDS, so the client can flush its pending RPC requests before umount.

Also, make mdc_statfs() into a OBD method, just because we can.


Index: super.c
===================================================================
RCS file: /cvsroot/lustre/lustre/llite/super.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -w -b -B -p -r1.116 -r1.117
--- super.c	30 Oct 2002 21:52:44 -0000	1.116
+++ super.c	31 Oct 2002 07:39:18 -0000	1.117
@@ -104,8 +104,6 @@ static struct super_block * ll_read_supe
         int err;
         struct ll_fid rootfid;
         struct obd_statfs osfs;
-        __u64 last_committed;
-        __u64 last_xid;
         struct ptlrpc_request *request = NULL;
         struct ptlrpc_connection *mdc_conn;
         struct ll_read_inode2_cookie lic;
@@ -169,21 +167,16 @@ static struct super_block * ll_read_supe
                 GOTO(out_mdc, sb = NULL);
         }
 
-        /* XXX: need to store the last_* values somewhere */
-        err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid, &last_committed,
-                            &last_xid, &request);
-        ptlrpc_req_finished(request);
+        err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
         if (err) {
                 CERROR("cannot mds_connect: rc = %d\n", err);
                 GOTO(out_mdc, sb = NULL);
         }
-        CDEBUG(D_SUPER, "rootfid %Ld\n", (unsigned long long)rootfid.id);
+        CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
         sbi->ll_rootino = rootfid.id;
 
         memset(&osfs, 0, sizeof(osfs));
-        request = NULL;
-        err = mdc_statfs(&sbi->ll_mdc_conn, &osfs, &request);
-        ptlrpc_req_finished(request);
+        err = obd_statfs(&sbi->ll_mdc_conn, &osfs);
         sb->s_blocksize = osfs.os_bsize;
         sb->s_blocksize_bits = log2(osfs.os_bsize);
         sb->s_magic = LL_SUPER_MAGIC;
@@ -192,7 +185,6 @@ static struct super_block * ll_read_supe
         sb->s_op = &ll_super_operations;
 
         /* make root inode */
-        request = NULL;
         err = mdc_getattr(&sbi->ll_mdc_conn, sbi->ll_rootino, S_IFDIR,
                           OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
         if (err) {
@@ -224,6 +216,7 @@ static struct super_block * ll_read_supe
         }
 
         ptlrpc_req_finished(request);
+        request = NULL;
 
 out_dev:
         if (mdc)
@@ -250,8 +243,9 @@ out_free:
 static void ll_put_super(struct super_block *sb)
 {
         struct ll_sb_info *sbi = ll_s2sbi(sb);
-
+        struct ll_fid rootfid;
         ENTRY;
+
         list_del(&sbi->ll_conn_chain);
         ll_commitcbd_cleanup(sbi);
         obd_disconnect(&sbi->ll_osc_conn);
@@ -255,6 +249,15 @@ static void ll_put_super(struct super_bl
         list_del(&sbi->ll_conn_chain);
         ll_commitcbd_cleanup(sbi);
         obd_disconnect(&sbi->ll_osc_conn);
+
+        /* NULL request to force sync on the MDS, and get the last_committed
+         * value to flush remaining RPCs from the sending queue on client.
+         *
+         * XXX This should be an mdc_sync() call to sync the whole MDS fs,
+         *     which we can call for other reasons as well.
+         */
+        mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
+
         obd_disconnect(&sbi->ll_mdc_conn);
         OBD_FREE(sbi, sizeof(*sbi));
 
@@ -392,16 +395,14 @@ int ll_setattr(struct dentry *de, struct
 
 static int ll_statfs(struct super_block *sb, struct statfs *sfs)
 {
-        struct ptlrpc_request *request = NULL;
         struct ll_sb_info *sbi = ll_s2sbi(sb);
         struct obd_statfs osfs;
         int rc;
         ENTRY;
 
         memset(sfs, 0, sizeof(*sfs));
-        rc = mdc_statfs(&sbi->ll_mdc_conn, &osfs, &request);
+        rc = obd_statfs(&sbi->ll_mdc_conn, &osfs);
         statfs_unpack(sfs, &osfs);
-        ptlrpc_req_finished(request);
         if (rc)
                 CERROR("mdc_statfs fails: rc = %d\n", rc);
         else

Index: super25.c
===================================================================
RCS file: /cvsroot/lustre/lustre/llite/super25.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -b -B -p -r1.5 -r1.6
--- super25.c	30 Oct 2002 21:52:44 -0000	1.5
+++ super25.c	31 Oct 2002 07:39:18 -0000	1.6
@@ -106,8 +106,6 @@ static int ll_fill_super(struct super_bl
         int err;
         struct ll_fid rootfid;
         struct obd_statfs osfs;
-        __u64 last_committed;
-        __u64 last_xid;
         struct ptlrpc_request *request = NULL;
         struct ptlrpc_connection *mdc_conn;
         struct ll_read_inode2_cookie lic;
@@ -171,21 +169,16 @@ static int ll_fill_super(struct super_bl
                 GOTO(out_mdc, sb = NULL);
         }
 
-        /* XXX: need to store the last_* values somewhere */
-        err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid, &last_committed,
-                            &last_xid, &request);
-        ptlrpc_req_finished(request);
+        err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
         if (err) {
                 CERROR("cannot mds_connect: rc = %d\n", err);
                 GOTO(out_mdc, sb = NULL);
         }
-        CDEBUG(D_SUPER, "rootfid %Ld\n", (unsigned long long)rootfid.id);
+        CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
         sbi->ll_rootino = rootfid.id;
 
         memset(&osfs, 0, sizeof(osfs));
-        request = NULL;
-        err = mdc_statfs(&sbi->ll_mdc_conn, &osfs, &request);
-        ptlrpc_req_finished(request);
+        err = mdc_statfs(&sbi->ll_mdc_conn, &osfs);
         sb->s_blocksize = osfs.os_bsize;
         sb->s_blocksize_bits = log2(osfs.os_bsize);
         sb->s_magic = LL_SUPER_MAGIC;
@@ -194,7 +187,6 @@ static int ll_fill_super(struct super_bl
         sb->s_op = &ll_super_operations;
 
         /* make root inode */
-        request = NULL;
         err = mdc_getattr(&sbi->ll_mdc_conn, sbi->ll_rootino, S_IFDIR,
                           OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
         if (err) {
@@ -226,6 +218,7 @@ static int ll_fill_super(struct super_bl
         }
 
         ptlrpc_req_finished(request);
+        request = NULL;
 
 out_dev:
         if (mdc)
@@ -258,8 +251,9 @@ struct super_block * ll_get_sb(struct fi
 static void ll_put_super(struct super_block *sb)
 {
         struct ll_sb_info *sbi = ll_s2sbi(sb);
-
+        struct ll_fid rootfid;
         ENTRY;
+
         list_del(&sbi->ll_conn_chain);
         ll_commitcbd_cleanup(sbi);
         obd_disconnect(&sbi->ll_osc_conn);
@@ -263,6 +257,15 @@ static void ll_put_super(struct super_bl
         list_del(&sbi->ll_conn_chain);
         ll_commitcbd_cleanup(sbi);
         obd_disconnect(&sbi->ll_osc_conn);
+
+        /* NULL request to force sync on the MDS, and get the last_committed
+         * value to flush remaining RPCs from the pending queue on client.
+         *
+         * XXX This should be an mdc_sync() call to sync the whole MDS fs,
+         *     which we can call for other reasons as well.
+         */
+        mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
+
         obd_disconnect(&sbi->ll_mdc_conn);
         OBD_FREE(sbi, sizeof(*sbi));
 
@@ -391,16 +394,14 @@ int ll_setattr(struct dentry *de, struct
 
 static int ll_statfs(struct super_block *sb, struct statfs *sfs)
 {
-        struct ptlrpc_request *request = NULL;
         struct ll_sb_info *sbi = ll_s2sbi(sb);
         struct obd_statfs osfs;
         int rc;
         ENTRY;
 
         memset(sfs, 0, sizeof(*sfs));
-        rc = mdc_statfs(&sbi->ll_mdc_conn, &osfs, &request);
+        rc = obd_statfs(&sbi->ll_mdc_conn, &osfs);
         statfs_unpack(sfs, &osfs);
-        ptlrpc_req_finished(request);
         if (rc)
                 CERROR("mdc_statfs fails: rc = %d\n", rc);
         else



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
Lustre-cvs mailing list
Lustre-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lustre-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic