int fso_bufcnt;
};
+/* lustre EA type (MEA, LOV, etc.) */
+enum ea_type {
+ EA_LOV = (1 << 0),
+ EA_MEA = (1 << 1),
+ EA_SID = (1 << 2),
+ EA_KEY = (1 << 3),
+ EA_PID = (1 << 4),
+};
+
+#define XATTR_LUSTRE_MDS_LOV_EA "lov"
+#define XATTR_LUSTRE_MDS_MEA_EA "mea"
+#define XATTR_LUSTRE_MDS_SID_EA "sid"
+#define XATTR_LUSTRE_MDS_KEY_EA "key"
+#define XATTR_LUSTRE_MDS_PID_EA "pid"
+
struct fsfilt_operations {
struct list_head fs_list;
struct module *fs_owner;
char *fs_type;
+
void *(* fs_start)(struct inode *inode, int op, void *desc_private,
int logs);
void *(* fs_brw_start)(int objcount, struct fsfilt_objinfo *fso,
struct iattr *iattr, int do_trunc);
int (* fs_iocontrol)(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
+
+ /* two methods for setting getting diff. kind of EAs from inode. */
int (* fs_set_md)(struct inode *inode, void *handle, void *md,
- int size);
- int (* fs_get_md)(struct inode *inode, void *md, int size);
-
- /* this method is needed to make IO operation fsfilt nature depend. */
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- int (* fs_send_bio)(struct inode *inode, struct bio *bio);
-#else
- int (* fs_send_bio)(struct inode *inode, struct kiobuf *bio);
-#endif
+ int size, enum ea_type type);
+ int (* fs_get_md)(struct inode *inode, void *md, int size,
+ enum ea_type type);
+
+ int (* fs_send_bio)(int rw, struct inode *inode, void *bio);
/* methods for getting page from backing fs and putting page there
* during IO. Used on OST. */
ssize_t (* fs_readpage)(struct file *file, char *buf, size_t count,
loff_t *offset);
- int (* fs_add_journal_cb)(struct obd_device *obd, struct super_block *sb,
- __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func,
- void *cb_data);
+ int (* fs_add_journal_cb)(struct obd_device *obd,
+ struct super_block *sb,
+ __u64 last_rcvd, void *handle,
+ fsfilt_cb_t cb_func, void *cb_data);
int (* fs_statfs)(struct super_block *sb, struct obd_statfs *osfs);
int (* fs_sync)(struct super_block *sb);
int (* fs_map_inode_pages)(struct inode *inode, struct page **page,
int (* fs_read_record)(struct file *, void *, int size, loff_t *);
int (* fs_setup)(struct obd_device *, struct super_block *);
- int (* fs_post_setup)(struct obd_device *obd, struct vfsmount *mnt);
+ int (* fs_post_setup)(struct obd_device *obd, struct vfsmount *mnt,
+ struct dentry *dentry);
int (* fs_post_cleanup)(struct obd_device *obd, struct vfsmount *mnt);
- int (* fs_get_reint_log_ctxt)(struct super_block *sb,
- struct llog_ctxt **ctxt);
+ int (* fs_set_info)(struct super_block *, struct inode *,
+ __u32, void *, __u32, void *);
+ int (* fs_get_info)(struct super_block *, struct inode *,
+ __u32, void *, __u32 *, void *);
int (* fs_set_fs_flags)(struct inode *inode, int flags);
int (* fs_clear_fs_flags)(struct inode *inode, int flags);
int (* fs_set_ost_flags)(struct super_block *sb);
int (* fs_set_mds_flags)(struct super_block *sb);
- int (* fs_precreate_rec)(struct dentry *dentry, int *num,
+ int (* fs_precreate_rec)(struct dentry *dentry, int *num,
struct obdo *oa);
int (* fs_set_xattr)(struct inode *inode, void *handle, char *name,
void *buffer, int buffer_size);
int (* fs_get_op_len)(int, struct fsfilt_objinfo *, int);
int (* fs_add_dir_entry)(struct obd_device *, struct dentry *,
char *, int, unsigned long, unsigned long,
- unsigned);
+ unsigned long, unsigned long);
int (* fs_del_dir_entry)(struct obd_device *, struct dentry *);
/*snap operations*/
int (* fs_is_redirector)(struct inode *inode);
int (* fs_is_indirect)(struct inode *inode);
struct inode * (* fs_create_indirect)(struct inode *pri, int index,
- unsigned int gen, struct inode *parent,
+ unsigned int gen,
+ struct inode *parent,
int del);
struct inode * (* fs_get_indirect)(struct inode *pri, int *table,
int slot);
- ino_t (* fs_get_indirect_ino)(struct inode *pri, int index);
+ ino_t (* fs_get_indirect_ino)(struct super_block *sb, ino_t pri,
+ int index);
int (* fs_destroy_indirect)(struct inode *pri, int index,
struct inode *next_ind);
int (* fs_restore_indirect)(struct inode *pri, int index);
int (* fs_iterate)(struct super_block *sb,
int (*repeat)(struct inode *inode, void *priv),
struct inode **start, void *priv, int flag);
- int (* fs_copy_block)(struct inode *dst, struct inode *src, int blk);
+ int (* fs_copy_block)(struct inode *dst, struct inode *src,
+ int blk);
int (* fs_set_indirect)(struct inode *pri, int index,
ino_t ind_ino, ino_t parent_ino);
- int (* fs_snap_feature)(struct super_block *sb, int feature, int op);
- int (* fs_set_snap_info)(struct super_block *sb, struct inode *inode,
- void* key, __u32 keylen, void *val,
- __u32 *vallen);
- int (* fs_get_snap_info)(struct super_block *sb, struct inode *inode,
- void* key, __u32 keylen, void *val,
- __u32 *vallen);
+ int (* fs_snap_feature)(struct super_block *sb, int feature,
+ int op);
+ int (* fs_set_snap_info)(struct inode *inode, void* key,
+ __u32 keylen, void *val, __u32 *vallen);
+ int (* fs_get_snap_info)(struct inode *inode, void* key,
+ __u32 keylen, void *val, __u32 *vallen);
int (* fs_set_snap_item)(struct super_block *sb, char *name);
+ int (* fs_read_dotsnap_dir_page)(struct file *file, char *buf,
+ size_t count, loff_t *ppos);
+ int (* fs_dir_ent_size)(char *name);
+ int (* fs_set_dir_ent)(struct super_block *sb, char *name,
+ char *buf, int buf_off, int nlen,
+ size_t count);
};
extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops);
#define LMV_EA 1
#define LOV_EA 0
+#define fsfilt_check_slow(start, timeout, msg) \
+do { \
+ if (time_before(jiffies, start + 15 * HZ)) \
+ break; \
+ else if (time_before(jiffies, start + timeout / 2 * HZ)) \
+ CWARN("slow %s %lus\n", msg, (jiffies - start) / HZ); \
+ else \
+ CERROR("slow %s %lus\n", msg, (jiffies - start) / HZ); \
+} while (0)
+
static inline void *
fsfilt_start_ops(struct fsfilt_operations *ops, struct inode *inode,
int op, struct obd_trans_info *oti, int logs)
unsigned long now = jiffies;
void *parent_handle = oti ? oti->oti_handle : NULL;
void *handle = ops->fs_start(inode, op, parent_handle, logs);
- CDEBUG(D_HA, "started handle %p (%p)\n", handle, parent_handle);
+ CDEBUG(D_INFO, "started handle %p (%p)\n", handle, parent_handle);
if (oti != NULL) {
if (parent_handle == NULL) {
LBUG();
}
}
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
+ fsfilt_check_slow(now, 60, "journal start");
return handle;
}
{
unsigned long now = jiffies;
int rc = ops->fs_commit(sb, inode, handle, force_sync);
- CDEBUG(D_HA, "committing handle %p\n", handle);
+ CDEBUG(D_INFO, "committing handle %p\n", handle);
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
+ fsfilt_check_slow(now, 60, "journal start");
return rc;
}
void *parent_handle = oti ? oti->oti_handle : NULL;
void *handle = obd->obd_fsops->fs_brw_start(objcount, fso, niocount, nb,
parent_handle, logs);
- CDEBUG(D_HA, "started handle %p (%p)\n", handle, parent_handle);
+ CDEBUG(D_INFO, "started handle %p (%p)\n", handle, parent_handle);
if (oti != NULL) {
if (parent_handle == NULL) {
LBUG();
}
}
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
+ fsfilt_check_slow(now, obd_timeout, "journal start");
return handle;
}
unsigned long now = jiffies;
int rc = obd->obd_fsops->fs_commit_async(inode, handle, wait_handle);
- CDEBUG(D_HA, "committing handle %p (async)\n", *wait_handle);
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
+ CDEBUG(D_INFO, "committing handle %p (async)\n", *wait_handle);
+ fsfilt_check_slow(now, obd_timeout, "journal start");
return rc;
}
{
unsigned long now = jiffies;
int rc = obd->obd_fsops->fs_commit_wait(inode, handle);
- CDEBUG(D_HA, "waiting for completion %p\n", handle);
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long journal start time %lus\n", (jiffies - now) / HZ);
+ CDEBUG(D_INFO, "waiting for completion %p\n", handle);
+ fsfilt_check_slow(now, obd_timeout, "journal start");
return rc;
}
unsigned long now = jiffies;
int rc;
rc = obd->obd_fsops->fs_setattr(dentry, handle, iattr, do_trunc);
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long setattr time %lus\n", (jiffies - now) / HZ);
+ fsfilt_check_slow(now, obd_timeout, "setattr");
return rc;
}
return obd->obd_fsops->fs_setup(obd, fs);
return 0;
}
+
static inline int
fsfilt_set_md(struct obd_device *obd, struct inode *inode,
- void *handle, void *md, int size)
+ void *handle, void *md, int size, enum ea_type type)
{
- return obd->obd_fsops->fs_set_md(inode, handle, md, size);
+ if (!obd->obd_fsops->fs_set_md)
+ return -ENOSYS;
+
+ return obd->obd_fsops->fs_set_md(inode, handle, md,
+ size, type);
}
static inline int
fsfilt_get_md(struct obd_device *obd, struct inode *inode,
- void *md, int size)
+ void *md, int size, enum ea_type type)
{
- return obd->obd_fsops->fs_get_md(inode, md, size);
+ if (!obd->obd_fsops->fs_get_md)
+ return -ENOSYS;
+
+ return obd->obd_fsops->fs_get_md(inode, md, size,
+ type);
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-static inline int
-fsfilt_send_bio(struct obd_device *obd, struct inode *inode,
- struct bio *bio)
-#else
-static inline int
-fsfilt_send_bio(struct obd_device *obd, struct inode *inode,
- struct kiobuf *bio)
-#endif
+static inline int fsfilt_send_bio(int rw, struct obd_device *obd,
+ struct inode *inode, void *bio)
{
- return obd->obd_fsops->fs_send_bio(inode, bio);
+ LASSERTF(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ, "%x\n", rw);
+
+ if (rw == OBD_BRW_READ)
+ return obd->obd_fsops->fs_send_bio(READ, inode, bio);
+ else
+ return obd->obd_fsops->fs_send_bio(WRITE, inode, bio);
}
static inline int
rc = obd->obd_fsops->fs_putpage(inode, page);
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long putpage time %lus\n", (jiffies - now) / HZ);
+ fsfilt_check_slow(now, obd_timeout, "putpage");
return rc;
}
page = obd->obd_fsops->fs_getpage(inode, index);
- if (time_after(jiffies, now + 15 * HZ))
- CERROR("long getpage time %lus\n", (jiffies - now) / HZ);
+ fsfilt_check_slow(now, obd_timeout, "getpage");
return page;
}
static inline int
fsfilt_add_journal_cb(struct obd_device *obd, struct super_block *sb,
- __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func,
+ __u64 last_num, void *handle, fsfilt_cb_t cb_func,
void *cb_data)
{
- return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_rcvd, handle,
+ return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_num, handle,
cb_func, cb_data);
}
return obd->obd_fsops->fs_clear_fs_flags(inode, flags);
return 0;
}
+
static inline int
fsfilt_precreate_rec(struct obd_device *obd, struct dentry *dentry,
int *num, struct obdo *oa)
}
static inline int
-fsfilt_post_setup(struct obd_device *obd)
+fsfilt_post_setup(struct obd_device *obd, struct dentry *de)
{
if (obd->obd_fsops->fs_post_setup)
return obd->obd_fsops->fs_post_setup(obd,
- obd->obd_lvfs_ctxt.pwdmnt);
+ obd->obd_lvfs_ctxt.pwdmnt, de);
return 0;
}
}
static inline int
-fsfilt_get_reint_log_ctxt(struct obd_device *obd,
- struct super_block *sb,
- struct llog_ctxt **ctxt)
+fsfilt_set_info(struct obd_device *obd, struct super_block *sb,
+ struct inode * inode, __u32 keylen, void * key,
+ __u32 valsize, void * val)
+{
+ if (obd->obd_fsops->fs_set_info)
+ return obd->obd_fsops->fs_set_info(sb, inode,
+ keylen, key,
+ valsize, val);
+ return 0;
+}
+
+static inline int
+fsfilt_get_info(struct obd_device *obd, struct super_block *sb,
+ struct inode * inode, __u32 keylen, void * key,
+ __u32 * valsize, void * val)
{
- if (obd->obd_fsops->fs_get_reint_log_ctxt)
- return obd->obd_fsops->fs_get_reint_log_ctxt(sb, ctxt);
+ if (obd->obd_fsops->fs_get_info)
+ return obd->obd_fsops->fs_get_info(sb, inode, keylen, key,
+ valsize, val);
return 0;
}
static inline int
fsfilt_add_dir_entry(struct obd_device *obd, struct dentry *dir,
char *name, int namelen, unsigned long ino,
- unsigned long generation, unsigned mds)
+ unsigned long generation, unsigned long mds,
+ unsigned long fid)
{
LASSERT(obd->obd_fsops->fs_add_dir_entry);
+
return obd->obd_fsops->fs_add_dir_entry(obd, dir, name,
- namelen, ino, generation, mds);
+ namelen, ino,
+ generation, mds,
+ fid);
}
static inline int