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>
39 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
40 #include <linux/ext3_xattr.h>
43 * our build flags set -I$LINUX/fs and -I$LUSTRE so that ext3 and
44 * ldiskfs work correctly
46 #include <ext3/xattr.h>
48 #include <linux/kp30.h>
49 #include <linux/lustre_fsfilt.h>
50 #include <linux/obd.h>
51 #include <linux/obd_class.h>
53 static kmem_cache_t *fcb_cache;
54 static atomic_t fcb_cache_count = ATOMIC_INIT(0);
56 struct fsfilt_cb_data {
57 struct journal_callback cb_jcb; /* jbd private data - MUST BE FIRST */
58 fsfilt_cb_t cb_func; /* MDS/OBD completion function */
59 struct obd_device *cb_obd; /* MDS/OBD completion device */
60 __u64 cb_last_rcvd; /* MDS/OST last committed operation */
61 void *cb_data; /* MDS/OST completion function data */
64 #ifndef EXT3_XATTR_INDEX_TRUSTED /* temporary until we hit l28 kernel */
65 #define EXT3_XATTR_INDEX_TRUSTED 4
67 #define XATTR_LUSTRE_MDS_LOV_EA "lov"
70 * We don't currently need any additional blocks for rmdir and
71 * unlink transactions because we are storing the OST oa_id inside
72 * the inode (which we will be changing anyways as part of this
75 static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private,
78 /* For updates to the last recieved file */
79 int nblocks = EXT3_SINGLEDATA_TRANS_BLOCKS;
83 if (current->journal_info) {
84 CDEBUG(D_INODE, "increasing refcount on %p\n",
85 current->journal_info);
91 case FSFILT_OP_UNLINK:
92 /* delete one file + create/update logs for each stripe */
93 nblocks += EXT3_DELETE_TRANS_BLOCKS;
94 nblocks += (EXT3_INDEX_EXTRA_TRANS_BLOCKS +
95 EXT3_SINGLEDATA_TRANS_BLOCKS) * logs;
97 case FSFILT_OP_RENAME:
98 /* modify additional directory */
99 nblocks += EXT3_SINGLEDATA_TRANS_BLOCKS;
101 case FSFILT_OP_SYMLINK:
102 /* additional block + block bitmap + GDT for long symlink */
105 case FSFILT_OP_CREATE:
106 /* create/update logs for each stripe */
107 nblocks += (EXT3_INDEX_EXTRA_TRANS_BLOCKS +
108 EXT3_SINGLEDATA_TRANS_BLOCKS) * logs;
110 case FSFILT_OP_MKDIR:
111 case FSFILT_OP_MKNOD:
112 /* modify one inode + block bitmap + GDT */
116 /* modify parent directory */
117 nblocks += EXT3_INDEX_EXTRA_TRANS_BLOCKS +
118 EXT3_DATA_TRANS_BLOCKS;
120 case FSFILT_OP_SETATTR:
121 /* Setattr on inode */
124 case FSFILT_OP_CANCEL_UNLINK:
125 /* blocks for log header bitmap update OR
126 * blocks for catalog header bitmap update + unlink of logs */
127 nblocks = (LLOG_CHUNK_SIZE >> inode->i_blkbits) +
128 EXT3_DELETE_TRANS_BLOCKS * logs;
130 default: CERROR("unknown transaction start op %d\n", op);
134 LASSERT(current->journal_info == desc_private);
135 journal = EXT3_SB(inode->i_sb)->s_journal;
136 if (nblocks > journal->j_max_transaction_buffers) {
137 CERROR("too many credits %d for op %ux%u using %d instead\n",
138 nblocks, op, logs, journal->j_max_transaction_buffers);
139 nblocks = journal->j_max_transaction_buffers;
144 handle = journal_start(EXT3_JOURNAL(inode), nblocks);
148 LASSERT(current->journal_info == handle);
150 CERROR("error starting handle for op %u (%u credits): rc %ld\n",
151 op, nblocks, PTR_ERR(handle));
156 * Calculate the number of buffer credits needed to write multiple pages in
157 * a single ext3 transaction. No, this shouldn't be here, but as yet ext3
158 * doesn't have a nice API for calculating this sort of thing in advance.
160 * See comment above ext3_writepage_trans_blocks for details. We assume
161 * no data journaling is being done, but it does allow for all of the pages
162 * being non-contiguous. If we are guaranteed contiguous pages we could
163 * reduce the number of (d)indirect blocks a lot.
165 * With N blocks per page and P pages, for each inode we have at most:
167 * min(N*P, blocksize/4 + 1) dindirect blocks
170 * For the entire filesystem, we have at most:
171 * min(sum(nindir + P), ngroups) bitmap blocks (from the above)
172 * min(sum(nindir + P), gdblocks) group descriptor blocks (from the above)
173 * objcount inode blocks
175 * 2 * EXT3_SINGLEDATA_TRANS_BLOCKS for the quota files
177 * 1 EXT3_DATA_TRANS_BLOCKS for the last_rcvd update.
179 static int fsfilt_ext3_credits_needed(int objcount, struct fsfilt_objinfo *fso,
180 int niocount, struct niobuf_local *nb)
182 struct super_block *sb = fso->fso_dentry->d_inode->i_sb;
184 const int blockpp = 1 << (PAGE_CACHE_SHIFT - sb->s_blocksize_bits);
185 int nbitmaps = 0, ngdblocks;
186 int needed = objcount + 1; /* inodes + superblock */
189 for (i = 0, j = 0; i < objcount; i++, fso++) {
190 /* two or more dindirect blocks in case we cross boundary */
191 int ndind = (long)((nb[j + fso->fso_bufcnt - 1].offset -
193 sb->s_blocksize_bits) /
194 (EXT3_ADDR_PER_BLOCK(sb) * EXT3_ADDR_PER_BLOCK(sb));
195 nbitmaps += min(fso->fso_bufcnt, ndind > 0 ? ndind : 2);
197 /* leaf, indirect, tindirect blocks for first block */
198 nbitmaps += blockpp + 2;
200 j += fso->fso_bufcnt;
203 next_indir = nb[0].offset +
204 (EXT3_ADDR_PER_BLOCK(sb) << sb->s_blocksize_bits);
205 for (i = 1; i < niocount; i++) {
206 if (nb[i].offset >= next_indir) {
207 nbitmaps++; /* additional indirect */
208 next_indir = nb[i].offset +
209 (EXT3_ADDR_PER_BLOCK(sb)<<sb->s_blocksize_bits);
210 } else if (nb[i].offset != nb[i - 1].offset + sb->s_blocksize) {
211 nbitmaps++; /* additional indirect */
213 nbitmaps += blockpp; /* each leaf in different group? */
216 ngdblocks = nbitmaps;
217 if (nbitmaps > EXT3_SB(sb)->s_groups_count)
218 nbitmaps = EXT3_SB(sb)->s_groups_count;
219 if (ngdblocks > EXT3_SB(sb)->s_gdb_count)
220 ngdblocks = EXT3_SB(sb)->s_gdb_count;
222 needed += nbitmaps + ngdblocks;
224 /* last_rcvd update */
225 needed += EXT3_DATA_TRANS_BLOCKS;
227 #if defined(CONFIG_QUOTA) && !defined(__x86_64__) /* XXX */
228 /* We assume that there will be 1 bit set in s_dquot.flags for each
229 * quota file that is active. This is at least true for now.
231 needed += hweight32(sb_any_quota_enabled(sb)) *
232 EXT3_SINGLEDATA_TRANS_BLOCKS;
238 /* We have to start a huge journal transaction here to hold all of the
239 * metadata for the pages being written here. This is necessitated by
240 * the fact that we do lots of prepare_write operations before we do
241 * any of the matching commit_write operations, so even if we split
242 * up to use "smaller" transactions none of them could complete until
243 * all of them were opened. By having a single journal transaction,
244 * we eliminate duplicate reservations for common blocks like the
245 * superblock and group descriptors or bitmaps.
247 * We will start the transaction here, but each prepare_write will
248 * add a refcount to the transaction, and each commit_write will
249 * remove a refcount. The transaction will be closed when all of
250 * the pages have been written.
252 static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso,
253 int niocount, struct niobuf_local *nb,
254 void *desc_private, int logs)
261 LASSERT(current->journal_info == desc_private);
262 journal = EXT3_SB(fso->fso_dentry->d_inode->i_sb)->s_journal;
263 needed = fsfilt_ext3_credits_needed(objcount, fso, niocount, nb);
265 /* The number of blocks we could _possibly_ dirty can very large.
266 * We reduce our request if it is absurd (and we couldn't get that
267 * many credits for a single handle anyways).
269 * At some point we have to limit the size of I/Os sent at one time,
270 * increase the size of the journal, or we have to calculate the
271 * actual journal requirements more carefully by checking all of
272 * the blocks instead of being maximally pessimistic. It remains to
273 * be seen if this is a real problem or not.
275 if (needed > journal->j_max_transaction_buffers) {
276 CERROR("want too many journal credits (%d) using %d instead\n",
277 needed, journal->j_max_transaction_buffers);
278 needed = journal->j_max_transaction_buffers;
282 handle = journal_start(journal, needed);
284 if (IS_ERR(handle)) {
285 CERROR("can't get handle for %d credits: rc = %ld\n", needed,
288 LASSERT(handle->h_buffer_credits >= needed);
289 LASSERT(current->journal_info == handle);
295 static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
298 handle_t *handle = h;
300 LASSERT(current->journal_info == handle);
302 handle->h_sync = 1; /* recovery likes this */
305 rc = journal_stop(handle);
308 // LASSERT(current->journal_info == NULL);
312 static int fsfilt_ext3_commit_async(struct inode *inode, void *h,
315 transaction_t *transaction;
316 unsigned long tid, rtid;
317 handle_t *handle = h;
321 LASSERT(current->journal_info == handle);
324 transaction = handle->h_transaction;
325 journal = transaction->t_journal;
326 tid = transaction->t_tid;
327 /* we don't want to be blocked */
329 rc = journal_stop(handle);
331 CERROR("error while stopping transaction: %d\n", rc);
335 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
336 rtid = log_start_commit(journal, transaction);
338 CERROR("strange race: %lu != %lu\n",
339 (unsigned long) tid, (unsigned long) rtid);
341 log_start_commit(journal, transaction->t_tid);
345 *wait_handle = (void *) tid;
346 CDEBUG(D_INODE, "commit async: %lu\n", (unsigned long) tid);
350 static int fsfilt_ext3_commit_wait(struct inode *inode, void *h)
352 tid_t tid = (tid_t)(long)h;
354 CDEBUG(D_INODE, "commit wait: %lu\n", (unsigned long) tid);
355 if (is_journal_aborted(EXT3_JOURNAL(inode)))
358 log_wait_commit(EXT3_JOURNAL(inode), tid);
363 static int fsfilt_ext3_setattr(struct dentry *dentry, void *handle,
364 struct iattr *iattr, int do_trunc)
366 struct inode *inode = dentry->d_inode;
371 /* A _really_ horrible hack to avoid removing the data stored
372 * in the block pointers; this is really the "small" stripe MD data.
373 * We can avoid further hackery by virtue of the MDS file size being
374 * zero all the time (which doesn't invoke block truncate at unlink
375 * time), so we assert we never change the MDS file size from zero. */
376 if (iattr->ia_valid & ATTR_SIZE && !do_trunc) {
377 /* ATTR_SIZE would invoke truncate: clear it */
378 iattr->ia_valid &= ~ATTR_SIZE;
379 EXT3_I(inode)->i_disksize = inode->i_size = iattr->ia_size;
381 /* make sure _something_ gets set - so new inode
382 * goes to disk (probably won't work over XFS */
383 if (!(iattr->ia_valid & (ATTR_MODE | ATTR_MTIME | ATTR_CTIME))){
384 iattr->ia_valid |= ATTR_MODE;
385 iattr->ia_mode = inode->i_mode;
389 /* Don't allow setattr to change file type */
390 iattr->ia_mode = (inode->i_mode & S_IFMT)|(iattr->ia_mode & ~S_IFMT);
392 /* We set these flags on the client, but have already checked perms
393 * so don't confuse inode_change_ok. */
394 iattr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET);
396 if (inode->i_op->setattr) {
397 rc = inode->i_op->setattr(dentry, iattr);
399 rc = inode_change_ok(inode, iattr);
401 rc = inode_setattr(inode, iattr);
409 static int fsfilt_ext3_iocontrol(struct inode * inode, struct file *file,
410 unsigned int cmd, unsigned long arg)
415 if (inode->i_fop->ioctl)
416 rc = inode->i_fop->ioctl(inode, file, cmd, arg);
423 static int fsfilt_ext3_set_md(struct inode *inode, void *handle,
424 void *lmm, int lmm_size)
428 /* keep this when we get rid of OLD_EA (too noisy during conversion) */
429 if (EXT3_I(inode)->i_file_acl /* || large inode EA flag */)
430 CWARN("setting EA on %lu/%u again... interesting\n",
431 inode->i_ino, inode->i_generation);
434 rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED,
435 XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size, 0);
440 CERROR("error adding MD data to inode %lu: rc = %d\n",
445 /* Must be called with i_sem held */
446 static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size)
450 LASSERT(down_trylock(&inode->i_sem) != 0);
453 rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
454 XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size);
457 /* This gives us the MD size */
459 return (rc == -ENODATA) ? 0 : rc;
462 CDEBUG(D_INFO, "error getting EA %d/%s from inode %lu: rc %d\n",
463 EXT3_XATTR_INDEX_TRUSTED, XATTR_LUSTRE_MDS_LOV_EA,
465 memset(lmm, 0, lmm_size);
466 return (rc == -ENODATA) ? 0 : rc;
472 static ssize_t fsfilt_ext3_readpage(struct file *file, char *buf, size_t count,
475 struct inode *inode = file->f_dentry->d_inode;
478 if (S_ISREG(inode->i_mode))
479 rc = file->f_op->read(file, buf, count, off);
481 const int blkbits = inode->i_sb->s_blocksize_bits;
482 const int blksize = inode->i_sb->s_blocksize;
484 CDEBUG(D_EXT2, "reading "LPSZ" at dir %lu+%llu\n",
485 count, inode->i_ino, *off);
487 struct buffer_head *bh;
490 if (*off < inode->i_size) {
493 bh = ext3_bread(NULL, inode, *off >> blkbits,
496 CDEBUG(D_EXT2, "read %u@%llu\n", blksize, *off);
499 memcpy(buf, bh->b_data, blksize);
502 /* XXX in theory we should just fake
503 * this buffer and continue like ext3,
504 * especially if this is a partial read
506 CERROR("error read dir %lu+%llu: %d\n",
507 inode->i_ino, *off, err);
512 struct ext3_dir_entry_2 *fake = (void *)buf;
514 CDEBUG(D_EXT2, "fake %u@%llu\n", blksize, *off);
515 memset(fake, 0, sizeof(*fake));
516 fake->rec_len = cpu_to_le32(blksize);
528 static void fsfilt_ext3_cb_func(struct journal_callback *jcb, int error)
530 struct fsfilt_cb_data *fcb = (struct fsfilt_cb_data *)jcb;
532 fcb->cb_func(fcb->cb_obd, fcb->cb_last_rcvd, fcb->cb_data, error);
534 OBD_SLAB_FREE(fcb, fcb_cache, sizeof *fcb);
535 atomic_dec(&fcb_cache_count);
538 static int fsfilt_ext3_add_journal_cb(struct obd_device *obd, __u64 last_rcvd,
539 void *handle, fsfilt_cb_t cb_func,
542 struct fsfilt_cb_data *fcb;
544 OBD_SLAB_ALLOC(fcb, fcb_cache, GFP_NOFS, sizeof *fcb);
548 atomic_inc(&fcb_cache_count);
549 fcb->cb_func = cb_func;
551 fcb->cb_last_rcvd = last_rcvd;
552 fcb->cb_data = cb_data;
554 CDEBUG(D_EXT2, "set callback for last_rcvd: "LPD64"\n", last_rcvd);
556 journal_callback_set(handle, fsfilt_ext3_cb_func,
557 (struct journal_callback *)fcb);
564 * We need to hack the return value for the free inode counts because
565 * the current EA code requires one filesystem block per inode with EAs,
566 * so it is possible to run out of blocks before we run out of inodes.
568 * This can be removed when the ext3 EA code is fixed.
570 static int fsfilt_ext3_statfs(struct super_block *sb, struct obd_statfs *osfs)
575 memset(&sfs, 0, sizeof(sfs));
577 rc = sb->s_op->statfs(sb, &sfs);
579 if (!rc && sfs.f_bfree < sfs.f_ffree) {
580 sfs.f_files = (sfs.f_files - sfs.f_ffree) + sfs.f_bfree;
581 sfs.f_ffree = sfs.f_bfree;
584 statfs_pack(osfs, &sfs);
588 static int fsfilt_ext3_sync(struct super_block *sb)
590 return ext3_force_commit(sb);
593 extern int ext3_map_inode_page(struct inode *inode, struct page *page,
594 unsigned long *blocks, int *created, int create);
595 int fsfilt_ext3_map_inode_page(struct inode *inode, struct page *page,
596 unsigned long *blocks, int *created, int create)
598 return ext3_map_inode_page(inode, page, blocks, created, create);
601 extern int ext3_prep_san_write(struct inode *inode, long *blocks,
602 int nblocks, loff_t newsize);
603 static int fsfilt_ext3_prep_san_write(struct inode *inode, long *blocks,
604 int nblocks, loff_t newsize)
606 return ext3_prep_san_write(inode, blocks, nblocks, newsize);
609 static int fsfilt_ext3_read_record(struct file * file, void *buf,
610 int size, loff_t *offs)
612 struct inode *inode = file->f_dentry->d_inode;
614 struct buffer_head *bh;
615 int err, blocksize, csize, boffs;
617 /* prevent reading after eof */
619 if (inode->i_size < *offs + size) {
620 size = inode->i_size - *offs;
623 CERROR("size %llu is too short for read %u@%llu\n",
624 inode->i_size, size, *offs);
626 } else if (size == 0) {
633 blocksize = 1 << inode->i_blkbits;
636 block = *offs >> inode->i_blkbits;
637 boffs = *offs & (blocksize - 1);
638 csize = min(blocksize - boffs, size);
639 bh = ext3_bread(NULL, inode, block, 0, &err);
641 CERROR("can't read block: %d\n", err);
645 memcpy(buf, bh->b_data + boffs, csize);
655 static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize,
656 loff_t *offs, int force_sync)
658 struct buffer_head *bh = NULL;
660 struct inode *inode = file->f_dentry->d_inode;
661 loff_t old_size = inode->i_size, offset = *offs;
662 loff_t new_size = inode->i_size;
665 int err, block_count = 0, blocksize, size, boffs;
667 /* Determine how many transaction credits are needed */
668 blocksize = 1 << inode->i_blkbits;
669 block_count = (*offs & (blocksize - 1)) + bufsize;
670 block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
672 journal = EXT3_SB(inode->i_sb)->s_journal;
674 handle = journal_start(journal,
675 block_count * EXT3_DATA_TRANS_BLOCKS + 2);
677 if (IS_ERR(handle)) {
678 CERROR("can't start transaction\n");
679 return PTR_ERR(handle);
682 while (bufsize > 0) {
686 block = offset >> inode->i_blkbits;
687 boffs = offset & (blocksize - 1);
688 size = min(blocksize - boffs, bufsize);
689 bh = ext3_bread(handle, inode, block, 1, &err);
691 CERROR("can't read/create block: %d\n", err);
695 err = ext3_journal_get_write_access(handle, bh);
697 CERROR("journal_get_write_access() returned error %d\n",
701 LASSERT(bh->b_data + boffs + size <= bh->b_data + bh->b_size);
702 memcpy(bh->b_data + boffs, buf, size);
703 err = ext3_journal_dirty_metadata(handle, bh);
705 CERROR("journal_dirty_metadata() returned error %d\n",
709 if (offset + size > new_size)
710 new_size = offset + size;
717 handle->h_sync = 1; /* recovery likes this */
722 /* correct in-core and on-disk sizes */
723 if (new_size > inode->i_size) {
725 if (new_size > inode->i_size)
726 inode->i_size = new_size;
727 if (inode->i_size > EXT3_I(inode)->i_disksize)
728 EXT3_I(inode)->i_disksize = inode->i_size;
729 if (inode->i_size > old_size)
730 mark_inode_dirty(inode);
735 journal_stop(handle);
743 static int fsfilt_ext3_setup(struct super_block *sb)
746 EXT3_SB(sb)->dx_lock = fsfilt_ext3_dx_lock;
747 EXT3_SB(sb)->dx_unlock = fsfilt_ext3_dx_unlock;
750 CWARN("Enabling PDIROPS\n");
751 set_opt(EXT3_SB(sb)->s_mount_opt, PDIROPS);
752 sb->s_flags |= S_PDIROPS;
757 /* If fso is NULL, op is FSFILT operation, otherwise op is number of fso
758 objects. Logs is number of logfiles to update */
759 static int fsfilt_ext3_get_op_len(int op, struct fsfilt_objinfo *fso, int logs)
763 case FSFILT_OP_CREATE:
764 /* directory leaf, index & indirect & EA*/
766 case FSFILT_OP_UNLINK:
772 struct super_block *sb = fso->fso_dentry->d_inode->i_sb;
773 int blockpp = 1 << (PAGE_CACHE_SHIFT - sb->s_blocksize_bits);
774 int addrpp = EXT3_ADDR_PER_BLOCK(sb) * blockpp;
775 for (i = 0; i < op; i++, fso++) {
776 int nblocks = fso->fso_bufcnt * blockpp;
777 int ndindirect = min(nblocks, addrpp + 1);
778 int nindir = nblocks + ndindirect + 1;
782 return needed + 3 * logs;
788 static struct fsfilt_operations fsfilt_ext3_ops = {
790 fs_owner: THIS_MODULE,
791 fs_start: fsfilt_ext3_start,
792 fs_brw_start: fsfilt_ext3_brw_start,
793 fs_commit: fsfilt_ext3_commit,
794 fs_commit_async: fsfilt_ext3_commit_async,
795 fs_commit_wait: fsfilt_ext3_commit_wait,
796 fs_setattr: fsfilt_ext3_setattr,
797 fs_iocontrol: fsfilt_ext3_iocontrol,
798 fs_set_md: fsfilt_ext3_set_md,
799 fs_get_md: fsfilt_ext3_get_md,
800 fs_readpage: fsfilt_ext3_readpage,
801 fs_add_journal_cb: fsfilt_ext3_add_journal_cb,
802 fs_statfs: fsfilt_ext3_statfs,
803 fs_sync: fsfilt_ext3_sync,
804 fs_map_inode_page: fsfilt_ext3_map_inode_page,
805 fs_prep_san_write: fsfilt_ext3_prep_san_write,
806 fs_write_record: fsfilt_ext3_write_record,
807 fs_read_record: fsfilt_ext3_read_record,
808 fs_setup: fsfilt_ext3_setup,
809 fs_get_op_len: fsfilt_ext3_get_op_len,
812 static int __init fsfilt_ext3_init(void)
816 //rc = ext3_xattr_register();
817 fcb_cache = kmem_cache_create("fsfilt_ext3_fcb",
818 sizeof(struct fsfilt_cb_data), 0,
821 CERROR("error allocating fsfilt journal callback cache\n");
822 GOTO(out, rc = -ENOMEM);
825 rc = fsfilt_register_ops(&fsfilt_ext3_ops);
828 kmem_cache_destroy(fcb_cache);
833 static void __exit fsfilt_ext3_exit(void)
837 fsfilt_unregister_ops(&fsfilt_ext3_ops);
838 rc = kmem_cache_destroy(fcb_cache);
840 if (rc || atomic_read(&fcb_cache_count)) {
841 CERROR("can't free fsfilt callback cache: count %d, rc = %d\n",
842 atomic_read(&fcb_cache_count), rc);
845 //rc = ext3_xattr_unregister();
848 module_init(fsfilt_ext3_init);
849 module_exit(fsfilt_ext3_exit);
851 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
852 MODULE_DESCRIPTION("Lustre ext3 Filesystem Helper v0.1");
853 MODULE_LICENSE("GPL");