#ifndef MS_HAS_NEW_AOPS
extern struct address_space_operations ll_aops;
-extern struct address_space_operations ll_dir_aops;
#else
extern struct address_space_operations_ext ll_aops;
-extern struct address_space_operations_ext ll_dir_aops;
#endif
#ifndef log2
static struct ll_sb_info *ll_init_sbi(void)
{
- struct ll_sb_info *sbi = NULL;
- unsigned long pages;
+ struct ll_sb_info *sbi = NULL;
+ unsigned long pages;
+ unsigned long lru_page_max;
struct sysinfo si;
class_uuid_t uuid;
int i;
pages = si.totalram - si.totalhigh;
if (pages >> (20 - CFS_PAGE_SHIFT) < 512) {
#ifdef HAVE_BGL_SUPPORT
- sbi->ll_async_page_max = pages / 4;
+ lru_page_max = pages / 4;
#else
- sbi->ll_async_page_max = pages / 2;
+ lru_page_max = pages / 2;
#endif
- } else {
- sbi->ll_async_page_max = (pages / 4) * 3;
- }
+ } else {
+ lru_page_max = (pages / 4) * 3;
+ }
+
+ /* initialize lru data */
+ cfs_atomic_set(&sbi->ll_lru.ccl_users, 0);
+ sbi->ll_lru.ccl_page_max = lru_page_max;
+ cfs_atomic_set(&sbi->ll_lru.ccl_page_left, lru_page_max);
+ cfs_spin_lock_init(&sbi->ll_lru.ccl_lock);
+ CFS_INIT_LIST_HEAD(&sbi->ll_lru.ccl_list);
sbi->ll_ra_info.ra_max_pages_per_file = min(pages / 32,
SBI_DEFAULT_READAHEAD_MAX);
CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
sb->s_op = &lustre_super_operations;
-#if THREAD_SIZE >= 8192 /*b=17630*/ && !defined(HAVE_FSTYPE_MOUNT) /*LU-812*/
+#if THREAD_SIZE >= 8192 /*b=17630*/
sb->s_export_op = &lustre_export_operations;
#endif
NULL);
cl_sb_init(sb);
- sb->s_root = d_alloc_root(root);
+ err = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_LRU_SET),
+ KEY_LRU_SET, sizeof(sbi->ll_lru),
+ &sbi->ll_lru, NULL);
+
+ sb->s_root = d_alloc_root(root);
#ifdef HAVE_DCACHE_LOCK
sb->s_root->d_op = &ll_d_root_ops;
#else
uuid = obd_get_uuid(sbi->ll_md_exp);
if (uuid != NULL)
sb->s_dev = get_uuid2int(uuid->uuid, strlen(uuid->uuid));
- sbi->ll_mnt = mnt;
if (data != NULL)
OBD_FREE_PTR(data);
cfs_mutex_init(&lli->lli_readdir_mutex);
lli->lli_opendir_key = NULL;
lli->lli_sai = NULL;
- lli->lli_sa_pos = 0;
lli->lli_def_acl = NULL;
cfs_spin_lock_init(&lli->lli_sa_lock);
lli->lli_opendir_pid = 0;
Use the address of the super itself.*/
cfg->cfg_instance = sb;
cfg->cfg_uuid = lsi->lsi_llsbi->ll_sb_uuid;
-
+ cfg->cfg_callback = class_config_llog_handler;
/* set up client obds */
err = lustre_process_log(sb, profilenm, cfg);
if (err < 0) {
} else if (S_ISDIR(inode->i_mode)) {
inode->i_op = &ll_dir_inode_operations;
inode->i_fop = &ll_dir_operations;
- inode->i_mapping->a_ops = (struct address_space_operations *)&ll_dir_aops;
EXIT;
} else if (S_ISLNK(inode->i_mode)) {
inode->i_op = &ll_fast_symlink_inode_operations;
} else {
inode->i_op = &ll_special_inode_operations;
- init_special_inode(inode, inode->i_mode,
- kdev_t_to_nr(inode->i_rdev));
+ init_special_inode(inode, inode->i_mode,
+ inode->i_rdev);
EXIT;
}
if (rc)
RETURN(rc);
- OBDO_ALLOC(oinfo.oi_oa);
- if (!oinfo.oi_oa)
- RETURN(-ENOMEM);
+ inode->i_flags = ll_ext_to_inode_flags(flags);
lsm = ccc_inode_lsm_get(inode);
- if (lsm == NULL) {
- inode->i_flags = ll_ext_to_inode_flags(flags);
- OBDO_FREE(oinfo.oi_oa);
+ if (lsm == NULL)
RETURN(0);
- }
+ OBDO_ALLOC(oinfo.oi_oa);
+ if (!oinfo.oi_oa) {
+ ccc_inode_lsm_put(inode, lsm);
+ RETURN(-ENOMEM);
+ }
oinfo.oi_md = lsm;
oinfo.oi_oa->o_id = lsm->lsm_object_id;
oinfo.oi_oa->o_seq = lsm->lsm_object_seq;
ibits = MDS_INODELOCK_LAYOUT;
if (S_ISREG(md.body->mode) && sbi->ll_flags & LL_SBI_LAYOUT_LOCK &&
md.lsm != NULL && !ll_have_md_lock(*inode, &ibits, LCK_MINMODE)) {
- char *fsname = ll_get_fsname(*inode);
CERROR("%s: inode "DFID" (%p) layout lock not granted.\n",
- fsname, PFID(ll_inode2fid(*inode)),
- *inode);
- if (fsname)
- OBD_FREE(fsname, MGS_PARAM_MAXLEN);
+ ll_get_fsname(sb, NULL, 0),
+ PFID(ll_inode2fid(*inode)), *inode);
}
out:
char *buf = NULL;
struct obd_ioctl_data *data = NULL;
__u32 type;
+ __u32 flags;
int len = 0, rc;
if (!inode || !(sbi = ll_i2sbi(inode)))
GOTO(out_statfs, rc = -EINVAL);
memcpy(&type, data->ioc_inlbuf1, sizeof(__u32));
- if (type == LL_STATFS_LMV)
+ if (type & LL_STATFS_LMV)
exp = sbi->ll_md_exp;
- else if (type == LL_STATFS_LOV)
+ else if (type & LL_STATFS_LOV)
exp = sbi->ll_dt_exp;
else
GOTO(out_statfs, rc = -ENODEV);
- rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, NULL);
+ flags = (type & LL_STATFS_NODELAY) ? OBD_STATFS_NODELAY : 0;
+ rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, &flags);
if (rc)
GOTO(out_statfs, rc);
out_statfs:
RETURN(0);
}
+
+/**
+ * Get lustre file system name by \a sbi. If \a buf is provided(non-NULL), the
+ * fsname will be returned in this buffer; otherwise, a static buffer will be
+ * used to store the fsname and returned to caller.
+ */
+char *ll_get_fsname(struct super_block *sb, char *buf, int buflen)
+{
+ static char fsname_static[MTI_NAME_MAXLEN];
+ struct lustre_sb_info *lsi = s2lsi(sb);
+ char *ptr;
+ int len;
+
+ if (buf == NULL) {
+ /* this means the caller wants to use static buffer
+ * and it doesn't care about race. Usually this is
+ * in error reporting path */
+ buf = fsname_static;
+ buflen = sizeof(fsname_static);
+ }
+
+ len = strlen(lsi->lsi_lmd->lmd_profile);
+ ptr = strrchr(lsi->lsi_lmd->lmd_profile, '-');
+ if (ptr && (strcmp(ptr, "-client") == 0))
+ len -= 7;
+
+ if (unlikely(len >= buflen))
+ len = buflen - 1;
+ strncpy(buf, lsi->lsi_lmd->lmd_profile, len);
+ buf[len] = '\0';
+
+ return buf;
+}