#include <linux/slab.h>
#include <linux/string.h>
#include <linux/lustre_idl.h>
-#include <portals/list.h>
+#include <libcfs/list.h>
#include <linux/obd_class.h>
#include <linux/obd_support.h>
#include <linux/lustre_lib.h>
iops->listxattr = cache_iops->listxattr;
if (cache_inode->i_op->removexattr)
iops->removexattr = cache_iops->removexattr;
+#if HAVE_LOOKUP_RAW
+ if (cache_inode->i_op->lookup_raw)
+ iops->lookup_raw = cache_iops->lookup_raw;
+#endif
}
}
unlock_kernel();
}
-static void setup_sm_sb_ops(struct super_block *cache_sb, struct super_block *sb,
- struct super_operations *smfs_sops)
+
+void sm_set_inode_ops(struct inode *cache_inode, struct inode *inode)
{
- struct smfs_super_info *smb;
- struct super_operations *sops;
+ struct smfs_super_info *smb = S2SMI(inode->i_sb);
- ENTRY;
+ /* XXX now set the correct sm_{file,dir,sym}_iops */
+ if (S_ISDIR(inode->i_mode)) {
+ setup_sm_dir_ops(cache_inode, inode,
+ &smfs_dir_iops,
+ &smfs_dir_fops);
+ inode->i_op = cache_diops(smb);
+ inode->i_fop = cache_dfops(smb);
+ } else if (S_ISREG(inode->i_mode)) {
+ setup_sm_file_ops(cache_inode, inode,
+ &smfs_file_iops,
+ &smfs_file_fops);
+ CDEBUG(D_INODE, "inode %lu, i_op at %p\n",
+ inode->i_ino, inode->i_op);
+ inode->i_fop = cache_ffops(smb);
+ inode->i_op = cache_fiops(smb);
+
+ } else if (S_ISLNK(inode->i_mode)) {
+ setup_sm_symlink_ops(cache_inode, inode,
+ &smfs_sym_iops,
+ &smfs_sym_fops);
+ inode->i_op = cache_siops(smb);
+ inode->i_fop = cache_sfops(smb);
+ CDEBUG(D_INODE, "inode %lu, i_op at %p\n",
+ inode->i_ino, inode->i_op);
+ }
+}
- smb = S2SMI(sb);
+
+void sm_set_sb_ops(struct super_block *cache_sb, struct super_block *sb)
+{
+ struct smfs_super_info *smb = S2SMI(sb);
+ struct super_operations *sops = &smb->sm_ops->sm_sb_ops;
+ struct super_operations *smfs_sops = &smfs_super_ops;
+ ENTRY;
if (smb->smsi_ops_check & SB_OPS_CHECK)
return;
-
- sops = cache_sops(smb);
+
+ //set up only operations exist in backfs
memset(sops, 0, sizeof (struct super_operations));
-
if (cache_sb->s_op) {
if (cache_sb->s_op->dirty_inode)
sops->dirty_inode = smfs_sops->dirty_inode;
if (cache_sb->s_op->write_inode)
sops->write_inode = smfs_sops->write_inode;
- if (cache_sb->s_op->put_inode)
- sops->put_inode = smfs_sops->put_inode;
- if (cache_sb->s_op->delete_inode)
- sops->delete_inode = smfs_sops->delete_inode;
if (cache_sb->s_op->put_super)
sops->put_super = smfs_sops->put_super;
if (cache_sb->s_op->write_super)
sops->statfs = smfs_sops->statfs;
if (cache_sb->s_op->remount_fs)
sops->remount_fs = smfs_sops->remount_fs;
- if (cache_sb->s_op->umount_begin)
- sops->umount_begin = smfs_sops->umount_begin;
+ //if (cache_sb->s_op->umount_begin)
+ // sops->umount_begin = smfs_sops->umount_begin;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
if (cache_sb->s_op->fh_to_dentry)
sops->dentry_to_fh = smfs_sops->dentry_to_fh;
if (cache_sb->s_op->show_options)
sops->show_options = smfs_sops->show_options;
+
sops->read_inode2 = smfs_sops->read_inode2;
#endif
- /* FIXME-WANGDI we need this method to clear the cache inode. */
+ /* these ops are needed always */
sops->clear_inode = smfs_sops->clear_inode;
+ sops->delete_inode = smfs_sops->delete_inode;
+
}
lock_kernel();
smb->smsi_ops_check |= SB_OPS_CHECK;
unlock_kernel();
+ sb->s_op = sops;
return;
}
-void sm_set_inode_ops(struct inode *cache_inode, struct inode *inode)
-{
- struct smfs_super_info *smb = S2SMI(inode->i_sb);
-
- /* XXX now set the correct sm_{file,dir,sym}_iops */
- if (S_ISDIR(inode->i_mode)) {
- setup_sm_dir_ops(cache_inode, inode,
- &smfs_dir_iops,
- &smfs_dir_fops);
- inode->i_op = cache_diops(smb);
- inode->i_fop = cache_dfops(smb);
- } else if (S_ISREG(inode->i_mode)) {
- setup_sm_file_ops(cache_inode, inode,
- &smfs_file_iops,
- &smfs_file_fops);
- CDEBUG(D_INODE, "inode %lu, i_op at %p\n",
- inode->i_ino, inode->i_op);
- inode->i_fop = cache_ffops(smb);
- inode->i_op = cache_fiops(smb);
-
- } else if (S_ISLNK(inode->i_mode)) {
- setup_sm_symlink_ops(cache_inode, inode,
- &smfs_sym_iops,
- &smfs_sym_fops);
- inode->i_op = cache_siops(smb);
- inode->i_fop = cache_sfops(smb);
- CDEBUG(D_INODE, "inode %lu, i_op at %p\n",
- inode->i_ino, inode->i_op);
- }
-}
-
-void sm_set_sb_ops(struct super_block *cache_sb, struct super_block *sb)
-{
- struct smfs_super_info *smb;
-
- smb = S2SMI(sb);
-
- setup_sm_sb_ops(cache_sb, sb, &smfs_super_ops);
-
- sb->s_op = cache_sops(smb);
- return;
-}