#define DEBUG_SUBSYSTEM S_LLITE
#include <linux/version.h>
+#include <linux/user_namespace.h>
+#ifdef HAVE_UIDGID_HEADER
+# include <linux/uidgid.h>
+#endif
#include <lustre_param.h>
#include <lprocfs_status.h>
#include <obd_support.h>
size_t count, loff_t *off)
{
struct seq_file *m = file->private_data;
- struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
__u64 val;
long pages_number;
- int mult;
+ int pages_shift;
int rc;
- mult = 1 << (20 - PAGE_CACHE_SHIFT);
- rc = lprocfs_write_frac_u64_helper(buffer, count, &val, mult);
+ pages_shift = 20 - PAGE_CACHE_SHIFT;
+ rc = lprocfs_write_frac_u64_helper(buffer, count, &val,
+ 1 << pages_shift);
if (rc)
return rc;
if (pages_number < 0 || pages_number > totalram_pages / 2) {
/* 1/2 of RAM */
- CERROR("can't set file readahead more than %lu MB\n",
- totalram_pages >> (20 - PAGE_CACHE_SHIFT + 1));
+ CERROR("%s: can't set max_readahead_mb=%lu > %luMB\n",
+ ll_get_fsname(sb, NULL, 0), pages_number >> pages_shift,
+ totalram_pages >> (pages_shift + 1));
return -ERANGE;
}
size_t count, loff_t *off)
{
struct seq_file *m = file->private_data;
- struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
- int mult, rc, pages_number;
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ int pages_shift, rc, pages_number;
- mult = 1 << (20 - PAGE_CACHE_SHIFT);
- rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
+ pages_shift = 20 - PAGE_CACHE_SHIFT;
+ rc = lprocfs_write_frac_helper(buffer, count, &pages_number,
+ 1 << pages_shift);
if (rc)
return rc;
- if (pages_number < 0 ||
- pages_number > sbi->ll_ra_info.ra_max_pages) {
- CERROR("can't set file readahead more than"
- "max_read_ahead_mb %lu MB\n",
- sbi->ll_ra_info.ra_max_pages);
+ if (pages_number < 0 || pages_number > sbi->ll_ra_info.ra_max_pages) {
+ CERROR("%s: can't set max_readahead_per_file_mb=%u > "
+ "max_read_ahead_mb=%lu\n", ll_get_fsname(sb, NULL, 0),
+ pages_number >> pages_shift,
+ sbi->ll_ra_info.ra_max_pages >> pages_shift);
return -ERANGE;
}
size_t count, loff_t *off)
{
struct seq_file *m = file->private_data;
- struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
- int mult, rc, pages_number;
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ int pages_shift, rc, pages_number;
- mult = 1 << (20 - PAGE_CACHE_SHIFT);
- rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
+ pages_shift = 20 - PAGE_CACHE_SHIFT;
+ rc = lprocfs_write_frac_helper(buffer, count, &pages_number,
+ 1 << pages_shift);
if (rc)
return rc;
* algorithm does this anyway so it's pointless to set it larger. */
if (pages_number < 0 ||
pages_number > sbi->ll_ra_info.ra_max_pages_per_file) {
- CERROR("can't set max_read_ahead_whole_mb more than "
- "max_read_ahead_per_file_mb: %lu\n",
- sbi->ll_ra_info.ra_max_pages_per_file >>
- (20 - PAGE_CACHE_SHIFT));
+ CERROR("%s: can't set max_read_ahead_whole_mb=%u > "
+ "max_read_ahead_per_file_mb=%lu\n",
+ ll_get_fsname(sb, NULL, 0),
+ pages_number >> pages_shift,
+ sbi->ll_ra_info.ra_max_pages_per_file >> pages_shift);
return -ERANGE;
}
{
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
- struct cl_client_cache *cache = &sbi->ll_cache;
+ struct cl_client_cache *cache = sbi->ll_cache;
int shift = 20 - PAGE_CACHE_SHIFT;
long max_cached_mb;
long unused_mb;
struct seq_file *m = file->private_data;
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
- struct cl_client_cache *cache = &sbi->ll_cache;
+ struct cl_client_cache *cache = sbi->ll_cache;
struct lu_env *env;
__u64 val;
long diff = 0;
}
LPROC_SEQ_FOPS(ll_checksum);
-static int ll_max_rw_chunk_seq_show(struct seq_file *m, void *v)
-{
- struct super_block *sb = m->private;
-
- return seq_printf(m, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk);
-}
-
-static ssize_t ll_max_rw_chunk_seq_write(struct file *file,
- const char __user *buffer,
- size_t count, loff_t *off)
-{
- struct seq_file *m = file->private_data;
- struct super_block *sb = m->private;
- int rc, val;
-
- rc = lprocfs_write_helper(buffer, count, &val);
- if (rc)
- return rc;
- ll_s2sbi(sb)->ll_max_rw_chunk = val;
- return count;
-}
-LPROC_SEQ_FOPS(ll_max_rw_chunk);
-
static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type)
{
struct super_block *sb = m->private;
}
LPROC_SEQ_FOPS_RO(ll_max_easize);
-static int ll_defult_easize_seq_show(struct seq_file *m, void *v)
+/**
+ * Get default_easize.
+ *
+ * \see client_obd::cl_default_mds_easize
+ *
+ * \param[in] m seq_file handle
+ * \param[in] v unused for single entry
+ *
+ * \retval 0 on success
+ * \retval negative negated errno on failure
+ */
+static int ll_default_easize_seq_show(struct seq_file *m, void *v)
{
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
return seq_printf(m, "%u\n", ealen);
}
-LPROC_SEQ_FOPS_RO(ll_defult_easize);
-static int ll_max_cookiesize_seq_show(struct seq_file *m, void *v)
+/**
+ * Set default_easize.
+ *
+ * Range checking on the passed value is handled by
+ * ll_set_default_mdsize().
+ *
+ * \see client_obd::cl_default_mds_easize
+ *
+ * \param[in] file proc file
+ * \param[in] buffer string passed from user space
+ * \param[in] count \a buffer length
+ * \param[in] off unused for single entry
+ *
+ * \retval positive \a count on success
+ * \retval negative negated errno on failure
+ */
+static ssize_t ll_default_easize_seq_write(struct file *file,
+ const char __user *buffer,
+ size_t count, loff_t *unused)
{
- struct super_block *sb = m->private;
- struct ll_sb_info *sbi = ll_s2sbi(sb);
- unsigned int cookielen;
- int rc;
+ struct seq_file *seq = file->private_data;
+ struct super_block *sb = (struct super_block *)seq->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ int val;
+ int rc;
- rc = ll_get_max_cookiesize(sbi, &cookielen);
- if (rc)
- return rc;
-
- return seq_printf(m, "%u\n", cookielen);
-}
-LPROC_SEQ_FOPS_RO(ll_max_cookiesize);
+ if (count == 0)
+ return 0;
-static int ll_defult_cookiesize_seq_show(struct seq_file *m, void *v)
-{
- struct super_block *sb = m->private;
- struct ll_sb_info *sbi = ll_s2sbi(sb);
- unsigned int cookielen;
- int rc;
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc < 0)
+ return rc;
- rc = ll_get_default_cookiesize(sbi, &cookielen);
+ rc = ll_set_default_mdsize(sbi, val);
if (rc)
return rc;
- return seq_printf(m, "%u\n", cookielen);
+ return count;
}
-LPROC_SEQ_FOPS_RO(ll_defult_cookiesize);
+LPROC_SEQ_FOPS(ll_default_easize);
static int ll_sbi_flags_seq_show(struct seq_file *m, void *v)
{
{
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
- struct cl_client_cache *cache = &sbi->ll_cache;
+ struct cl_client_cache *cache = sbi->ll_cache;
long pages;
int mb;
return rc;
/* borrow lru lock to set the value */
- spin_lock(&sbi->ll_cache.ccc_lru_lock);
- sbi->ll_cache.ccc_unstable_check = !!val;
- spin_unlock(&sbi->ll_cache.ccc_lru_lock);
+ spin_lock(&sbi->ll_cache->ccc_lru_lock);
+ sbi->ll_cache->ccc_unstable_check = !!val;
+ spin_unlock(&sbi->ll_cache->ccc_lru_lock);
return count;
}
{ .name = "blocksize",
.fops = &ll_blksize_fops },
{ .name = "kbytestotal",
- .fops = &ll_kbytestotal_fops },
+ .fops = &ll_kbytestotal_fops },
{ .name = "kbytesfree",
.fops = &ll_kbytesfree_fops },
{ .name = "kbytesavail",
.fops = &ll_max_cached_mb_fops },
{ .name = "checksum_pages",
.fops = &ll_checksum_fops },
- { .name = "max_rw_chunk",
- .fops = &ll_max_rw_chunk_fops },
{ .name = "stats_track_pid",
.fops = &ll_track_pid_fops },
{ .name = "stats_track_ppid",
{ .name = "statahead_stats",
.fops = &ll_statahead_stats_fops },
{ .name = "lazystatfs",
- .fops = &ll_lazystatfs_fops },
+ .fops = &ll_lazystatfs_fops },
{ .name = "max_easize",
- .fops = &ll_max_easize_fops },
+ .fops = &ll_max_easize_fops },
{ .name = "default_easize",
- .fops = &ll_defult_easize_fops },
- { .name = "max_cookiesize",
- .fops = &ll_max_cookiesize_fops },
- { .name = "default_cookiesize",
- .fops = &ll_defult_cookiesize_fops },
+ .fops = &ll_default_easize_fops },
{ .name = "sbi_flags",
- .fops = &ll_sbi_flags_fops },
+ .fops = &ll_sbi_flags_fops },
{ .name = "xattr_cache",
.fops = &ll_xattr_cache_fops },
{ .name = "unstable_stats",