Whamcloud - gitweb
b=1590, (partial 948):
authorshaver <shaver>
Sat, 26 Jul 2003 17:58:57 +0000 (17:58 +0000)
committershaver <shaver>
Sat, 26 Jul 2003 17:58:57 +0000 (17:58 +0000)
   Stop flushing on close, and instead flush all outstanding client data
   atomically with the destruction of the final stripe.

   And when flushing for destroy, or other cases of truncate-to-zero, send a
   hint with the AST to indicate that dirty data should be discarded, instead of
   being written back.

   r=zab/phil

lustre/llite/llite_lib.c

index 5e798d6..2753b31 100644 (file)
@@ -606,7 +606,10 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
                 struct ldlm_extent extent = { .start = attr->ia_size,
                                               .end = OBD_OBJECT_EOF };
                 struct lustre_handle lockh = { 0 };
-                int err;
+                int err, ast_flags = 0;
+                /* XXX when we fix the AST intents to pass the discard-range
+                 * XXX extent, make ast_flags always LDLM_AST_DISCARD_DATA
+                 * XXX here. */
 
                 /* Writeback uses inode->i_size to determine how far out
                  * its cached pages go.  ll_truncate gets a PW lock, canceling
@@ -619,8 +622,10 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
                  * nodes through dirtying and writeback of final cached
                  * pages.  This last one is especially bad for racing
                  * o_append users on other nodes. */
+                if (extent.start == 0)
+                        ast_flags = LDLM_AST_DISCARD_DATA;
                 rc = ll_extent_lock_no_validate(NULL, inode, lsm, LCK_PW,
-                                                 &extent, &lockh);
+                                                &extent, &lockh, ast_flags);
                 if (rc != ELDLM_OK) {
                         if (rc > 0)
                                 RETURN(-ENOLCK);