1/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
3 *
4 *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
5 *  Copyright (C) 2000 Red Hat, Inc.
6 *  Copyright (C) 2000 Los Alamos National Laboratory
7 *  Copyright (C) 2000 TurboLinux, Inc.
8 *  Copyright (C) 2001 Mountain View Data, Inc.
9 *  Copyright (C) 2001 Tacit Networks, Inc. <phil@off.net>
10 *
11 *   This file is part of InterMezzo, http://www.inter-mezzo.org.
12 *
13 *   InterMezzo is free software; you can redistribute it and/or
14 *   modify it under the terms of version 2 of the GNU General Public
15 *   License as published by the Free Software Foundation.
16 *
17 *   InterMezzo is distributed in the hope that it will be useful,
18 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
19 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 *   GNU General Public License for more details.
21 *
22 *   You should have received a copy of the GNU General Public License
23 *   along with InterMezzo; if not, write to the Free Software
24 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#include <linux/types.h>
28#include <linux/param.h>
29#include <linux/kernel.h>
30#include <linux/sched.h>
31#include <linux/fs.h>
32#include <linux/slab.h>
33#include <linux/vmalloc.h>
34#include <linux/stat.h>
35#include <linux/errno.h>
36#include <linux/locks.h>
37#include <asm/segment.h>
38#include <asm/uaccess.h>
39#include <linux/string.h>
40#include <linux/smp_lock.h>
41#if defined(CONFIG_TMPFS)
42#include <linux/jbd.h>
43#if defined(CONFIG_EXT3)
44#include <linux/ext3_fs.h>
45#include <linux/ext3_jbd.h>
46#endif
47#endif
48
49#include <linux/intermezzo_fs.h>
50#include <linux/intermezzo_psdev.h>
51
52#if defined(CONFIG_TMPFS)
53
54/* space requirements:
55   presto_do_truncate:
56        used to truncate the KML forward to next fset->chunksize boundary
57          - zero partial block
58          - update inode
59   presto_write_record:
60        write header (< one block)
61        write one path (< MAX_PATHLEN)
62        possibly write another path (< MAX_PATHLEN)
63        write suffix (< one block)
64   presto_update_last_rcvd
65        write one block
66*/
67
68static loff_t presto_tmpfs_freespace(struct presto_cache *cache,
69                                         struct super_block *sb)
70{
71        return (1<<30);
72}
73
74/* start the filesystem journal operations */
75static void *presto_tmpfs_trans_start(struct presto_file_set *fset,
76                                   struct inode *inode,
77                                   int op)
78{
79        return (void *)1;
80}
81
82static void presto_tmpfs_trans_commit(struct presto_file_set *fset, void *handle)
83{
84        return;
85}
86
87static void presto_tmpfs_journal_file_data(struct inode *inode)
88{
89        return;
90}
91
92/* The logic here is a slightly modified version of ext3/inode.c:block_to_path
93 */
94static int presto_tmpfs_has_all_data(struct inode *inode)
95{
96        return 0;
97}
98
99struct journal_ops presto_tmpfs_journal_ops = {
100        tr_all_data: presto_tmpfs_has_all_data,
101        tr_avail: presto_tmpfs_freespace,
102        tr_start:  presto_tmpfs_trans_start,
103        tr_commit: presto_tmpfs_trans_commit,
104        tr_journal_data: presto_tmpfs_journal_file_data,
105        tr_ilookup: presto_tmpfs_ilookup,
106        tr_add_ilookup: presto_add_ilookup_dentry
107};
108
109#endif /* CONFIG_EXT3_FS */
110