Whamcloud - gitweb
- disable debug
[fs/lustre-release.git] / lustre / obdfilter / filter_io_26.c
index b594e83..ad109e4 100644 (file)
@@ -295,7 +295,7 @@ int filter_do_bio(struct obd_device *obd, struct inode *inode,
                 rc = dreq->dr_error;
         RETURN(rc);
 }
-  
 /* These are our hacks to keep our directio/bh IO coherent with ext3's
  * page cache use.  Most notably ext3 reads file data into the page
  * cache when it is zeroing the tail of partial-block truncates and
@@ -353,7 +353,8 @@ int filter_direct_io(int rw, struct dentry *dchild, void *iobuf,
         struct obd_device *obd = exp->exp_obd;
         struct inode *inode = dchild->d_inode;
         struct dio_request *dreq = iobuf;
-        int rc, rc2;
+        struct semaphore *sem = NULL;
+        int rc, rc2, create = 0;
         ENTRY;
 
         LASSERTF(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ, "%x\n", rw);
@@ -366,21 +367,23 @@ int filter_direct_io(int rw, struct dentry *dchild, void *iobuf,
         if (dreq->dr_npages > OBDFILTER_CREATED_SCRATCHPAD_ENTRIES)
                 RETURN(-EINVAL);
         
+        if (rw == OBD_BRW_WRITE) {
+                create = 1;
+                //sem = &obd->u.filter.fo_alloc_lock;
+        }
+
         rc = fsfilt_map_inode_pages(obd, inode,
                                     dreq->dr_pages, dreq->dr_npages,
                                     dreq->dr_blocks,
                                     obdfilter_created_scratchpad,
-                                    rw == OBD_BRW_WRITE, NULL);
+                                    create, sem);
 
         if (rw == OBD_BRW_WRITE) {
                 if (rc == 0) {
-#if 0
-                        filter_tally_write(&obd->u.filter, 
-                                           dreq->dr_pages,
-                                           dreq->dr_page_idx,
-                                           dreq->dr_blocks,
+                        int blocks_per_page = PAGE_SIZE >> inode->i_blkbits;
+                        filter_tally_write(&obd->u.filter,  dreq->dr_pages,
+                                           dreq->dr_npages, dreq->dr_blocks,
                                            blocks_per_page);
-#endif
                         if (attr->ia_size > inode->i_size)
                                 attr->ia_valid |= ATTR_SIZE;
                         rc = fsfilt_setattr(obd, dchild, 
@@ -534,7 +537,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa,
         err = fsfilt_commit_wait(obd, inode, wait_handle);
         if (rc == 0)
                 rc = err;
-   
+
         fsfilt_check_slow(now, obd_timeout, "commitrw commit");
 
 cleanup: