+/*
+ * Find a specific page in the page cache. If it is found, we return
+ * the write request struct associated with it, if not found return NULL.
+ */
+#if 0
+static struct obdfs_pgrq *
+obdfs_find_in_page_cache(struct inode *inode, struct page *page)
+{
+ struct list_head *page_list = &OBDFS_LIST(inode);
+ struct list_head *tmp;
+ struct obdfs_pgrq *pgrq;
+
+ ENTRY;
+ CDEBUG(D_INODE, "looking for inode %ld page %p\n", inode->i_ino, page);
+ if (list_empty(page_list)) {
+ CDEBUG(D_INODE, "empty list\n");
+ EXIT;
+ return NULL;
+ }
+ tmp = page_list;
+ while ( (tmp = tmp->next) != page_list ) {
+ pgrq = list_entry(tmp, struct obdfs_pgrq, rq_list);
+ CDEBUG(D_INODE, "checking page %p\n", pgrq->rq_page);
+ if (pgrq->rq_page == page) {
+ CDEBUG(D_INODE, "found page %p in list\n", page);
+ EXIT;
+ return pgrq;
+ }
+ }
+
+ EXIT;
+ return NULL;
+} /* obdfs_find_in_page_cache */
+#endif
+
+
+int obdfs_do_vec_wr(struct super_block *sb, obd_count *num_io,
+ struct obdo **obdos,
+ struct page **pages, char **bufs, obd_size *counts,
+ obd_off *offsets, obd_flag *flags)
+{
+ int last_io = *num_io;
+ int err;
+ struct obdfs_sb_info *sbi = (struct obdfs_sb_info *)&sb->u.generic_sbp;
+ ENTRY;
+ CDEBUG(D_INODE, "writing %d pages in vector\n", last_io);
+ err = OPS(sb, brw)(WRITE, &sbi->osi_conn, num_io, obdos,
+ bufs, counts, offsets, flags);
+
+ do {
+ put_page(pages[--last_io]);
+ } while ( last_io > 0 );
+
+ EXIT;
+ return err;
+}
+
+
+/*
+ * Add a page to the write request cache list for later writing
+ * ASYNCHRONOUS write method.
+ */
+static int obdfs_add_page_to_cache(struct inode *inode, struct page *page)
+{
+ struct obdfs_pgrq *pgrq;
+ int rc = 0;
+
+ ENTRY;
+ pgrq = kmem_cache_alloc(obdfs_pgrq_cachep, SLAB_KERNEL);
+ CDEBUG(D_INODE, "adding inode %ld page %p, pgrq: %p\n",
+ inode->i_ino, page, pgrq);
+ if (!pgrq) {
+ EXIT;
+ return -ENOMEM;
+ }
+ memset(pgrq, 0, sizeof(*pgrq));
+
+ pgrq->rq_page = page;
+ pgrq->rq_inode = inode;
+
+ get_page(pgrq->rq_page);
+ list_add(&pgrq->rq_ilist, obdfs_ilist(inode));
+ list_add(&pgrq->rq_slist, obdfs_slist(inode));
+
+ /* XXX For testing purposes, we write out the page here.
+ * In the future, a flush daemon will write out the page.
+ return 0;
+ */
+ rc = obdfs_flush_reqs(obdfs_slist(inode), 0, 0);
+ EXIT;