diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/llite')
-rw-r--r-- | drivers/staging/lustre/lustre/llite/dcache.c | 8 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/dir.c | 11 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/file.c | 8 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/llite_internal.h | 1 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/llite_lib.c | 48 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/lproc_llite.c | 8 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/super25.c | 141 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/vvp_io.c | 15 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/vvp_lock.c | 1 |
9 files changed, 98 insertions, 143 deletions
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 5bb9c85cec81..88614b71cf6d 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -263,14 +263,6 @@ void ll_invalidate_aliases(struct inode *inode) dentry, dentry, dentry->d_parent, dentry->d_inode, dentry->d_flags); - if (unlikely(dentry == dentry->d_sb->s_root)) { - CERROR("%s: called on root dentry=%p, fid="DFID"\n", - ll_get_fsname(dentry->d_sb, NULL, 0), - dentry, PFID(ll_inode2fid(inode))); - lustre_dump_dentry(dentry, 1); - dump_stack(); - } - d_lustre_invalidate(dentry, 0); } ll_unlock_dcache(inode); diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 1ac7a702ce26..a18201913273 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -183,7 +183,10 @@ static int ll_dir_filler(void *_hash, struct page *page0) op_data->op_offset = hash; rc = md_readpage(exp, op_data, page_pool, &request); ll_finish_md_op_data(op_data); - if (rc == 0) { + if (rc < 0) { + /* page0 is special, which was added into page cache early */ + delete_from_page_cache(page0); + } else if (rc == 0) { body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); /* Checked by mdc_readpage() */ LASSERT(body != NULL); @@ -278,7 +281,7 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 *hash, spin_lock_irq(&mapping->tree_lock); found = radix_tree_gang_lookup(&mapping->page_tree, (void **)&page, offset, 1); - if (found > 0) { + if (found > 0 && !radix_tree_exceptional_entry(page)) { struct lu_dirpage *dp; page_cache_get(page); @@ -652,8 +655,8 @@ static int ll_send_mgc_param(struct obd_export *mgc, char *string) return rc; } -int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump, - char *filename) +static int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump, + char *filename) { struct ptlrpc_request *request = NULL; struct md_op_data *op_data; diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 35a2df01528c..7c7ef7ec908e 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1553,6 +1553,11 @@ ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg) struct ccc_grouplock grouplock; int rc; + if (arg == 0) { + CWARN("group id for group lock must not be 0\n"); + return -EINVAL; + } + if (ll_file_nolock(file)) return -EOPNOTSUPP; @@ -1587,7 +1592,8 @@ ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg) return 0; } -int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg) +static int ll_put_grouplock(struct inode *inode, struct file *file, + unsigned long arg) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 37306e0c7aad..d032c2b086cc 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -816,7 +816,6 @@ int ll_show_options(struct seq_file *seq, struct dentry *dentry); void ll_dirty_page_discard_warn(struct page *page, int ioret); int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, struct super_block *, struct lookup_intent *); -void lustre_dump_dentry(struct dentry *, int recur); int ll_obd_statfs(struct inode *inode, void *arg); int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize); int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize); diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index a3367bfb1456..0c1b583a4ea1 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -665,48 +665,6 @@ int ll_get_default_cookiesize(struct ll_sb_info *sbi, int *lmmsize) return rc; } -static void ll_dump_inode(struct inode *inode) -{ - struct ll_d_hlist_node *tmp; - int dentry_count = 0; - - LASSERT(inode != NULL); - - ll_d_hlist_for_each(tmp, &inode->i_dentry) - dentry_count++; - - CERROR("inode %p dump: dev=%s ino=%lu mode=%o count=%u, %d dentries\n", - inode, ll_i2mdexp(inode)->exp_obd->obd_name, inode->i_ino, - inode->i_mode, atomic_read(&inode->i_count), dentry_count); -} - -void lustre_dump_dentry(struct dentry *dentry, int recur) -{ - struct list_head *tmp; - int subdirs = 0; - - LASSERT(dentry != NULL); - - list_for_each(tmp, &dentry->d_subdirs) - subdirs++; - - CERROR("dentry %p dump: name=%pd parent=%pd (%p), inode=%p, count=%u, flags=0x%x, fsdata=%p, %d subdirs\n", - dentry, dentry, dentry->d_parent, dentry->d_parent, - dentry->d_inode, d_count(dentry), - dentry->d_flags, dentry->d_fsdata, subdirs); - if (dentry->d_inode != NULL) - ll_dump_inode(dentry->d_inode); - - if (recur == 0) - return; - - list_for_each(tmp, &dentry->d_subdirs) { - struct dentry *d = list_entry(tmp, struct dentry, d_child); - - lustre_dump_dentry(d, recur - 1); - } -} - static void client_common_put_super(struct super_block *sb) { struct ll_sb_info *sbi = ll_s2sbi(sb); @@ -987,7 +945,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt) if (err) goto out_free; lsi->lsi_flags |= LSI_BDI_INITIALIZED; - lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY; + lsi->lsi_bdi.capabilities = 0; err = ll_bdi_register(&lsi->lsi_bdi); if (err) goto out_free; @@ -1812,10 +1770,6 @@ void ll_read_inode2(struct inode *inode, void *opaque) /* OIDEBUG(inode); */ - /* initializing backing dev info. */ - inode->i_mapping->backing_dev_info = &s2lsi(inode->i_sb)->lsi_bdi; - - if (S_ISREG(inode->i_mode)) { struct ll_sb_info *sbi = ll_i2sbi(inode); diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index e6a909e6faf0..aaa13bd3e8de 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -399,9 +399,6 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, return -ERANGE; } - if (sbi->ll_dt_exp == NULL) - return -ENODEV; - spin_lock(&sbi->ll_lock); diff = pages_number - cache->ccc_lru_max; spin_unlock(&sbi->ll_lock); @@ -437,6 +434,11 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, if (diff <= 0) break; + if (sbi->ll_dt_exp == NULL) { /* being initialized */ + rc = -ENODEV; + break; + } + /* difficult - have to ask OSCs to drop LRU slots. */ tmp = diff << 1; rc = obd_set_info_async(NULL, sbi->ll_dt_exp, diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 6aff155651cc..7c1e02a031ba 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -72,21 +72,6 @@ static void ll_destroy_inode(struct inode *inode) call_rcu(&inode->i_rcu, ll_inode_destroy_callback); } -static int ll_init_inodecache(void) -{ - ll_inode_cachep = kmem_cache_create("lustre_inode_cache", - sizeof(struct ll_inode_info), - 0, SLAB_HWCACHE_ALIGN, NULL); - if (ll_inode_cachep == NULL) - return -ENOMEM; - return 0; -} - -static void ll_destroy_inodecache(void) -{ - kmem_cache_destroy(ll_inode_cachep); -} - /* exported operations */ struct super_operations lustre_super_operations = { .alloc_inode = ll_alloc_inode, @@ -104,9 +89,10 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg)); static int __init init_lustre_lite(void) { - int i, rc, seed[2]; - struct timeval tv; + struct proc_dir_entry *entry; lnet_process_id_t lnet_id; + struct timeval tv; + int i, rc, seed[2]; CLASSERT(sizeof(LUSTRE_VOLATILE_HDR) == LUSTRE_VOLATILE_HDR_LEN + 1); @@ -116,59 +102,52 @@ static int __init init_lustre_lite(void) CDEBUG(D_INFO, "Lustre client module (%p).\n", &lustre_super_operations); - rc = ll_init_inodecache(); - if (rc) - return -ENOMEM; + rc = -ENOMEM; + ll_inode_cachep = kmem_cache_create("lustre_inode_cache", + sizeof(struct ll_inode_info), + 0, SLAB_HWCACHE_ALIGN, NULL); + if (ll_inode_cachep == NULL) + goto out_cache; + ll_file_data_slab = kmem_cache_create("ll_file_data", sizeof(struct ll_file_data), 0, SLAB_HWCACHE_ALIGN, NULL); - if (ll_file_data_slab == NULL) { - ll_destroy_inodecache(); - return -ENOMEM; - } + if (ll_file_data_slab == NULL) + goto out_cache; ll_remote_perm_cachep = kmem_cache_create("ll_remote_perm_cache", sizeof(struct ll_remote_perm), 0, 0, NULL); - if (ll_remote_perm_cachep == NULL) { - kmem_cache_destroy(ll_file_data_slab); - ll_file_data_slab = NULL; - ll_destroy_inodecache(); - return -ENOMEM; - } + if (ll_remote_perm_cachep == NULL) + goto out_cache; ll_rmtperm_hash_cachep = kmem_cache_create("ll_rmtperm_hash_cache", REMOTE_PERM_HASHSIZE * sizeof(struct list_head), 0, 0, NULL); - if (ll_rmtperm_hash_cachep == NULL) { - kmem_cache_destroy(ll_remote_perm_cachep); - ll_remote_perm_cachep = NULL; - kmem_cache_destroy(ll_file_data_slab); - ll_file_data_slab = NULL; - ll_destroy_inodecache(); - return -ENOMEM; + if (ll_rmtperm_hash_cachep == NULL) + goto out_cache; + + entry = lprocfs_register("llite", proc_lustre_root, NULL, NULL); + if (IS_ERR(entry)) { + rc = PTR_ERR(entry); + CERROR("cannot register '/proc/fs/lustre/llite': rc = %d\n", + rc); + goto out_cache; } - proc_lustre_fs_root = proc_lustre_root ? - lprocfs_register("llite", proc_lustre_root, NULL, NULL) : NULL; - - lustre_register_client_fill_super(ll_fill_super); - lustre_register_kill_super_cb(ll_kill_super); - - lustre_register_client_process_config(ll_process_config); + proc_lustre_fs_root = entry; cfs_get_random_bytes(seed, sizeof(seed)); - /* Nodes with small feet have little entropy - * the NID for this node gives the most entropy in the low bits */ - for (i = 0; ; i++) { - if (LNetGetId(i, &lnet_id) == -ENOENT) { + /* Nodes with small feet have little entropy. The NID for this + * node gives the most entropy in the low bits */ + for (i = 0;; i++) { + if (LNetGetId(i, &lnet_id) == -ENOENT) break; - } - if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) { + + if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) seed[0] ^= LNET_NIDADDR(lnet_id.nid); - } } do_gettimeofday(&tv); @@ -177,20 +156,54 @@ static int __init init_lustre_lite(void) init_timer(&ll_capa_timer); ll_capa_timer.function = ll_capa_timer_callback; rc = ll_capa_thread_start(); - /* - * XXX normal cleanup is needed here. - */ - if (rc == 0) - rc = vvp_global_init(); + if (rc != 0) + goto out_proc; - if (rc == 0) - rc = ll_xattr_init(); + rc = vvp_global_init(); + if (rc != 0) + goto out_capa; + + rc = ll_xattr_init(); + if (rc != 0) + goto out_vvp; + + lustre_register_client_fill_super(ll_fill_super); + lustre_register_kill_super_cb(ll_kill_super); + lustre_register_client_process_config(ll_process_config); + + return 0; + +out_vvp: + vvp_global_fini(); +out_capa: + del_timer(&ll_capa_timer); + ll_capa_thread_stop(); +out_proc: + lprocfs_remove(&proc_lustre_fs_root); +out_cache: + if (ll_inode_cachep != NULL) + kmem_cache_destroy(ll_inode_cachep); + + if (ll_file_data_slab != NULL) + kmem_cache_destroy(ll_file_data_slab); + + if (ll_remote_perm_cachep != NULL) + kmem_cache_destroy(ll_remote_perm_cachep); + + if (ll_rmtperm_hash_cachep != NULL) + kmem_cache_destroy(ll_rmtperm_hash_cachep); return rc; } static void __exit exit_lustre_lite(void) { + lustre_register_client_fill_super(NULL); + lustre_register_kill_super_cb(NULL); + lustre_register_client_process_config(NULL); + + lprocfs_remove(&proc_lustre_fs_root); + ll_xattr_fini(); vvp_global_fini(); del_timer(&ll_capa_timer); @@ -199,22 +212,12 @@ static void __exit exit_lustre_lite(void) "client remaining capa count %d\n", capa_count[CAPA_SITE_CLIENT]); - lustre_register_client_fill_super(NULL); - lustre_register_kill_super_cb(NULL); - - lustre_register_client_process_config(NULL); - - ll_destroy_inodecache(); - + kmem_cache_destroy(ll_inode_cachep); kmem_cache_destroy(ll_rmtperm_hash_cachep); - ll_rmtperm_hash_cachep = NULL; kmem_cache_destroy(ll_remote_perm_cachep); - ll_remote_perm_cachep = NULL; kmem_cache_destroy(ll_file_data_slab); - if (proc_lustre_fs_root && !IS_ERR(proc_lustre_fs_root)) - lprocfs_remove(&proc_lustre_fs_root); } MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>"); diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 65d610abe06e..91bba79678cf 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -307,18 +307,13 @@ static int vvp_io_rw_lock(const struct lu_env *env, struct cl_io *io, static int vvp_io_read_lock(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; - struct ll_inode_info *lli = ll_i2info(ccc_object_inode(io->ci_obj)); + struct cl_io *io = ios->cis_io; + struct cl_io_rw_common *rd = &io->u.ci_rd.rd; int result; - /* XXX: Layer violation, we shouldn't see lsm at llite level. */ - if (lli->lli_has_smd) /* lsm-less file doesn't need to lock */ - result = vvp_io_rw_lock(env, io, CLM_READ, - io->u.ci_rd.rd.crw_pos, - io->u.ci_rd.rd.crw_pos + - io->u.ci_rd.rd.crw_count - 1); - else - result = 0; + result = vvp_io_rw_lock(env, io, CLM_READ, rd->crw_pos, + rd->crw_pos + rd->crw_count - 1); + return result; } diff --git a/drivers/staging/lustre/lustre/llite/vvp_lock.c b/drivers/staging/lustre/lustre/llite/vvp_lock.c index 372633e164b9..f354e82d4ae7 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_lock.c +++ b/drivers/staging/lustre/lustre/llite/vvp_lock.c @@ -71,6 +71,7 @@ static const struct cl_lock_operations vvp_lock_ops = { .clo_fini = ccc_lock_fini, .clo_enqueue = ccc_lock_enqueue, .clo_wait = ccc_lock_wait, + .clo_use = ccc_lock_use, .clo_unuse = ccc_lock_unuse, .clo_fits_into = ccc_lock_fits_into, .clo_state = ccc_lock_state, |