Пример #1
0
static int osc_wr_cur_grant_bytes(struct file *file, const char *buffer,
                                  unsigned long count, void *data)
{
        struct obd_device *obd = data;
        struct client_obd *cli = &obd->u.cli;
        int                rc;
        __u64              val;

        if (obd == NULL)
                return 0;

        rc = lprocfs_write_u64_helper(buffer, count, &val);
        if (rc)
                return rc;

        /* this is only for shrinking grant */
        client_obd_list_lock(&cli->cl_loi_list_lock);
        if (val >= cli->cl_avail_grant) {
                client_obd_list_unlock(&cli->cl_loi_list_lock);
                return 0;
        }
        client_obd_list_unlock(&cli->cl_loi_list_lock);

        LPROCFS_CLIMP_CHECK(obd);
        if (cli->cl_import->imp_state == LUSTRE_IMP_FULL)
                rc = osc_shrink_grant_to_target(cli, val);
        LPROCFS_CLIMP_EXIT(obd);
        if (rc)
                return rc;
        return count;
}
Пример #2
0
/**
 * Set default stripe offset.
 *
 * Usually contains -1 allowing Lustre to balance objects among OST
 * otherwise may cause severe OST imbalance.
 *
 * \param[in] file	proc file
 * \param[in] buffer	string describing starting OST index for new files
 * \param[in] count	@buffer length
 * \param[in] off	unused for single entry
 *
 * \retval @count	on success
 * \retval negative	error code if failed
 */
static ssize_t
lod_stripeoffset_seq_write(struct file *file, const char __user *buffer,
			   size_t count, loff_t *off)
{
	struct seq_file   *m = file->private_data;
	struct obd_device *dev = m->private;
	struct lod_device *lod;
	__u64 val;
	int rc;

	LASSERT(dev != NULL);
	lod  = lu2lod_dev(dev->obd_lu_dev);
	rc = lprocfs_write_u64_helper(buffer, count, &val);
	if (rc)
		return rc;

	lod->lod_desc.ld_default_stripe_offset = val;
	return count;
}
Пример #3
0
int lprocfs_osd_wr_readcache(struct file *file, const char *buffer,
			     unsigned long count, void *data)
{
	struct osd_device	*osd = osd_dt_dev(data);
	__u64			 val;
	int			 rc;

	LASSERT(osd != NULL);
	if (unlikely(osd->od_mnt == NULL))
		return -EINPROGRESS;

	rc = lprocfs_write_u64_helper(buffer, count, &val);
	if (rc)
		return rc;

	osd->od_readcache_max_filesize = val > OSD_MAX_CACHE_SIZE ?
					 OSD_MAX_CACHE_SIZE : val;
	return count;
}
Пример #4
0
ssize_t
ldiskfs_osd_readcache_seq_write(struct file *file, const char *buffer,
				size_t count, loff_t *off)
{
	struct seq_file	  *m = file->private_data;
	struct dt_device  *dt = m->private;
	struct osd_device *osd = osd_dt_dev(dt);
	__u64		   val;
	int		   rc;

	LASSERT(osd != NULL);
	if (unlikely(osd->od_mnt == NULL))
		return -EINPROGRESS;

	rc = lprocfs_write_u64_helper(buffer, count, &val);
	if (rc)
		return rc;

	osd->od_readcache_max_filesize = val > OSD_MAX_CACHE_SIZE ?
					 OSD_MAX_CACHE_SIZE : val;
	return count;
}