Whamcloud - gitweb
- minor optimization to avoid extra expenses related to OST A/M/D in the
authoralex <alex>
Sat, 24 Sep 2005 01:23:23 +0000 (01:23 +0000)
committeralex <alex>
Sat, 24 Sep 2005 01:23:23 +0000 (01:23 +0000)
  path of LOV EA revalidation

lustre/mds/mds_internal.h
lustre/mds/mds_lov.c
lustre/mds/mds_open.c

index 25fad02..543f539 100644 (file)
@@ -179,7 +179,7 @@ int mds_dt_update_config(struct obd_device *obd, int transno);
 int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode,
                        struct lov_mds_md *lmm, int lmm_size);
 int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry,
-                          struct lustre_msg *msg, int offset);
+                          struct lustre_msg *msg, int offset, int *changed);
 void mds_dt_update_objids(struct obd_device *obd, obd_id *ids);
 void mds_dt_save_objids(struct obd_device *obd, obd_id *ids);
 
index c69e8b7..6586f6d 100644 (file)
@@ -932,7 +932,7 @@ conv_end:
 
 /* Must be called with i_sem held */
 int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry,
-                          struct lustre_msg *msg, int offset)
+                          struct lustre_msg *msg, int offset, int *changed)
 {
         struct mds_obd *mds = &obd->u.mds;
         struct obd_export *dt_exp = mds->mds_dt_exp;
@@ -948,6 +948,7 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry,
         void *handle;
         ENTRY;
 
+        *changed = 0;
         LASSERT(down_trylock(&inode->i_sem) != 0);
 
         ll_id2str(idname, inode->i_ino, inode->i_generation);
@@ -998,6 +999,7 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry,
                 GOTO(out_oa, rc);
         }
 
+        *changed = 1;
         rc = obd_packmd(dt_exp, &lmm, lsm);
         if (rc < 0)
                 GOTO(out_oa, rc);
index beda3a3..c411f71 100644 (file)
@@ -766,16 +766,21 @@ static int mds_finish_open(struct ptlrpc_request *req, struct dentry *dchild,
                 
                 if (S_ISREG(dchild->d_inode->i_mode) &&
                     (body->valid & OBD_MD_FLEASIZE)) {
-                        rc = mds_revalidate_lov_ea(obd,dchild,req->rq_repmsg,2);
+                        int changed;
+                        rc = mds_revalidate_lov_ea(obd, dchild,
+                                                   req->rq_repmsg, 2,
+                                                   &changed);
                         if (!rc) {
                                 rc = mds_pack_md(obd, req->rq_repmsg, 2, body,
                                                  dchild->d_inode, 0, 0);
                                 /* after ost add/delete, lov ea can change
                                  * along with size/blocks, which we have
                                  * to update as well */
-                                body->size = dchild->d_inode->i_size;
-                                body->blocks = dchild->d_inode->i_blocks;
-                                *cancel_update_lock = 1;
+                                if (changed) {
+                                        body->size = dchild->d_inode->i_size;
+                                        body->blocks = dchild->d_inode->i_blocks;
+                                        *cancel_update_lock = 1;
+                                }
                         }
                         if (rc) {
                                 up(&dchild->d_inode->i_sem);