#include <lustre_disk.h>
#include <lustre_param.h>
#include <lustre_log.h>
+#include <obd_cksum.h>
#include "llite_internal.h"
cfs_mem_cache_t *ll_file_data_slab;
GOTO(out_md, err);
}
- err = obd_statfs(obd, &osfs, cfs_time_current_64() - HZ);
+ err = obd_statfs(obd, &osfs, cfs_time_current_64() - HZ, 0);
if (err)
GOTO(out_md_fid, err);
if (sbi->ll_flags & LL_SBI_OSS_CAPA)
data->ocd_connect_flags |= OBD_CONNECT_OSS_CAPA;
+ if (!OBD_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_CKSUM)) {
+ /* OBD_CONNECT_CKSUM should always be set, even if checksums are
+ * disabled by default, because it can still be enabled on the
+ * fly via /proc. As a consequence, we still need to come to an
+ * agreement on the supported algorithms at connect time */
+ data->ocd_connect_flags |= OBD_CONNECT_CKSUM;
+
+ if (OBD_FAIL_CHECK(OBD_FAIL_OSC_CKSUM_ADLER_ONLY))
+ data->ocd_cksum_types = OBD_CKSUM_ADLER;
+ else
+ /* send the list of supported checksum types */
+ data->ocd_cksum_types = OBD_CKSUM_ALL;
+ }
+
#ifdef HAVE_LRU_RESIZE_SUPPORT
data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
#endif
cfs_module_get();
- sb->s_type->fs_flags |= FS_ODD_RENAME;
+ sb->s_type->fs_flags |= FS_RENAME_DOES_D_MOVE;
/* client additional sb info */
lsi->lsi_llsbi = sbi = ll_init_sbi();
if (!sbi) {
OBD_ALLOC_PTR(op_data);
if (op_data == NULL)
RETURN(-ENOMEM);
-
+
memcpy(&op_data->op_attr, attr, sizeof(*attr));
/* Open epoch for truncate. */
- if (ia_valid & ATTR_SIZE)
+ if ((ll_i2mdexp(inode)->exp_connect_flags & OBD_CONNECT_SOM) &&
+ (ia_valid & ATTR_SIZE))
op_data->op_flags = MF_EPOCH_OPEN;
-
+
rc = ll_md_setattr(inode, op_data, &mod);
if (rc)
GOTO(out, rc);
}
int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
- __u64 max_age)
+ __u64 max_age, __u32 flags)
{
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_statfs obd_osfs;
int rc;
ENTRY;
- rc = obd_statfs(class_exp2obd(sbi->ll_md_exp), osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_md_exp), osfs, max_age, flags);
if (rc) {
CERROR("md_statfs fails: rc = %d\n", rc);
RETURN(rc);
osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
rc = obd_statfs_rqset(class_exp2obd(sbi->ll_dt_exp),
- &obd_osfs, max_age, 0);
+ &obd_osfs, max_age, flags);
if (rc) {
CERROR("obd_statfs fails: rc = %d\n", rc);
RETURN(rc);
/* 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);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - 1, 0);
if (rc)
return rc;
if (rc) {
CERROR("fid_delete() failed, rc %d\n", rc);
}
+ truncate_inode_pages(&inode->i_data, 0);
clear_inode(inode);
EXIT;
int ll_obd_statfs(struct inode *inode, void *arg)
{
struct ll_sb_info *sbi = NULL;
- struct obd_device *client_obd = NULL, *lov_obd = NULL;
- struct lov_obd *lov = NULL;
- struct obd_statfs stat_buf = {0};
+ struct obd_export *exp;
char *buf = NULL;
struct obd_ioctl_data *data = NULL;
- __u32 type, index;
+ __u32 type;
int len = 0, rc;
if (!inode || !(sbi = ll_i2sbi(inode)))
GOTO(out_statfs, rc = -EINVAL);
memcpy(&type, data->ioc_inlbuf1, sizeof(__u32));
- memcpy(&index, data->ioc_inlbuf2, sizeof(__u32));
-
- if (type == LL_STATFS_MDC) {
- if (index > 0)
- GOTO(out_statfs, rc = -ENODEV);
- client_obd = class_exp2obd(sbi->ll_md_exp);
- } else if (type == LL_STATFS_LOV) {
- lov_obd = class_exp2obd(sbi->ll_dt_exp);
- lov = &lov_obd->u.lov;
-
- if ((index >= lov->desc.ld_tgt_count))
- GOTO(out_statfs, rc = -ENODEV);
- if (!lov->lov_tgts[index])
- /* Try again with the next index */
- GOTO(out_statfs, rc = -EAGAIN);
-
- client_obd = class_exp2obd(lov->lov_tgts[index]->ltd_exp);
- if (!lov->lov_tgts[index]->ltd_active)
- GOTO(out_uuid, rc = -ENODATA);
- }
-
- if (!client_obd)
- GOTO(out_statfs, rc = -EINVAL);
-
- rc = obd_statfs(client_obd, &stat_buf, cfs_time_current_64() - 1);
+ if (type == LL_STATFS_MDC)
+ exp = sbi->ll_md_exp;
+ 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);
if (rc)
GOTO(out_statfs, rc);
-
- if (copy_to_user(data->ioc_pbuf1, &stat_buf, data->ioc_plen1))
- GOTO(out_statfs, rc = -EFAULT);
-
-out_uuid:
- if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(client_obd),
- data->ioc_plen2))
- rc = -EFAULT;
-
out_statfs:
if (buf)
obd_ioctl_freedata(buf, len);