示例#1
0
/**
 * Set default number of stripes.
 *
 * \param[in] file	proc file
 * \param[in] buffer	string containing the default number of stripes
 *			for new files
 * \param[in] count	@buffer length
 * \param[in] off	unused for single entry
 *
 * \retval @count	on success
 * \retval negative	error code otherwise
 */
static ssize_t
lod_stripecount_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;
	int rc;
	__s64 val;
	__u32 stripe_count;

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

	stripe_count = val;
	lod_fix_desc_stripe_count(&stripe_count);
	lod->lod_desc.ld_default_stripe_count = stripe_count;

	return count;
}
示例#2
0
/**
 * Set default number of stripes.
 *
 * \param[in] file	proc file
 * \param[in] buffer	string containing the default number of stripes
 *			for new files
 * \param[in] count	@buffer length
 * \param[in] off	unused for single entry
 *
 * \retval @count	on success
 * \retval negative	error code otherwise
 */
static ssize_t
lod_stripecount_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;
	int val, rc;

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

	lod_fix_desc_stripe_count(&val);
	lod->lod_desc.ld_default_stripe_count = val;
	return count;
}