]> err.no Git - linux-2.6/blobdiff - fs/direct-io.c
[PATCH] io-accounting: report in procfs
[linux-2.6] / fs / direct-io.c
index 538fb0418fbab7aba852cc298b5a9ded054935f2..45d34d80739112362be5a5d2e4eccbde0b30273d 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/slab.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
+#include <linux/task_io_accounting_ops.h>
 #include <linux/bio.h>
 #include <linux/wait.h>
 #include <linux/err.h>
@@ -220,7 +221,8 @@ static void dio_complete(struct dio *dio, loff_t offset, ssize_t bytes)
        if (dio->end_io && dio->result)
                dio->end_io(dio->iocb, offset, bytes, dio->map_bh.b_private);
        if (dio->lock_type == DIO_LOCKING)
-               up_read(&dio->inode->i_alloc_sem);
+               /* lockdep: non-owner release */
+               up_read_non_owner(&dio->inode->i_alloc_sem);
 }
 
 /*
@@ -674,6 +676,13 @@ submit_page_section(struct dio *dio, struct page *page,
 {
        int ret = 0;
 
+       if (dio->rw & WRITE) {
+               /*
+                * Read accounting is performed in submit_bio()
+                */
+               task_io_account_write(len);
+       }
+
        /*
         * Can we just grow the current page's presence in the dio?
         */
@@ -1261,7 +1270,8 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
                }
 
                if (dio_lock_type == DIO_LOCKING)
-                       down_read(&inode->i_alloc_sem);
+                       /* lockdep: not the owner will release it */
+                       down_read_non_owner(&inode->i_alloc_sem);
        }
 
        /*