* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
#include <linux/module.h>
#include <linux/types.h>
-#include <linux/random.h>
#include <linux/version.h>
#include <linux/mm.h>
cfs_list_add_tail(&sbi->ll_list, &ll_super_blocks);
cfs_spin_unlock(&ll_sb_lock);
-#ifdef ENABLE_LLITE_CHECKSUM
+#ifdef ENABLE_CHECKSUM
sbi->ll_flags |= LL_SBI_CHECKSUM;
#endif
GOTO(out_md, err);
}
- err = obd_statfs(obd, &osfs, cfs_time_current_64() - CFS_HZ, 0);
+ err = obd_statfs(obd, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0);
if (err)
GOTO(out_md_fid, err);
CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
sb->s_op = &lustre_super_operations;
+#if THREAD_SIZE >= 8192
sb->s_export_op = &lustre_export_operations;
+#endif
/* make root inode
* XXX: move this to after cbd setup? */
*flags &= ~tmp;
goto next;
}
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2,5,50,0)
tmp = ll_set_opt("acl", s1, LL_SBI_ACL);
if (tmp) {
/* Ignore deprecated mount option. The client will
* always try to mount with ACL support, whether this
* is used depends on whether server supports it. */
+ LCONSOLE_ERROR_MSG(0x152, "Ignoring deprecated "
+ "mount option 'acl'.\n");
goto next;
}
tmp = ll_set_opt("noacl", s1, LL_SBI_ACL);
if (tmp) {
+ LCONSOLE_ERROR_MSG(0x152, "Ignoring deprecated "
+ "mount option 'noacl'.\n");
goto next;
}
+#else
+#warning "{no}acl options have been deprecated since 1.8, please remove them"
+#endif
tmp = ll_set_opt("remote_client", s1, LL_SBI_RMT_CLIENT);
if (tmp) {
*flags |= tmp;
*flags |= tmp;
goto next;
}
+ tmp = ll_set_opt("32bitapi", s1, LL_SBI_32BIT_API);
+ if (tmp) {
+ *flags |= tmp;
+ goto next;
+ }
LCONSOLE_ERROR_MSG(0x152, "Unknown option '%s', won't mount.\n",
s1);
lli->lli_inode_magic = LLI_INODE_MAGIC;
cfs_sema_init(&lli->lli_size_sem, 1);
cfs_sema_init(&lli->lli_write_sem, 1);
- cfs_sema_init(&lli->lli_trunc_sem, 1);
+ cfs_init_rwsem(&lli->lli_trunc_sem);
lli->lli_flags = 0;
lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
cfs_spin_lock_init(&lli->lli_lock);
cfs_sema_init(&lli->lli_rmtperm_sem, 1);
CFS_INIT_LIST_HEAD(&lli->lli_oss_capas);
cfs_spin_lock_init(&lli->lli_sa_lock);
- CFS_INIT_LIST_HEAD(&lli->lli_sa_dentry);
}
+#ifdef HAVE_NEW_BACKING_DEV_INFO
+static atomic_t ll_bdi_num = ATOMIC_INIT(0);
+#endif
+
int ll_fill_super(struct super_block *sb)
{
struct lustre_profile *lprof;
if (err)
GOTO(out_free, err);
+ err = ll_bdi_init(&lsi->bdi);
+ if (err)
+ GOTO(out_free, err);
+
+#ifdef HAVE_NEW_BACKING_DEV_INFO
+ lsi->bdi.name = "lustre";
+ lsi->bdi.capabilities = BDI_CAP_MAP_COPY;
+ err = bdi_register(&lsi->bdi, NULL, "lustre-%d",
+ atomic_inc_return(&ll_bdi_num));
+ sb->s_bdi = &lsi->bdi;
+#endif
+
/* Generate a string unique to this super, in case some joker tries
to mount the same fs at two mount points.
Use the address of the super itself.*/
if (profilenm)
class_del_profile(profilenm);
+ if (ll_bdi_wb_cnt(lsi->bdi) > 0)
+ ll_bdi_destroy(&lsi->bdi);
+
ll_free_sbi(sb);
lsi->lsi_llsbi = NULL;
inode = igrab(lock->l_ast_data);
} else {
inode = lock->l_ast_data;
- ldlm_lock_debug(NULL, inode->i_state & I_FREEING ?
- D_INFO : D_WARNING,
- lock, __FILE__, __func__, __LINE__,
- "l_ast_data %p is bogus: magic %08x",
- lock->l_ast_data, lli->lli_inode_magic);
+ LDLM_DEBUG_LIMIT(inode->i_state & I_FREEING ? D_INFO :
+ D_WARNING, lock, "l_ast_data %p is "
+ "bogus: magic %08x", lock->l_ast_data,
+ lli->lli_inode_magic);
inode = NULL;
}
}
UNLOCK_INODE_MUTEX(inode);
if (ia_valid & ATTR_SIZE)
UP_WRITE_I_ALLOC_SEM(inode);
- cfs_down(&lli->lli_trunc_sem);
+ cfs_down_write(&lli->lli_trunc_sem);
LOCK_INODE_MUTEX(inode);
if (ia_valid & ATTR_SIZE)
DOWN_WRITE_I_ALLOC_SEM(inode);
if (ia_valid & ATTR_SIZE)
attr->ia_valid |= ATTR_SIZE;
- if ((ia_valid & ATTR_SIZE) |
- ((ia_valid | ATTR_ATIME | ATTR_ATIME_SET) &&
- LTIME_S(attr->ia_atime) < LTIME_S(attr->ia_ctime)) ||
- ((ia_valid | ATTR_MTIME | ATTR_MTIME_SET) &&
- LTIME_S(attr->ia_mtime) < LTIME_S(attr->ia_ctime)))
- /* perform truncate and setting mtime/atime to past under PW
- * 0:EOF extent lock (new_size:EOF for truncate) */
+ if (ia_valid & (ATTR_SIZE |
+ ATTR_ATIME | ATTR_ATIME_SET |
+ ATTR_MTIME | ATTR_MTIME_SET))
+ /* on truncate and utimes send attributes to osts, setting
+ * mtime/atime to past will be performed under PW 0:EOF extent
+ * lock (new_size:EOF for truncate)
+ * it may seem excessive to send mtime/atime updates to osts
+ * when not setting times to past, but it is necessary due to
+ * possible time de-synchronization */
rc = ll_setattr_ost(inode, attr);
EXIT;
out:
rc1 = ll_setattr_done_writing(inode, op_data, mod);
ll_finish_md_op_data(op_data);
}
- cfs_up(&lli->lli_trunc_sem);
+ cfs_up_write(&lli->lli_trunc_sem);
return rc ? rc : rc1;
}
CDEBUG(D_VFSTRACE, "VFS Op: at "LPU64" jiffies\n", get_jiffies_64());
ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_STAFS, 1);
- /* For now we will always get up-to-date statfs values, but in the
- * future we may allow some amount of caching on the client (e.g.
- * from QOS or lprocfs updates). */
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - 1, 0);
+ /* Some amount of caching on the client is allowed */
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc)
return rc;
/* Use old size assignment to avoid
* deadlock bz14138 & bz14326 */
inode->i_size = body->size;
+
+ CDEBUG(D_VFSTRACE, "inode=%lu, updating i_size %llu\n",
+ inode->i_ino, (unsigned long long)body->size);
}
if (body->valid & OBD_MD_FLBLOCKS)
}
}
-static struct backing_dev_info ll_backing_dev_info = {
- .ra_pages = 0, /* No readahead */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
- .capabilities = 0, /* Does contribute to dirty memory */
-#else
- .memory_backed = 0, /* Does contribute to dirty memory */
-#endif
-};
-
void ll_read_inode2(struct inode *inode, void *opaque)
{
struct lustre_md *md = opaque;
/* OIDEBUG(inode); */
+ /* initializing backing dev info. */
+ inode->i_mapping->backing_dev_info = &(s2lsi(inode->i_sb)->bdi);
+
+
if (S_ISREG(inode->i_mode)) {
struct ll_sb_info *sbi = ll_i2sbi(inode);
inode->i_op = &ll_file_inode_operations;
init_special_inode(inode, inode->i_mode,
kdev_t_to_nr(inode->i_rdev));
- /* initializing backing dev info. */
- inode->i_mapping->backing_dev_info = &ll_backing_dev_info;
-
EXIT;
}
}
if (sbi->ll_flags & LL_SBI_USER_XATTR)
seq_puts(seq, ",user_xattr");
- if (sbi->ll_flags & LL_SBI_ACL)
- seq_puts(seq, ",acl");
-
if (sbi->ll_flags & LL_SBI_LAZYSTATFS)
seq_puts(seq, ",lazystatfs");