1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
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>
11 * This file is part of InterMezzo, http://www.inter-mezzo.org.
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.
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.
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.
27 #include <linux/types.h>
28 #include <linux/param.h>
29 #include <linux/kernel.h>
30 #include <linux/sched.h>
32 #include <linux/slab.h>
33 #include <linux/vmalloc.h>
34 #include <linux/stat.h>
35 #include <linux/errno.h>
36 #include <asm/segment.h>
37 #include <asm/uaccess.h>
38 #include <linux/string.h>
39 #if defined(CONFIG_TMPFS)
40 #include <linux/jbd.h>
41 #if defined(CONFIG_EXT3)
42 #include <linux/ext3_fs.h>
43 #include <linux/ext3_jbd.h>
47 #include "intermezzo_fs.h"
48 #include "intermezzo_psdev.h"
50 #if defined(CONFIG_TMPFS)
52 /* space requirements:
54 used to truncate the KML forward to next fset->chunksize boundary
58 write header (< one block)
59 write one path (< MAX_PATHLEN)
60 possibly write another path (< MAX_PATHLEN)
61 write suffix (< one block)
62 presto_update_last_rcvd
66 static loff_t presto_tmpfs_freespace(struct presto_cache *cache,
67 struct super_block *sb)
72 /* start the filesystem journal operations */
73 static void *presto_tmpfs_trans_start(struct presto_file_set *fset,
80 static void presto_tmpfs_trans_commit(struct presto_file_set *fset, void *handle)
85 static void presto_tmpfs_journal_file_data(struct inode *inode)
90 /* The logic here is a slightly modified version of ext3/inode.c:block_to_path
92 static int presto_tmpfs_has_all_data(struct inode *inode)
97 struct journal_ops presto_tmpfs_journal_ops = {
98 .tr_all_data = presto_tmpfs_has_all_data,
99 .tr_avail = presto_tmpfs_freespace,
100 .tr_start = presto_tmpfs_trans_start,
101 .tr_commit = presto_tmpfs_trans_commit,
102 .tr_journal_data = presto_tmpfs_journal_file_data,
103 .tr_ilookup = presto_tmpfs_ilookup,
104 .tr_add_ilookup = presto_add_ilookup_dentry
107 #endif /* CONFIG_EXT3_FS */