1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * lustre/lib/fsfilt_ext3.c
5 * Lustre filesystem abstraction routines
7 * Copyright (C) 2002, 2003 Cluster File Systems, Inc.
8 * Author: Andreas Dilger <adilger@clusterfs.com>
10 * This file is part of Lustre, http://www.lustre.org.
12 * Lustre is free software; you can redistribute it and/or
13 * modify it under the terms of version 2 of the GNU General Public
14 * License as published by the Free Software Foundation.
16 * Lustre is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with Lustre; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #define DEBUG_SUBSYSTEM S_FILTER
28 #include <linux/init.h>
29 #include <linux/module.h>
31 #include <linux/jbd.h>
32 #include <linux/slab.h>
33 #include <linux/pagemap.h>
34 #include <linux/quotaops.h>
35 #include <linux/ext3_fs.h>
36 #include <linux/ext3_jbd.h>
37 #include <linux/version.h>
38 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
39 #include <linux/ext3_xattr.h>
41 #include <ext3/xattr.h>
44 #include <linux/kp30.h>
45 #include <linux/lustre_fsfilt.h>
46 #include <linux/obd.h>
47 #include <linux/obd_class.h>
49 static kmem_cache_t *fcb_cache;
50 static atomic_t fcb_cache_count = ATOMIC_INIT(0);
52 struct fsfilt_cb_data {
53 struct journal_callback cb_jcb; /* jbd private data - MUST BE FIRST */
54 fsfilt_cb_t cb_func; /* MDS/OBD completion function */
55 struct obd_device *cb_obd; /* MDS/OBD completion device */
56 __u64 cb_last_rcvd; /* MDS/OST last committed operation */
57 void *cb_data; /* MDS/OST completion function data */
60 #ifndef EXT3_XATTR_INDEX_TRUSTED /* temporary until we hit l28 kernel */
61 #define EXT3_XATTR_INDEX_TRUSTED 4
63 #define XATTR_LUSTRE_MDS_LOV_EA "lov"
66 * We don't currently need any additional blocks for rmdir and
67 * unlink transactions because we are storing the OST oa_id inside
68 * the inode (which we will be changing anyways as part of this
71 static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private,
74 /* For updates to the last recieved file */
75 int nblocks = EXT3_SINGLEDATA_TRANS_BLOCKS;
79 if (current->journal_info) {
80 CDEBUG(D_INODE, "increasing refcount on %p\n",
81 current->journal_info);
87 case FSFILT_OP_UNLINK:
88 /* delete one file + create/update logs for each stripe */
89 nblocks += EXT3_DELETE_TRANS_BLOCKS;
90 nblocks += (EXT3_INDEX_EXTRA_TRANS_BLOCKS +
91 EXT3_SINGLEDATA_TRANS_BLOCKS) * logs;
93 case FSFILT_OP_RENAME:
94 /* modify additional directory */
95 nblocks += EXT3_SINGLEDATA_TRANS_BLOCKS;
97 case FSFILT_OP_SYMLINK:
98 /* additional block + block bitmap + GDT for long symlink */
101 case FSFILT_OP_CREATE:
102 /* create/update logs for each stripe */
103 nblocks += (EXT3_INDEX_EXTRA_TRANS_BLOCKS +
104 EXT3_SINGLEDATA_TRANS_BLOCKS) * logs;
106 case FSFILT_OP_MKDIR:
107 case FSFILT_OP_MKNOD:
108 /* modify one inode + block bitmap + GDT */
112 /* modify parent directory */
113 nblocks += EXT3_INDEX_EXTRA_TRANS_BLOCKS +
114 EXT3_DATA_TRANS_BLOCKS;
116 case FSFILT_OP_SETATTR:
117 /* Setattr on inode */
120 case FSFILT_OP_CANCEL_UNLINK:
121 /* blocks for log header bitmap update OR
122 * blocks for catalog header bitmap update + unlink of logs */
123 nblocks = (LLOG_CHUNK_SIZE >> inode->i_blkbits) +
124 EXT3_DELETE_TRANS_BLOCKS * logs;
126 default: CERROR("unknown transaction start op %d\n", op);
130 LASSERT(current->journal_info == desc_private);
131 journal = EXT3_SB(inode->i_sb)->s_journal;
132 if (nblocks > journal->j_max_transaction_buffers) {
133 CERROR("too many credits %d for op %ux%u using %d instead\n",
134 nblocks, op, logs, journal->j_max_transaction_buffers);
135 nblocks = journal->j_max_transaction_buffers;
140 handle = journal_start(EXT3_JOURNAL(inode), nblocks);
144 LASSERT(current->journal_info == handle);
146 CERROR("error starting handle for op %u (%u credits): rc %ld\n",
147 op, nblocks, PTR_ERR(handle));
152 * Calculate the number of buffer credits needed to write multiple pages in
153 * a single ext3 transaction. No, this shouldn't be here, but as yet ext3
154 * doesn't have a nice API for calculating this sort of thing in advance.
156 * See comment above ext3_writepage_trans_blocks for details. We assume
157 * no data journaling is being done, but it does allow for all of the pages
158 * being non-contiguous. If we are guaranteed contiguous pages we could
159 * reduce the number of (d)indirect blocks a lot.
161 * With N blocks per page and P pages, for each inode we have at most:
163 * min(N*P, blocksize/4 + 1) dindirect blocks
166 * For the entire filesystem, we have at most:
167 * min(sum(nindir + P), ngroups) bitmap blocks (from the above)
168 * min(sum(nindir + P), gdblocks) group descriptor blocks (from the above)
169 * objcount inode blocks
171 * 2 * EXT3_SINGLEDATA_TRANS_BLOCKS for the quota files
173 * 1 EXT3_DATA_TRANS_BLOCKS for the last_rcvd update.
175 static int fsfilt_ext3_credits_needed(int objcount, struct fsfilt_objinfo *fso,
176 int niocount, struct niobuf_local *nb)
178 struct super_block *sb = fso->fso_dentry->d_inode->i_sb;
180 const int blockpp = 1 << (PAGE_CACHE_SHIFT - sb->s_blocksize_bits);
181 int nbitmaps = 0, ngdblocks;
182 int needed = objcount + 1; /* inodes + superblock */
185 for (i = 0, j = 0; i < objcount; i++, fso++) {
186 /* two or more dindirect blocks in case we cross boundary */
187 int ndind = (long)((nb[j + fso->fso_bufcnt - 1].offset -
189 sb->s_blocksize_bits) /
190 (EXT3_ADDR_PER_BLOCK(sb) * EXT3_ADDR_PER_BLOCK(sb));
191 nbitmaps += min(fso->fso_bufcnt, ndind > 0 ? ndind : 2);
193 /* leaf, indirect, tindirect blocks for first block */
194 nbitmaps += blockpp + 2;
196 j += fso->fso_bufcnt;
199 next_indir = nb[0].offset +
200 (EXT3_ADDR_PER_BLOCK(sb) << sb->s_blocksize_bits);
201 for (i = 1; i < niocount; i++) {
202 if (nb[i].offset >= next_indir) {
203 nbitmaps++; /* additional indirect */
204 next_indir = nb[i].offset +
205 (EXT3_ADDR_PER_BLOCK(sb)<<sb->s_blocksize_bits);
206 } else if (nb[i].offset != nb[i - 1].offset + sb->s_blocksize) {
207 nbitmaps++; /* additional indirect */
209 nbitmaps += blockpp; /* each leaf in different group? */
212 ngdblocks = nbitmaps;
213 if (nbitmaps > EXT3_SB(sb)->s_groups_count)
214 nbitmaps = EXT3_SB(sb)->s_groups_count;
215 if (ngdblocks > EXT3_SB(sb)->s_gdb_count)
216 ngdblocks = EXT3_SB(sb)->s_gdb_count;
218 needed += nbitmaps + ngdblocks;
220 /* last_rcvd update */
221 needed += EXT3_DATA_TRANS_BLOCKS;
223 #if defined(CONFIG_QUOTA) && !defined(__x86_64__) /* XXX */
224 /* We assume that there will be 1 bit set in s_dquot.flags for each
225 * quota file that is active. This is at least true for now.
227 needed += hweight32(sb_any_quota_enabled(sb)) *
228 EXT3_SINGLEDATA_TRANS_BLOCKS;
234 /* We have to start a huge journal transaction here to hold all of the
235 * metadata for the pages being written here. This is necessitated by
236 * the fact that we do lots of prepare_write operations before we do
237 * any of the matching commit_write operations, so even if we split
238 * up to use "smaller" transactions none of them could complete until
239 * all of them were opened. By having a single journal transaction,
240 * we eliminate duplicate reservations for common blocks like the
241 * superblock and group descriptors or bitmaps.
243 * We will start the transaction here, but each prepare_write will
244 * add a refcount to the transaction, and each commit_write will
245 * remove a refcount. The transaction will be closed when all of
246 * the pages have been written.
248 static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso,
249 int niocount, struct niobuf_local *nb,
250 void *desc_private, int logs)
257 LASSERT(current->journal_info == desc_private);
258 journal = EXT3_SB(fso->fso_dentry->d_inode->i_sb)->s_journal;
259 needed = fsfilt_ext3_credits_needed(objcount, fso, niocount, nb);
261 /* The number of blocks we could _possibly_ dirty can very large.
262 * We reduce our request if it is absurd (and we couldn't get that
263 * many credits for a single handle anyways).
265 * At some point we have to limit the size of I/Os sent at one time,
266 * increase the size of the journal, or we have to calculate the
267 * actual journal requirements more carefully by checking all of
268 * the blocks instead of being maximally pessimistic. It remains to
269 * be seen if this is a real problem or not.
271 if (needed > journal->j_max_transaction_buffers) {
272 CERROR("want too many journal credits (%d) using %d instead\n",
273 needed, journal->j_max_transaction_buffers);
274 needed = journal->j_max_transaction_buffers;
278 handle = journal_start(journal, needed);
280 if (IS_ERR(handle)) {
281 CERROR("can't get handle for %d credits: rc = %ld\n", needed,
284 LASSERT(handle->h_buffer_credits >= needed);
285 LASSERT(current->journal_info == handle);
291 static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
294 handle_t *handle = h;
296 LASSERT(current->journal_info == handle);
298 handle->h_sync = 1; /* recovery likes this */
301 rc = journal_stop(handle);
307 static int fsfilt_ext3_commit_async(struct inode *inode, void *h,
311 transaction_t *transaction;
312 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
315 handle_t *handle = h;
319 LASSERT(current->journal_info == handle);
322 transaction = handle->h_transaction;
323 journal = transaction->t_journal;
324 tid = transaction->t_tid;
325 /* we don't want to be blocked */
327 rc = journal_stop(handle);
329 CERROR("error while stopping transaction: %d\n", rc);
333 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
334 rtid = log_start_commit(journal, transaction);
336 CERROR("strange race: %lu != %lu\n",
337 (unsigned long) tid, (unsigned long) rtid);
339 log_start_commit(journal, transaction->t_tid);
343 *wait_handle = (void *) tid;
344 CDEBUG(D_INODE, "commit async: %lu\n", (unsigned long) tid);
348 static int fsfilt_ext3_commit_wait(struct inode *inode, void *h)
350 tid_t tid = (tid_t)(long)h;
352 CDEBUG(D_INODE, "commit wait: %lu\n", (unsigned long) tid);
353 if (is_journal_aborted(EXT3_JOURNAL(inode)))
356 log_wait_commit(EXT3_JOURNAL(inode), tid);
361 static int fsfilt_ext3_setattr(struct dentry *dentry, void *handle,
362 struct iattr *iattr, int do_trunc)
364 struct inode *inode = dentry->d_inode;
369 /* A _really_ horrible hack to avoid removing the data stored
370 * in the block pointers; this is really the "small" stripe MD data.
371 * We can avoid further hackery by virtue of the MDS file size being
372 * zero all the time (which doesn't invoke block truncate at unlink
373 * time), so we assert we never change the MDS file size from zero. */
374 if (iattr->ia_valid & ATTR_SIZE && !do_trunc) {
375 /* ATTR_SIZE would invoke truncate: clear it */
376 iattr->ia_valid &= ~ATTR_SIZE;
377 EXT3_I(inode)->i_disksize = inode->i_size = iattr->ia_size;
379 /* make sure _something_ gets set - so new inode
380 * goes to disk (probably won't work over XFS */
381 if (!(iattr->ia_valid & (ATTR_MODE | ATTR_MTIME | ATTR_CTIME))){
382 iattr->ia_valid |= ATTR_MODE;
383 iattr->ia_mode = inode->i_mode;
387 /* Don't allow setattr to change file type */
388 iattr->ia_mode = (inode->i_mode & S_IFMT)|(iattr->ia_mode & ~S_IFMT);
390 /* We set these flags on the client, but have already checked perms
391 * so don't confuse inode_change_ok. */
392 iattr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET);
394 if (inode->i_op->setattr) {
395 rc = inode->i_op->setattr(dentry, iattr);
397 rc = inode_change_ok(inode, iattr);
399 rc = inode_setattr(inode, iattr);
407 static int fsfilt_ext3_iocontrol(struct inode * inode, struct file *file,
408 unsigned int cmd, unsigned long arg)
413 if (inode->i_fop->ioctl)
414 rc = inode->i_fop->ioctl(inode, file, cmd, arg);
421 static int fsfilt_ext3_set_md(struct inode *inode, void *handle,
422 void *lmm, int lmm_size)
426 /* keep this when we get rid of OLD_EA (too noisy during conversion) */
427 if (EXT3_I(inode)->i_file_acl /* || large inode EA flag */)
428 CWARN("setting EA on %lu/%u again... interesting\n",
429 inode->i_ino, inode->i_generation);
432 rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED,
433 XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size, 0);
438 CERROR("error adding MD data to inode %lu: rc = %d\n",
443 /* Must be called with i_sem held */
444 static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size)
448 LASSERT(down_trylock(&inode->i_sem) != 0);
451 rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
452 XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size);
455 /* This gives us the MD size */
457 return (rc == -ENODATA) ? 0 : rc;
460 CDEBUG(D_INFO, "error getting EA %d/%s from inode %lu: rc %d\n",
461 EXT3_XATTR_INDEX_TRUSTED, XATTR_LUSTRE_MDS_LOV_EA,
463 memset(lmm, 0, lmm_size);
464 return (rc == -ENODATA) ? 0 : rc;
470 static ssize_t fsfilt_ext3_readpage(struct file *file, char *buf, size_t count,
473 struct inode *inode = file->f_dentry->d_inode;
476 if (S_ISREG(inode->i_mode))
477 rc = file->f_op->read(file, buf, count, off);
479 const int blkbits = inode->i_sb->s_blocksize_bits;
480 const int blksize = inode->i_sb->s_blocksize;
482 CDEBUG(D_EXT2, "reading "LPSZ" at dir %lu+%llu\n",
483 count, inode->i_ino, *off);
485 struct buffer_head *bh;
488 if (*off < inode->i_size) {
491 bh = ext3_bread(NULL, inode, *off >> blkbits,
494 CDEBUG(D_EXT2, "read %u@%llu\n", blksize, *off);
497 memcpy(buf, bh->b_data, blksize);
500 /* XXX in theory we should just fake
501 * this buffer and continue like ext3,
502 * especially if this is a partial read
504 CERROR("error read dir %lu+%llu: %d\n",
505 inode->i_ino, *off, err);
510 struct ext3_dir_entry_2 *fake = (void *)buf;
512 CDEBUG(D_EXT2, "fake %u@%llu\n", blksize, *off);
513 memset(fake, 0, sizeof(*fake));
514 fake->rec_len = cpu_to_le32(blksize);
526 static void fsfilt_ext3_cb_func(struct journal_callback *jcb, int error)
528 struct fsfilt_cb_data *fcb = (struct fsfilt_cb_data *)jcb;
530 fcb->cb_func(fcb->cb_obd, fcb->cb_last_rcvd, fcb->cb_data, error);
532 OBD_SLAB_FREE(fcb, fcb_cache, sizeof *fcb);
533 atomic_dec(&fcb_cache_count);
536 static int fsfilt_ext3_add_journal_cb(struct obd_device *obd, __u64 last_rcvd,
537 void *handle, fsfilt_cb_t cb_func,
540 struct fsfilt_cb_data *fcb;
542 OBD_SLAB_ALLOC(fcb, fcb_cache, GFP_NOFS, sizeof *fcb);
546 atomic_inc(&fcb_cache_count);
547 fcb->cb_func = cb_func;
549 fcb->cb_last_rcvd = last_rcvd;
550 fcb->cb_data = cb_data;
552 CDEBUG(D_EXT2, "set callback for last_rcvd: "LPD64"\n", last_rcvd);
554 journal_callback_set(handle, fsfilt_ext3_cb_func,
555 (struct journal_callback *)fcb);
562 * We need to hack the return value for the free inode counts because
563 * the current EA code requires one filesystem block per inode with EAs,
564 * so it is possible to run out of blocks before we run out of inodes.
566 * This can be removed when the ext3 EA code is fixed.
568 static int fsfilt_ext3_statfs(struct super_block *sb, struct obd_statfs *osfs)
573 memset(&sfs, 0, sizeof(sfs));
575 rc = sb->s_op->statfs(sb, &sfs);
577 if (!rc && sfs.f_bfree < sfs.f_ffree) {
578 sfs.f_files = (sfs.f_files - sfs.f_ffree) + sfs.f_bfree;
579 sfs.f_ffree = sfs.f_bfree;
582 statfs_pack(osfs, &sfs);
586 static int fsfilt_ext3_sync(struct super_block *sb)
588 return ext3_force_commit(sb);
591 extern int ext3_map_inode_page(struct inode *inode, struct page *page,
592 unsigned long *blocks, int *created, int create);
593 int fsfilt_ext3_map_inode_page(struct inode *inode, struct page *page,
594 unsigned long *blocks, int *created, int create)
596 return ext3_map_inode_page(inode, page, blocks, created, create);
599 extern int ext3_prep_san_write(struct inode *inode, long *blocks,
600 int nblocks, loff_t newsize);
601 static int fsfilt_ext3_prep_san_write(struct inode *inode, long *blocks,
602 int nblocks, loff_t newsize)
604 return ext3_prep_san_write(inode, blocks, nblocks, newsize);
607 static int fsfilt_ext3_read_record(struct file * file, void *buf,
608 int size, loff_t *offs)
610 struct inode *inode = file->f_dentry->d_inode;
612 struct buffer_head *bh;
613 int err, blocksize, csize, boffs;
615 /* prevent reading after eof */
617 if (inode->i_size < *offs + size) {
618 size = inode->i_size - *offs;
621 CERROR("size %llu is too short for read %u@%llu\n",
622 inode->i_size, size, *offs);
624 } else if (size == 0) {
631 blocksize = 1 << inode->i_blkbits;
634 block = *offs >> inode->i_blkbits;
635 boffs = *offs & (blocksize - 1);
636 csize = min(blocksize - boffs, size);
637 bh = ext3_bread(NULL, inode, block, 0, &err);
639 CERROR("can't read block: %d\n", err);
643 memcpy(buf, bh->b_data + boffs, csize);
653 static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize,
654 loff_t *offs, int force_sync)
656 struct buffer_head *bh = NULL;
658 struct inode *inode = file->f_dentry->d_inode;
659 loff_t old_size = inode->i_size, offset = *offs;
660 loff_t new_size = inode->i_size;
663 int err, block_count = 0, blocksize, size, boffs;
665 /* Determine how many transaction credits are needed */
666 blocksize = 1 << inode->i_blkbits;
667 block_count = (*offs & (blocksize - 1)) + bufsize;
668 block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
670 journal = EXT3_SB(inode->i_sb)->s_journal;
672 handle = journal_start(journal,
673 block_count * EXT3_DATA_TRANS_BLOCKS + 2);
675 if (IS_ERR(handle)) {
676 CERROR("can't start transaction\n");
677 return PTR_ERR(handle);
680 while (bufsize > 0) {
684 block = offset >> inode->i_blkbits;
685 boffs = offset & (blocksize - 1);
686 size = min(blocksize - boffs, bufsize);
687 bh = ext3_bread(handle, inode, block, 1, &err);
689 CERROR("can't read/create block: %d\n", err);
693 err = ext3_journal_get_write_access(handle, bh);
695 CERROR("journal_get_write_access() returned error %d\n",
699 LASSERT(bh->b_data + boffs + size <= bh->b_data + bh->b_size);
700 memcpy(bh->b_data + boffs, buf, size);
701 err = ext3_journal_dirty_metadata(handle, bh);
703 CERROR("journal_dirty_metadata() returned error %d\n",
707 if (offset + size > new_size)
708 new_size = offset + size;
715 handle->h_sync = 1; /* recovery likes this */
720 /* correct in-core and on-disk sizes */
721 if (new_size > inode->i_size) {
723 if (new_size > inode->i_size)
724 inode->i_size = new_size;
725 if (inode->i_size > EXT3_I(inode)->i_disksize)
726 EXT3_I(inode)->i_disksize = inode->i_size;
727 if (inode->i_size > old_size)
728 mark_inode_dirty(inode);
733 journal_stop(handle);
741 static int fsfilt_ext3_setup(struct super_block *sb)
744 EXT3_SB(sb)->dx_lock = fsfilt_ext3_dx_lock;
745 EXT3_SB(sb)->dx_unlock = fsfilt_ext3_dx_unlock;
748 CWARN("Enabling PDIROPS\n");
749 set_opt(EXT3_SB(sb)->s_mount_opt, PDIROPS);
750 sb->s_flags |= S_PDIROPS;
755 /* If fso is NULL, op is FSFILT operation, otherwise op is number of fso
756 objects. Logs is number of logfiles to update */
757 static int fsfilt_ext3_get_op_len(int op, struct fsfilt_objinfo *fso, int logs)
761 case FSFILT_OP_CREATE:
762 /* directory leaf, index & indirect & EA*/
764 case FSFILT_OP_UNLINK:
770 struct super_block *sb = fso->fso_dentry->d_inode->i_sb;
771 int blockpp = 1 << (PAGE_CACHE_SHIFT - sb->s_blocksize_bits);
772 int addrpp = EXT3_ADDR_PER_BLOCK(sb) * blockpp;
773 for (i = 0; i < op; i++, fso++) {
774 int nblocks = fso->fso_bufcnt * blockpp;
775 int ndindirect = min(nblocks, addrpp + 1);
776 int nindir = nblocks + ndindirect + 1;
780 return needed + 3 * logs;
786 static struct fsfilt_operations fsfilt_ext3_ops = {
788 .fs_owner = THIS_MODULE,
789 .fs_start = fsfilt_ext3_start,
790 .fs_brw_start = fsfilt_ext3_brw_start,
791 .fs_commit = fsfilt_ext3_commit,
792 .fs_commit_async = fsfilt_ext3_commit_async,
793 .fs_commit_wait = fsfilt_ext3_commit_wait,
794 .fs_setattr = fsfilt_ext3_setattr,
795 .fs_iocontrol = fsfilt_ext3_iocontrol,
796 .fs_set_md = fsfilt_ext3_set_md,
797 .fs_get_md = fsfilt_ext3_get_md,
798 .fs_readpage = fsfilt_ext3_readpage,
799 .fs_add_journal_cb = fsfilt_ext3_add_journal_cb,
800 .fs_statfs = fsfilt_ext3_statfs,
801 .fs_sync = fsfilt_ext3_sync,
802 .fs_map_inode_page = fsfilt_ext3_map_inode_page,
803 .fs_prep_san_write = fsfilt_ext3_prep_san_write,
804 .fs_write_record = fsfilt_ext3_write_record,
805 .fs_read_record = fsfilt_ext3_read_record,
806 .fs_setup = fsfilt_ext3_setup,
807 .fs_get_op_len = fsfilt_ext3_get_op_len,
810 static int __init fsfilt_ext3_init(void)
814 //rc = ext3_xattr_register();
815 fcb_cache = kmem_cache_create("fsfilt_ext3_fcb",
816 sizeof(struct fsfilt_cb_data), 0,
819 CERROR("error allocating fsfilt journal callback cache\n");
820 GOTO(out, rc = -ENOMEM);
823 rc = fsfilt_register_ops(&fsfilt_ext3_ops);
826 kmem_cache_destroy(fcb_cache);
831 static void __exit fsfilt_ext3_exit(void)
835 fsfilt_unregister_ops(&fsfilt_ext3_ops);
836 rc = kmem_cache_destroy(fcb_cache);
838 if (rc || atomic_read(&fcb_cache_count)) {
839 CERROR("can't free fsfilt callback cache: count %d, rc = %d\n",
840 atomic_read(&fcb_cache_count), rc);
843 //rc = ext3_xattr_unregister();
846 module_init(fsfilt_ext3_init);
847 module_exit(fsfilt_ext3_exit);
849 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
850 MODULE_DESCRIPTION("Lustre ext3 Filesystem Helper v0.1");
851 MODULE_LICENSE("GPL");