-/*
- * Lustre Light I/O Page Cache
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright (C) 2002, Cluster File Systems, Inc.
-*/
-
+ * Lustre Lite I/O Page Cache
+ *
+ * Copyright (C) 2002 Cluster File Systems, Inc.
+ */
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/stat.h>
+#include <linux/iobuf.h>
#include <linux/errno.h>
#include <linux/locks.h>
#include <linux/unistd.h>
-
+#include <linux/version.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/stat.h>
#include <asm/uaccess.h>
-#include <linux/vmalloc.h>
#include <asm/segment.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_light.h>
-
+#define DEBUG_SUBSYSTEM S_LLITE
-static void inline ll_oa_from_inode(struct obdo *oa, struct inode *inode)
-{
- struct ll_inode_info *oinfo = ll_i2info(inode);
-
- if ( oa->o_valid & OBD_MD_FLID )
- oa->o_id = oinfo->lli_objid;
- if ( oa->o_valid & OBD_MD_FLATIME )
- oa->o_atime = inode->i_atime;
- if ( oa->o_valid & OBD_MD_FLMTIME )
- oa->o_mtime = inode->i_mtime;
- if ( oa->o_valid & OBD_MD_FLCTIME )
- oa->o_ctime = inode->i_ctime;
- if ( oa->o_valid & OBD_MD_FLSIZE )
- oa->o_size = inode->i_size;
- if ( oa->o_valid & OBD_MD_FLBLOCKS ) /* allocation of space */
- oa->o_blocks = inode->i_blocks;
- if ( oa->o_valid & OBD_MD_FLBLKSZ )
- oa->o_blksize = inode->i_blksize;
- if ( oa->o_valid & OBD_MD_FLMODE )
- oa->o_mode = inode->i_mode;
- if ( oa->o_valid & OBD_MD_FLUID )
- oa->o_uid = inode->i_uid;
- if ( oa->o_valid & OBD_MD_FLGID )
- oa->o_gid = inode->i_gid;
- if ( oa->o_valid & OBD_MD_FLFLAGS )
- oa->o_flags = inode->i_flags;
- if ( oa->o_valid & OBD_MD_FLNLINK )
- oa->o_nlink = inode->i_nlink;
- if ( oa->o_valid & OBD_MD_FLGENER )
- oa->o_generation = inode->i_generation;
-
- CDEBUG(D_INFO, "src inode %ld, dst obdo %ld valid 0x%08x\n",
- inode->i_ino, (long)oa->o_id, oa->o_valid);
- obdo_from_inode(oa, inode);
-
- /* this will transfer metadata for the logical object to
- the oa: that metadata could contain the constituent objects
- */
- if (ll_has_inline(inode)) {
- CDEBUG(D_INODE, "copying inline data from inode to obdo\n");
- memcpy(oa->o_inline, oinfo->lli_inline, OBD_INLINESZ);
- oa->o_obdflags |= OBD_FL_INLINEDATA;
- oa->o_valid |= OBD_MD_FLINLINE;
- }
-} /* ll_oa_from_inode */
-
-/*
- * Add a page to the dirty page list.
- */
-void set_page_dirty(struct page *page)
-{
- if (!test_and_set_bit(PG_dirty, &page->flags)) {
- struct address_space *mapping = page->mapping;
-
- if (mapping) {
- spin_lock(&pagecache_lock);
- list_del(&page->list);
- list_add(&page->list, &mapping->dirty_pages);
- spin_unlock(&pagecache_lock);
-
- if (mapping->host)
- mark_inode_dirty_pages(mapping->host);
- }
- }
-}
-
-/*
- * Remove page from dirty list
- */
-void __set_page_clean(struct page *page)
-{
- struct address_space *mapping = page->mapping;
- struct inode *inode;
-
- if (!mapping)
- return;
-
- spin_lock(&pagecache_lock);
- list_del(&page->list);
- list_add(&page->list, &mapping->clean_pages);
-
- inode = mapping->host;
- if (list_empty(&mapping->dirty_pages)) {
- CDEBUG(D_INODE, "inode clean\n");
- inode->i_state &= ~I_DIRTY_PAGES;
- }
- spin_unlock(&pagecache_lock);
- EXIT;
-}
+#include <linux/lustre_mds.h>
+#include <linux/lustre_lite.h>
+#include <linux/lustre_lib.h>
-inline void set_page_clean(struct page *page)
-{
- if (PageDirty(page)) {
- ClearPageDirty(page);
- __set_page_clean(page);
- }
-}
-/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
+/* SYNCHRONOUS I/O to object storage for an inode */
static int ll_brw(int rw, struct inode *inode, struct page *page, int create)
{
- obd_count num_obdo = 1;
- obd_count bufs_per_obdo = 1;
- struct obdo *oa;
- obd_size count = PAGE_SIZE;
- obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
- obd_flag flags = create ? OBD_BRW_CREATE : 0;
- int err;
-
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *md = lli->lli_smd;
+ struct brw_page pg;
+ int err;
+ struct io_cb_data *cbd = ll_init_cb();
ENTRY;
- oa = obdo_alloc();
- if ( !oa ) {
- EXIT;
- return -ENOMEM;
- }
- oa->o_valid = OBD_MD_FLNOTOBD;
- ll_oa_from_inode(oa, inode);
+ if (!cbd)
+ RETURN(-ENOMEM);
- err = obd_brw(rw, IID(inode), num_obdo, &oa, &bufs_per_obdo,
- &page, &count, &offset, &flags);
- //if ( !err )
- // ll_to_inode(inode, oa); /* copy o_blocks to i_blocks */
+ pg.pg = page;
+ pg.count = PAGE_SIZE;
+ pg.off = ((obd_off)page->index) << PAGE_SHIFT;
+ pg.flag = create ? OBD_BRW_CREATE : 0;
- obdo_free(oa);
- EXIT;
- return err;
-} /* ll_brw */
+ err = obd_brw(rw, ll_i2obdconn(inode), md, 1, &pg, ll_sync_io_cb, cbd);
-extern void set_page_clean(struct page *);
+ RETURN(err);
+} /* ll_brw */
-/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
-static int ll_commit_page(struct page *page, int create, int from, int to)
+/* returns the page unlocked, but with a reference */
+static int ll_readpage(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
- obd_count num_obdo = 1;
- obd_count bufs_per_obdo = 1;
- struct obdo *oa;
- obd_size count = to;
- obd_off offset = (((obd_off)page->index) << PAGE_SHIFT);
- obd_flag flags = create ? OBD_BRW_CREATE : 0;
- int err;
-
+ struct inode *inode = page->mapping->host;
+ obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
+ int rc = 0;
ENTRY;
- oa = obdo_alloc();
- if ( !oa ) {
- EXIT;
- return -ENOMEM;
- }
- oa->o_valid = OBD_MD_FLNOTOBD;
- ll_oa_from_inode(oa, inode);
- CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n",
- from, to, count);
+ if (!PageLocked(page))
+ LBUG();
- err = obd_brw(WRITE, IID(inode), num_obdo, &oa, &bufs_per_obdo,
- &page, &count, &offset, &flags);
- if ( !err ) {
- SetPageUptodate(page);
- set_page_clean(page);
- }
+ if (inode->i_size <= offset) {
+ memset(kmap(page), 0, PAGE_SIZE);
+ kunmap(page);
+ GOTO(readpage_out, rc);
+ }
- //if ( !err )
- // ll_to_inode(inode, oa); /* copy o_blocks to i_blocks */
+ if (Page_Uptodate(page)) {
+ CERROR("Explain this please?\n");
+ GOTO(readpage_out, rc);
+ }
- obdo_free(oa);
+ rc = ll_brw(OBD_BRW_READ, inode, page, 0);
EXIT;
- return err;
-} /* ll_brw */
-
-
-/* returns the page unlocked, but with a reference */
-int ll_readpage(struct file *file, struct page *page)
-{
- struct inode *inode = page->mapping->host;
- int rc;
-
- ENTRY;
-
- if ( ((inode->i_size + PAGE_CACHE_SIZE -1)>>PAGE_SHIFT)
- <= page->index) {
- memset(kmap(page), 0, PAGE_CACHE_SIZE);
- kunmap(page);
- goto readpage_out;
- }
-
- if (Page_Uptodate(page)) {
- EXIT;
- goto readpage_out;
- }
-
- rc = ll_brw(READ, inode, page, 0);
- if ( rc ) {
- EXIT;
- return rc;
- }
- /* PDEBUG(page, "READ"); */
readpage_out:
- SetPageUptodate(page);
- obd_unlock_page(page);
- EXIT;
+ if (!rc)
+ SetPageUptodate(page);
+ UnlockPage(page);
return 0;
} /* ll_readpage */
-
-/* returns the page unlocked, but with a reference */
-int ll_dir_readpage(struct file *file, struct page *page)
+static int ll_prepare_write(struct file *file, struct page *page, unsigned from,
+ unsigned to)
{
- struct inode *inode = page->mapping->host;
- char *buf;
- __u64 offset;
+ struct inode *inode = page->mapping->host;
+ obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
int rc = 0;
- struct ptlrep_hdr *hdr;
-
+ char *addr;
ENTRY;
- if ( ((inode->i_size + PAGE_CACHE_SIZE -1)>>PAGE_SHIFT)
- <= page->index) {
- memset(kmap(page), 0, PAGE_CACHE_SIZE);
- kunmap(page);
- goto readpage_out;
- }
-
- if (Page_Uptodate(page)) {
- EXIT;
- goto readpage_out;
- }
-
- offset = page->index << PAGE_SHIFT;
- buf = kmap(page);
- rc = mdc_readpage(inode->i_ino, S_IFDIR, offset, buf, NULL, &hdr);
- kunmap(buff);
- if ( rc ) {
- EXIT;
- goto readpage_out;
- }
-
- if ((rc = hdr->status)) {
- EXIT;
- goto readpage_out;
- }
-
- /* PDEBUG(page, "READ"); */
-
- SetPageUptodate(page);
- readpage_out:
- unlock_page(page);
- EXIT;
- return rc;
-} /* ll_dir_readpage */
+ addr = kmap(page);
+ if (!PageLocked(page))
+ LBUG();
-int ll_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
-{
- struct inode *inode = page->mapping->host;
- obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
- int rc = 0;
- ENTRY;
-
- kmap(page);
- if (Page_Uptodate(page)) {
- EXIT;
- goto prepare_done;
- }
+ if (Page_Uptodate(page))
+ GOTO(prepare_done, rc);
+
+ /* We're completely overwriting an existing page, so _don't_ set it up
+ * to date until commit_write */
+ if (from == 0 && to == PAGE_SIZE)
+ RETURN(0);
- if ( (from <= offset) && (to >= offset + PAGE_SIZE) ) {
- EXIT;
- return 0;
+ /* We are writing to a new page, no need to read old data */
+ if (inode->i_size <= offset) {
+ memset(addr, 0, PAGE_SIZE);
+ goto prepare_done;
}
-
- rc = ll_brw(READ, inode, page, 0);
- if ( !rc ) {
- SetPageUptodate(page);
- }
- prepare_done:
- set_page_dirty(page);
- //SetPageDirty(page);
+ rc = ll_brw(OBD_BRW_READ, inode, page, 0);
+
EXIT;
+ prepare_done:
+ if (!rc)
+ SetPageUptodate(page);
+
return rc;
}
-
-/* select between SYNC and ASYNC I/O methods */
-int ll_do_writepage(struct page *page, int sync)
+/* returns the page unlocked, but with a reference */
+static int ll_writepage(struct page *page)
{
struct inode *inode = page->mapping->host;
int err;
-
ENTRY;
- /* PDEBUG(page, "WRITEPAGE"); */
- /* XXX everything is synchronous now */
- err = ll_brw(WRITE, inode, page, 1);
- if ( !err ) {
- SetPageUptodate(page);
- set_page_clean(page);
- }
- /* PDEBUG(page,"WRITEPAGE"); */
- EXIT;
- return err;
-} /* ll_do_writepage */
+ if (!PageLocked(page))
+ LBUG();
+ err = ll_brw(OBD_BRW_WRITE, inode, page, 1);
+ if ( !err ) {
+ //SetPageUptodate(page);
+ set_page_clean(page);
+ } else {
+ CERROR("ll_brw failure %d\n", err);
+ }
+ unlock_page(page);
+ RETURN(err);
+}
-/* returns the page unlocked, but with a reference */
-int ll_writepage(struct page *page)
+/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated
+ * too */
+static int ll_commit_write(struct file *file, struct page *page,
+ unsigned from, unsigned to)
{
- int rc;
- struct inode *inode = page->mapping->host;
- ENTRY;
- printk("---> writepage called ino %ld!\n", inode->i_ino);
- BUG();
- rc = ll_do_writepage(page, 1);
- if ( !rc ) {
- set_page_clean(page);
- } else {
- CDEBUG(D_INODE, "--> GRR %d\n", rc);
- }
- EXIT;
- return rc;
-}
+ int create = 1;
+ struct inode *inode = page->mapping->host;
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *md = lli->lli_smd;
+ struct brw_page pg;
+ int err;
+ loff_t size;
+ struct io_cb_data *cbd = ll_init_cb();
-void write_inode_pages(struct inode *inode)
-{
- struct list_head *tmp = &inode->i_mapping->dirty_pages;
-
- while ( (tmp = tmp->next) != &inode->i_mapping->dirty_pages) {
- struct page *page;
- page = list_entry(tmp, struct page, list);
- ll_writepage(page);
- }
-}
+ pg.pg = page;
+ pg.count = to;
+ pg.off = (((obd_off)page->index) << PAGE_SHIFT);
+ pg.flag = create ? OBD_BRW_CREATE : 0;
+ ENTRY;
+ if (!cbd)
+ RETURN(-ENOMEM);
-int ll_commit_write(struct file *file, struct page *page, unsigned from, unsigned to)
-{
- struct inode *inode = page->mapping->host;
- int rc = 0;
- loff_t len = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
- ENTRY;
- CDEBUG(D_INODE, "commit write ino %ld (end at %Ld) from %d to %d ,ind %ld\n",
- inode->i_ino, len, from, to, page->index);
+ SetPageUptodate(page);
- rc = ll_commit_page(page, 1, from, to);
+ if (!PageLocked(page))
+ LBUG();
- if (len > inode->i_size) {
- ll_set_size(inode, len);
- }
+ CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n",
+ from, to, (unsigned long long)pg.count);
+ err = obd_brw(OBD_BRW_WRITE, ll_i2obdconn(inode), md,
+ 1, &pg, ll_sync_io_cb, cbd);
kunmap(page);
- EXIT;
- return rc;
-}
+ size = pg.off + pg.count;
+ /* do NOT truncate when writing in the middle of a file */
+ if (size > inode->i_size)
+ inode->i_size = size;
-/*
- * This does the "real" work of the write. The generic routine has
- * allocated the page, locked it, done all the page alignment stuff
- * calculations etc. Now we should just copy the data from user
- * space and write it back to the real medium..
- *
- * If the writer ends up delaying the write, the writer needs to
- * increment the page use counts until he is done with the page.
- *
- * Return value is the number of bytes written.
- */
-int ll_write_one_page(struct file *file, struct page *page,
- unsigned long offset, unsigned long bytes,
- const char * buf)
+ RETURN(err);
+} /* ll_commit_write */
+
+void ll_truncate(struct inode *inode)
{
- struct inode *inode = file->f_dentry->d_inode;
+ struct obdo oa = {0};
+ struct lov_stripe_md *md = ll_i2info(inode)->lli_smd;
+ struct lustre_handle *lockhs = NULL;
int err;
-
ENTRY;
- /* We check for complete page writes here, as we then don't have to
- * get the page before writing over everything anyways.
- */
- if ( !Page_Uptodate(page) && (offset != 0 || bytes != PAGE_SIZE) ) {
- err = ll_brw(READ, inode, page, 0);
- if ( err )
- return err;
- SetPageUptodate(page);
+
+ if (!md) {
+ /* object not yet allocated */
+ inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ return;
}
- if (copy_from_user((u8*)page_address(page) + offset, buf, bytes))
- return -EFAULT;
+ oa.o_id = md->lmd_object_id;
+ oa.o_size = inode->i_size;
- lock_kernel();
- err = ll_writepage(page);
- unlock_kernel();
+ CDEBUG(D_INFO, "calling punch for %ld (all bytes after %Ld)\n",
+ (long)oa.o_id, (unsigned long long)oa.o_size);
- return (err < 0 ? err : bytes);
-} /* ll_write_one_page */
+ err = ll_size_lock(inode, md, oa.o_size, LCK_PW, &lockhs);
+ if (err) {
+ CERROR("ll_size_lock failed: %d\n", err);
+ /* FIXME: What to do here? It's too late to back out... */
+ LBUG();
+ }
-/*
- * return an up to date page:
- * - if locked is true then is returned locked
- * - if create is true the corresponding disk blocks are created
- * - page is held, i.e. caller must release the page
- *
- * modeled on NFS code.
- */
-struct page *ll_getpage(struct inode *inode, unsigned long offset,
- int create, int locked)
+ oa.o_valid = OBD_MD_FLID;
+ /* truncate == punch to/from start from/to end:
+ set end to -1 for that. */
+ err = obd_punch(ll_i2obdconn(inode), &oa, md, inode->i_size,
+ 0xffffffffffffffff);
+ if (err)
+ CERROR("obd_truncate fails (%d)\n", err);
+ else
+ obdo_to_inode(inode, &oa, oa.o_valid);
+
+ err = ll_size_unlock(inode, md, LCK_PW, lockhs);
+ if (err)
+ CERROR("ll_size_unlock failed: %d\n", err);
+
+ EXIT;
+ return;
+} /* ll_truncate */
+
+int ll_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf,
+ unsigned long blocknr, int blocksize)
{
- struct page * page;
- int index;
- int err;
+ obd_count bufs_per_obdo = iobuf->nr_pages;
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *md = lli->lli_smd;
+ struct brw_page *pga;
+ int rc = 0;
+ int i;
+ struct io_cb_data *cbd = ll_init_cb();
ENTRY;
+ if (!cbd)
+ RETURN(-ENOMEM);
- offset = offset & PAGE_CACHE_MASK;
- CDEBUG(D_INFO, "ino: %ld, offset %ld, create %d, locked %d\n",
- inode->i_ino, offset, create, locked);
- index = offset >> PAGE_CACHE_SHIFT;
+ if (blocksize != PAGE_SIZE) {
+ CERROR("direct_IO blocksize != PAGE_SIZE\n");
+ return -EINVAL;
+ }
- page = grab_cache_page(&inode->i_data, index);
+ OBD_ALLOC(pga, sizeof(*pga) * bufs_per_obdo);
+ if (!pga)
+ GOTO(out, rc = -ENOMEM);
- /* Yuck, no page */
- if (! page) {
- printk(KERN_WARNING " grab_cache_page says no dice ...\n");
- EXIT;
- return NULL;
+ /* NB: we can't use iobuf->maplist[i]->index for the offset
+ * instead of "blocknr" because ->index contains garbage.
+ */
+ for (i = 0; i < bufs_per_obdo; i++, blocknr++) {
+ pga[i].pg = iobuf->maplist[i];
+ pga[i].count = PAGE_SIZE;
+ pga[i].off = (obd_off)blocknr << PAGE_SHIFT;
+ pga[i].flag = OBD_BRW_CREATE;
}
- /* PDEBUG(page, "GETPAGE: got page - before reading\n"); */
- /* now check if the data in the page is up to date */
- if ( Page_Uptodate(page)) {
- if (!locked) {
- if (PageLocked(page))
- obd_unlock_page(page);
- } else {
- printk("file %s, line %d: expecting locked page\n",
- __FILE__, __LINE__);
- }
- EXIT;
- return page;
- }
-
- err = ll_brw(READ, inode, page, create);
-
- if ( err ) {
- SetPageError(page);
- obd_unlock_page(page);
- EXIT;
- return page;
- }
+ if (!md || !md->lmd_object_id)
+ GOTO(out, rc = -ENOMEM);
- if ( !locked )
- obd_unlock_page(page);
- SetPageUptodate(page);
- /* PDEBUG(page,"GETPAGE - after reading"); */
- EXIT;
- return page;
-} /* ll_getpage */
+ rc = obd_brw(rw == WRITE ? OBD_BRW_WRITE : OBD_BRW_READ,
+ ll_i2obdconn(inode), md, bufs_per_obdo, pga,
+ ll_sync_io_cb, cbd);
+ if (rc == 0)
+ rc = bufs_per_obdo * PAGE_SIZE;
+out:
+ OBD_FREE(pga, sizeof(*pga) * bufs_per_obdo);
+ RETURN(rc);
+}
-void ll_truncate(struct inode *inode)
+
+int ll_flush_inode_pages(struct inode * inode)
{
- struct obdo *oa;
- int err;
+ obd_count bufs_per_obdo = 0;
+ obd_size *count = NULL;
+ obd_off *offset = NULL;
+ obd_flag *flags = NULL;
+ int err = 0;
+
ENTRY;
- //ll_dequeue_pages(inode);
+ spin_lock(&pagecache_lock);
- oa = obdo_alloc();
- if ( !oa ) {
- /* XXX This would give an inconsistent FS, so deal with it as
- * best we can for now - an obdo on the stack is not pretty.
- */
- struct obdo obdo;
+ spin_unlock(&pagecache_lock);
- printk(__FUNCTION__ ": obdo_alloc failed - using stack!\n");
- obdo.o_valid = OBD_MD_FLNOTOBD;
- ll_oa_from_inode(&obdo, inode);
+ OBD_ALLOC(count, sizeof(*count) * bufs_per_obdo);
+ OBD_ALLOC(offset, sizeof(*offset) * bufs_per_obdo);
+ OBD_ALLOC(flags, sizeof(*flags) * bufs_per_obdo);
+ if (!count || !offset || !flags)
+ GOTO(out, err=-ENOMEM);
- err = obd_punch(IID(inode), &obdo, 0, obdo.o_size);
- } else {
- oa->o_valid = OBD_MD_FLNOTOBD;
- ll_oa_from_inode(oa, inode);
+#if 0
+ for (i = 0 ; i < bufs_per_obdo ; i++) {
+ count[i] = PAGE_SIZE;
+ offset[i] = ((obd_off)(iobuf->maplist[i])->index) << PAGE_SHIFT;
+ flags[i] = OBD_BRW_CREATE;
+ }
- CDEBUG(D_INFO, "calling punch for %ld (%Lu bytes at 0)\n",
- (long)oa->o_id, oa->o_size);
- err = obd_punch(IID(inode), oa, oa->o_size, 0);
+ err = obd_brw(OBD_BRW_WRITE, ll_i2obdconn(inode),
+ ll_i2info(inode)->lli_smd, bufs_per_obdo,
+ iobuf->maplist, count, offset, flags, NULL, NULL);
+ if (err == 0)
+ err = bufs_per_obdo * 4096;
+#endif
+ out:
+ OBD_FREE(flags, sizeof(*flags) * bufs_per_obdo);
+ OBD_FREE(count, sizeof(*count) * bufs_per_obdo);
+ OBD_FREE(offset, sizeof(*offset) * bufs_per_obdo);
+ RETURN(err);
+}
- obdo_free(oa);
- }
- if (err) {
- printk(__FUNCTION__ ": obd_truncate fails (%d)\n", err);
- EXIT;
- return;
- }
- EXIT;
-} /* ll_truncate */
struct address_space_operations ll_aops = {
readpage: ll_readpage,
writepage: ll_writepage,
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,17))
+ direct_IO: ll_direct_IO,
+#endif
sync_page: block_sync_page,
- prepare_write: ll_prepare_write,
+ prepare_write: ll_prepare_write,
commit_write: ll_commit_write,
bmap: NULL
};
-
-
-struct address_space_operations ll_dir_aops = {
- readpage: ll_dir_readpage
-};