{
}
+struct osd_filldir_cbs {
+#ifdef HAVE_DIR_CONTEXT
+ struct dir_context ctx;
+#endif
+ struct osd_it_ea *it;
+};
/**
* It is called internally by ->readdir(). It fills the
* iterator's in-memory data structure with required
* \retval 0 on success
* \retval 1 on buffer full
*/
-static int osd_ldiskfs_filldir(char *buf, const char *name, int namelen,
+static int osd_ldiskfs_filldir(void *buf, const char *name, int namelen,
loff_t offset, __u64 ino,
unsigned d_type)
{
- struct osd_it_ea *it = (struct osd_it_ea *)buf;
+ struct osd_it_ea *it = ((struct osd_filldir_cbs *)buf)->it;
struct osd_object *obj = it->oie_obj;
struct osd_it_ea_dirent *ent = it->oie_dirent;
struct lu_fid *fid = &ent->oied_fid;
struct osd_object *obj = it->oie_obj;
struct inode *inode = obj->oo_inode;
struct htree_lock *hlock = NULL;
- int result = 0;
+ struct file *filp = &it->oie_file;
+ int rc = 0;
+ struct osd_filldir_cbs buf = {
+#ifdef HAVE_DIR_CONTEXT
+ .ctx.actor = osd_ldiskfs_filldir,
+#endif
+ .it = it
+ };
ENTRY;
it->oie_dirent = it->oie_buf;
down_read(&obj->oo_ext_idx_sem);
}
- result = inode->i_fop->readdir(&it->oie_file, it,
- (filldir_t) osd_ldiskfs_filldir);
+#ifdef HAVE_DIR_CONTEXT
+ buf.ctx.pos = filp->f_pos;
+ rc = inode->i_fop->iterate(filp, &buf.ctx);
+ filp->f_pos = buf.ctx.pos;
+#else
+ rc = inode->i_fop->readdir(filp, &buf, osd_ldiskfs_filldir);
+#endif
if (hlock != NULL)
ldiskfs_htree_unlock(hlock);
it->oie_it_dirent = 1;
}
- RETURN(result);
+ RETURN(rc);
}
/**
};
struct osd_ios_filldir_buf {
+#ifdef HAVE_DIR_CONTEXT
+ /* please keep it as first member */
+ struct dir_context ctx;
+#endif
struct osd_thread_info *oifb_info;
struct osd_device *oifb_dev;
struct dentry *oifb_dentry;
osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev,
struct dentry *dentry, filldir_t filldir)
{
- struct osd_ios_filldir_buf buf = { info, dev, dentry };
+ struct osd_ios_filldir_buf buf = {
+#ifdef HAVE_DIR_CONTEXT
+ .ctx.actor = filldir,
+#endif
+ .oifb_info = info,
+ .oifb_dev = dev,
+ .oifb_dentry = dentry };
struct file *filp = &info->oti_it_ea.oie_file;
struct inode *inode = dentry->d_inode;
const struct file_operations *fops = inode->i_fop;
filp->private_data = NULL;
set_file_inode(filp, inode);
+#ifdef HAVE_DIR_CONTEXT
+ buf.ctx.pos = filp->f_pos;
+ rc = fops->iterate(filp, &buf.ctx);
+ filp->f_pos = buf.ctx.pos;
+#else
rc = fops->readdir(filp, &buf, filldir);
+#endif
fops->release(inode, filp);
RETURN(rc);