Whamcloud - gitweb
Updated parameters for obdfs_writepage() to use struct *dentry instead of
authoradilger <adilger>
Wed, 1 Dec 1999 18:45:16 +0000 (18:45 +0000)
committeradilger <adilger>
Wed, 1 Dec 1999 18:45:16 +0000 (18:45 +0000)
struct *file, and call in odbfs_write_one_page() to use new parameters.
Updated gen_copy_data() to round up the number of pages copied in while loop.

lustre/include/linux/obdfs.h
lustre/obdclass/genops.c
lustre/obdfs/rw.c
lustre/tests/fs.sh [new file with mode: 0644]

index d583530..afd03c8 100644 (file)
@@ -23,7 +23,6 @@ ssize_t obdfs_file_write(struct file *file, const char *buf, size_t count, loff_
 
 /* rw.c */
 struct page *obdfs_getpage(struct inode *inode, unsigned long offset, int create, int locked);
 
 /* rw.c */
 struct page *obdfs_getpage(struct inode *inode, unsigned long offset, int create, int locked);
-int obdfs_writepage(struct file *file, struct page *page);
 int obdfs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf);
 
 /* namei.c */
 int obdfs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf);
 
 /* namei.c */
index 5c75ca5..929dc88 100644 (file)
@@ -212,7 +212,7 @@ int gen_copy_data(struct obd_conn *conn, obdattr *src, obdattr *tgt)
        
        lck_page(page);
        
        
        lck_page(page);
        
-       while (index < src->i_size / PAGE_SIZE) {
+       while (index < ((src->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
                
                page->index = index;
                rc = OBP(conn->oc_dev, brw)(READ, conn, src, page, 0);
                
                page->index = index;
                rc = OBP(conn->oc_dev, brw)(READ, conn, src, page, 0);
index 1d6399f..a07cd50 100644 (file)
@@ -44,13 +44,12 @@ int obdfs_brw(struct inode *dir, int rw, struct page *page, int create)
 #endif
 
 /* returns the page unlocked, but with a reference */
 #endif
 
 /* returns the page unlocked, but with a reference */
-int obdfs_readpage(struct file *file, struct page *page)
+int obdfs_readpage(struct dentry *dentry, struct page *page)
 {
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = dentry->d_inode;
        int rc;
 
         ENTRY;
        int rc;
 
         ENTRY;
-
        /* XXX flush stuff */
        PDEBUG(page, "READ");
        rc =  iops(inode)->o_brw(READ, iid(inode),inode, page, 0);
        /* XXX flush stuff */
        PDEBUG(page, "READ");
        rc =  iops(inode)->o_brw(READ, iid(inode),inode, page, 0);
@@ -65,6 +64,23 @@ int obdfs_readpage(struct file *file, struct page *page)
 
 }
 
 
 }
 
+/* returns the page unlocked, but with a reference */
+static int obdfs_writepage(struct dentry *dentry, struct page *page)
+{
+        struct inode *inode = dentry->d_inode;
+       int rc;
+
+        ENTRY;
+       PDEBUG(page, "WRITEPAGE");
+       /* XXX flush stuff */
+
+       rc = iops(inode)->o_brw(WRITE, iid(inode), inode, page, 1);
+
+       SetPageUptodate(page);
+       PDEBUG(page,"WRITEPAGE");
+       return rc;
+}
+
 /*
  * This does the "real" work of the write. The generic routine has
  * allocated the page, locked it, done all the page alignment stuff
 /*
  * This does the "real" work of the write. The generic routine has
  * allocated the page, locked it, done all the page alignment stuff
@@ -94,7 +110,7 @@ int obdfs_write_one_page(struct file *file, struct page *page, unsigned long off
        if (bytes) {
 
                lock_kernel();
        if (bytes) {
 
                lock_kernel();
-               status = obdfs_writepage(file, page);
+               status = obdfs_writepage(file->f_dentry, page);
                unlock_kernel();
        }
        EXIT;
                unlock_kernel();
        }
        EXIT;
@@ -107,23 +123,6 @@ int obdfs_write_one_page(struct file *file, struct page *page, unsigned long off
 
 
 
 
 
 
-/* returns the page unlocked, but with a reference */
-int obdfs_writepage(struct file *file, struct page *page)
-{
-        struct inode *inode = file->f_dentry->d_inode;
-       int rc;
-
-        ENTRY;
-       PDEBUG(page, "WRITEPAGE");
-       /* XXX flush stuff */
-
-       rc = iops(inode)->o_brw(WRITE, iid(inode), inode, page, 1);
-
-       SetPageUptodate(page);
-       PDEBUG(page,"WRITEPAGE");
-       return rc;
-}
-
 
 void report_inode(struct page * page) {
        struct inode *inode = (struct inode *)0;
 
 void report_inode(struct page * page) {
        struct inode *inode = (struct inode *)0;
diff --git a/lustre/tests/fs.sh b/lustre/tests/fs.sh
new file mode 100644 (file)
index 0000000..e94c949
--- /dev/null
@@ -0,0 +1,6 @@
+#! /bin/bash
+
+insmod loop
+dd if=/dev/zero of=/tmp/fs bs=1024 count=10000
+losetup /dev/loop0 /tmp/fs
+mke2fs -b 4096 /dev/loop0