journal_tmpfs.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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. #include <linux/types.h>
  27. #include <linux/param.h>
  28. #include <linux/kernel.h>
  29. #include <linux/sched.h>
  30. #include <linux/fs.h>
  31. #include <linux/slab.h>
  32. #include <linux/vmalloc.h>
  33. #include <linux/stat.h>
  34. #include <linux/errno.h>
  35. #include <linux/locks.h>
  36. #include <asm/segment.h>
  37. #include <asm/uaccess.h>
  38. #include <linux/string.h>
  39. #include <linux/smp_lock.h>
  40. #if defined(CONFIG_TMPFS)
  41. #include <linux/jbd.h>
  42. #if defined(CONFIG_EXT3)
  43. #include <linux/ext3_fs.h>
  44. #include <linux/ext3_jbd.h>
  45. #endif
  46. #endif
  47. #include <linux/intermezzo_fs.h>
  48. #include <linux/intermezzo_psdev.h>
  49. #if defined(CONFIG_TMPFS)
  50. /* space requirements: 
  51.    presto_do_truncate: 
  52.         used to truncate the KML forward to next fset->chunksize boundary
  53.           - zero partial block
  54.           - update inode
  55.    presto_write_record: 
  56.         write header (< one block) 
  57.         write one path (< MAX_PATHLEN) 
  58.         possibly write another path (< MAX_PATHLEN)
  59.         write suffix (< one block) 
  60.    presto_update_last_rcvd
  61.         write one block
  62. */
  63. static loff_t presto_tmpfs_freespace(struct presto_cache *cache,
  64.                                          struct super_block *sb)
  65. {
  66.         return (1<<30);
  67. }
  68. /* start the filesystem journal operations */
  69. static void *presto_tmpfs_trans_start(struct presto_file_set *fset, 
  70.                                    struct inode *inode, 
  71.                                    int op)
  72. {
  73.         return (void *)1; 
  74. }
  75. static void presto_tmpfs_trans_commit(struct presto_file_set *fset, void *handle)
  76. {
  77.         return;
  78. }
  79. static void presto_tmpfs_journal_file_data(struct inode *inode)
  80. {
  81.         return; 
  82. }
  83. /* The logic here is a slightly modified version of ext3/inode.c:block_to_path
  84.  */
  85. static int presto_tmpfs_has_all_data(struct inode *inode)
  86. {
  87.         return 0;
  88. }
  89. struct journal_ops presto_tmpfs_journal_ops = {
  90.         tr_all_data: presto_tmpfs_has_all_data,
  91.         tr_avail: presto_tmpfs_freespace,
  92.         tr_start:  presto_tmpfs_trans_start,
  93.         tr_commit: presto_tmpfs_trans_commit,
  94.         tr_journal_data: presto_tmpfs_journal_file_data,
  95.         tr_ilookup: presto_tmpfs_ilookup,
  96.         tr_add_ilookup: presto_add_ilookup_dentry
  97. };
  98. #endif /* CONFIG_EXT3_FS */