Whamcloud - gitweb
Land b_smallfix onto HEAD (20040223_1817)
[fs/lustre-release.git] / lustre / llite / rw24.c
index fe11b27..23be231 100644 (file)
@@ -61,14 +61,16 @@ void ll_ap_completion_24(void *data, int cmd, int rc)
                 return;
         }
 
-        llap->llap_queued = 0;
         page = llap->llap_page;
-
         LASSERT(PageLocked(page));
 
         if (rc == 0)  {
-                if (cmd == OBD_BRW_READ)
-                        SetPageUptodate(page);
+                if (cmd == OBD_BRW_READ) {
+                        if (!llap->llap_defer_uptodate)
+                                SetPageUptodate(page);
+                } else {
+                        llap->llap_write_queued = 0;
+                }
         } else { 
                 SetPageError(page);
         }
@@ -105,20 +107,20 @@ static int ll_writepage_24(struct page *page)
                 GOTO(out, rc = PTR_ERR(llap));
 
         page_cache_get(page);
-        if (llap->llap_queued) {
+        if (llap->llap_write_queued) {
                 LL_CDEBUG_PAGE(page, "marking urgent\n");
-                rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL, 
-                                         llap->llap_cookie, ASYNC_READY | 
-                                         ASYNC_URGENT);
+                rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL,
+                                         llap->llap_cookie,
+                                         ASYNC_READY | ASYNC_URGENT);
         } else {
-                rc = obd_queue_async_io(exp, ll_i2info(inode)->lli_smd, NULL, 
-                                        llap->llap_cookie, OBD_BRW_WRITE, 0, 0, 
-                                        OBD_BRW_CREATE, ASYNC_READY | 
-                                        ASYNC_URGENT);
-                if (rc == 0) {
+                llap->llap_write_queued = 1;
+                rc = obd_queue_async_io(exp, ll_i2info(inode)->lli_smd, NULL,
+                                        llap->llap_cookie, OBD_BRW_WRITE, 0, 0,
+                                        0, ASYNC_READY | ASYNC_URGENT);
+                if (rc == 0)
                         LL_CDEBUG_PAGE(page, "mmap write queued\n");
-                        llap->llap_queued = 1;
-                }
+                else
+                        llap->llap_write_queued = 0;
         }
         if (rc)
                 page_cache_release(page);
@@ -128,9 +130,18 @@ out:
         RETURN(rc);
 }
 
-static int ll_direct_IO_24(int rw, struct inode *inode, struct kiobuf *iobuf,
-                           unsigned long blocknr, int blocksize)
+static int ll_direct_IO_24(int rw,
+#ifdef HAVE_DIO_FILE
+                           struct file *file,
+#else
+                           struct inode *inode,
+#endif
+                           struct kiobuf *iobuf, unsigned long blocknr,
+                           int blocksize)
 {
+#ifdef HAVE_DIO_FILE
+        struct inode *inode = file->f_dentry->d_inode;
+#endif
         struct ll_inode_info *lli = ll_i2info(inode);
         struct lov_stripe_md *lsm = lli->lli_smd;
         struct brw_page *pga;
@@ -158,7 +169,7 @@ static int ll_direct_IO_24(int rw, struct inode *inode, struct kiobuf *iobuf,
                 RETURN(-ENOMEM);
         }
 
-        flags = (rw == WRITE ? OBD_BRW_CREATE : 0) /* | OBD_BRW_DIRECTIO */;
+        flags = 0 /* | OBD_BRW_DIRECTIO */;
         offset = ((obd_off)blocknr << inode->i_blkbits);
         length = iobuf->length;
 
@@ -210,5 +221,6 @@ struct address_space_operations ll_aops = {
         prepare_write: ll_prepare_write,
         commit_write: ll_commit_write,
         removepage: ll_removepage,
+        sync_page: NULL,
         bmap: NULL
 };