*/
/* LASSERT(current->journal_info == NULL); */
- inode = ldiskfs_iget(osd_sb(dev), id->oii_ino);
+ inode = osd_ldiskfs_iget(osd_sb(dev), id->oii_ino);
if (IS_ERR(inode)) {
CDEBUG(D_INODE, "no inode: ino = %u, rc = %ld\n",
id->oii_ino, PTR_ERR(inode));
*/
again:
- inode = ldiskfs_iget(osd_sb(dev), id->oii_ino);
+ inode = osd_ldiskfs_iget(osd_sb(dev), id->oii_ino);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
if (!trusted && (rc == -ENOENT || rc == -ESTALE))
goto trigger;
}
+ /* -ESTALE is returned if inode of OST object doesn't exist */
+ if (result == -ESTALE &&
+ fid_is_on_ost(info, dev, fid, OI_CHECK_FLD)) {
+ GOTO(out, result = 0);
+ }
+
if (result)
GOTO(out, result);
LASSERT(!updated);
+ /*
+ * if two OST objects map to the same inode, and inode mode is
+ * (S_IFREG | S_ISUID | S_ISGID | S_ISVTX | 0666), which means it's
+ * reserved by precreate, and not written yet, in this case, don't
+ * set inode for the object whose FID mismatch, so that it can create
+ * inode and not block precreate.
+ */
+ if (fid_is_on_ost(info, dev, fid, OI_CHECK_FLD) &&
+ inode->i_mode == (S_IFREG | S_ISUID | S_ISGID | S_ISVTX | 0666)) {
+ obj->oo_inode = NULL;
+ GOTO(out, result = 0);
+ }
+
result = osd_oi_lookup(info, dev, fid, id, OI_CHECK_FLD);
/*
* "result == -ENOENT" means the cached OI mapping has been removed
*/
if (last_credits != oh->ot_credits &&
time_after(jiffies, last_printed +
- msecs_to_jiffies(60 * MSEC_PER_SEC)) &&
+ cfs_time_seconds(60)) &&
osd_transaction_size(dev) > 512) {
CWARN("%s: credits %u > trans_max %u\n", osd_name(dev),
oh->ot_credits, osd_transaction_size(dev));
* Concurrency: shouldn't matter.
*/
int osd_statfs(const struct lu_env *env, struct dt_device *d,
- struct obd_statfs *sfs)
+ struct obd_statfs *sfs, struct obd_statfs_info *info)
{
struct osd_device *osd = osd_dt_dev(d);
struct super_block *sb = osd_sb(osd);
goto out;
statfs_pack(sfs, ksfs);
- if (unlikely(sb->s_flags & MS_RDONLY))
+ if (unlikely(sb->s_flags & SB_RDONLY))
sfs->os_state |= OS_STATE_READONLY;
+
+ sfs->os_state |= osd->od_nonrotational ? OS_STATE_NONROT : 0;
+
if (ldiskfs_has_feature_extents(sb))
sfs->os_maxbytes = sb->s_maxbytes;
else
#endif
param->ddp_max_ea_size = sb->s_blocksize - ea_overhead;
- if (param->ddp_max_ea_size > OBD_MAX_EA_SIZE - ea_overhead)
- param->ddp_max_ea_size = OBD_MAX_EA_SIZE - ea_overhead;
+ if (param->ddp_max_ea_size > OBD_MAX_EA_SIZE)
+ param->ddp_max_ea_size = OBD_MAX_EA_SIZE;
/*
* Preferred RPC size for efficient disk IO. 4MB shows good
return obj->oo_owner == env;
}
-static struct timespec *osd_inode_time(const struct lu_env *env,
- struct inode *inode, __u64 seconds)
-{
- struct osd_thread_info *oti = osd_oti_get(env);
- struct timespec *t = &oti->oti_time;
-
- t->tv_sec = seconds;
- t->tv_nsec = 0;
- *t = timespec_trunc(*t, inode->i_sb->s_time_gran);
- return t;
-}
-
static void osd_inode_getattr(const struct lu_env *env,
struct inode *inode, struct lu_attr *attr)
{
return 0;
if (bits & LA_ATIME)
- inode->i_atime = *osd_inode_time(env, inode, attr->la_atime);
+ inode->i_atime = osd_inode_time(inode, attr->la_atime);
if (bits & LA_CTIME)
- inode->i_ctime = *osd_inode_time(env, inode, attr->la_ctime);
+ inode->i_ctime = osd_inode_time(inode, attr->la_ctime);
if (bits & LA_MTIME)
- inode->i_mtime = *osd_inode_time(env, inode, attr->la_mtime);
+ inode->i_mtime = osd_inode_time(inode, attr->la_mtime);
if (bits & LA_SIZE) {
spin_lock(&inode->i_lock);
LDISKFS_I(inode)->i_disksize = attr->la_size;
osd_id_gen(id, obj->oo_inode->i_ino, obj->oo_inode->i_generation);
rc = osd_oi_insert(info, osd, fid, id, oh->ot_handle,
OI_CHECK_FLD, NULL);
+ if (CFS_FAIL_CHECK(OBD_FAIL_OSD_DUPLICATE_MAP) && osd->od_is_ost) {
+ struct lu_fid next_fid = *fid;
+
+ /* insert next object in advance, and map to the same inode */
+ next_fid.f_oid++;
+ if (next_fid.f_oid != 0) {
+ osd_trans_exec_op(env, th, OSD_OT_INSERT);
+ osd_oi_insert(info, osd, &next_fid, id, oh->ot_handle,
+ OI_CHECK_FLD, NULL);
+ osd_trans_exec_check(env, th, OSD_OT_INSERT);
+ }
+ }
+
osd_trans_exec_check(env, th, OSD_OT_INSERT);
return rc;
*/
osd_trans_declare_op(env, oh, OSD_OT_INSERT,
osd_dto_credits_noquota[DTO_INDEX_INSERT] + 1);
+ if (CFS_FAIL_CHECK(OBD_FAIL_OSD_DUPLICATE_MAP))
+ osd_trans_declare_op(env, oh, OSD_OT_INSERT,
+ osd_dto_credits_noquota[DTO_INDEX_INSERT] + 1);
/* will help to find FID->ino mapping at dt_insert() */
rc = osd_idc_find_and_init(env, osd_obj2dev(osd_dt_obj(dt)),
file->f_op = inode->i_fop;
set_file_inode(file, inode);
- rc = ll_vfs_fsync_range(file, start, end, 0);
+ rc = vfs_fsync_range(file, start, end, 0);
RETURN(rc);
}
o->od_read_cache = 1;
o->od_writethrough_cache = 1;
o->od_readcache_max_filesize = OSD_MAX_CACHE_SIZE;
+
o->od_auto_scrub_interval = AS_DEFAULT;
cplen = strlcpy(o->od_svname, lustre_cfg_string(cfg, 4),
if (rc != 0)
GOTO(out, rc);
+ /* Can only check block device after mount */
+ o->od_nonrotational =
+ blk_queue_nonrot(bdev_get_queue(osd_sb(o)->s_bdev));
+
rc = osd_obj_map_init(env, o);
if (rc != 0)
GOTO(out_mnt, rc);
struct osd_device *osd = osd_dev(obd->obd_lu_dev);
struct super_block *sb = osd_sb(osd);
- return (osd->od_mnt == NULL || sb->s_flags & MS_RDONLY);
+ return (osd->od_mnt == NULL || sb->s_flags & SB_RDONLY);
}
/*