From: adilger Date: Wed, 1 Dec 1999 18:45:16 +0000 (+0000) Subject: Updated parameters for obdfs_writepage() to use struct *dentry instead of X-Git-Tag: v1_7_100~6177 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=906f38ee0bc23a1b153fde2e9bf1063ccb0f40c9;ds=sidebyside Updated parameters for obdfs_writepage() to use struct *dentry instead of 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. --- diff --git a/lustre/include/linux/obdfs.h b/lustre/include/linux/obdfs.h index d583530..afd03c8 100644 --- a/lustre/include/linux/obdfs.h +++ b/lustre/include/linux/obdfs.h @@ -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); -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 */ diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 5c75ca5..929dc88 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -212,7 +212,7 @@ int gen_copy_data(struct obd_conn *conn, obdattr *src, obdattr *tgt) 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); diff --git a/lustre/obdfs/rw.c b/lustre/obdfs/rw.c index 1d6399f..a07cd50 100644 --- a/lustre/obdfs/rw.c +++ b/lustre/obdfs/rw.c @@ -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 */ -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; - /* 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 @@ -94,7 +110,7 @@ int obdfs_write_one_page(struct file *file, struct page *page, unsigned long off if (bytes) { lock_kernel(); - status = obdfs_writepage(file, page); + status = obdfs_writepage(file->f_dentry, page); 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; diff --git a/lustre/tests/fs.sh b/lustre/tests/fs.sh new file mode 100644 index 0000000..e94c949 --- /dev/null +++ b/lustre/tests/fs.sh @@ -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