From: Lokesh Nagappa Jaliminche Date: Mon, 4 Jul 2016 09:04:20 +0000 (+0530) Subject: LU-8365 ldiskfs: procfs entries for mballoc X-Git-Tag: 2.12.52~25 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=75703118588f2b23afd8c8815e5ebb768fc7a8ff LU-8365 ldiskfs: procfs entries for mballoc Export mballoc streaming block allocator variables mb_last_group and mb_last_start through procfs. Test-Parameters: testgroup=review-ldiskfs Change-Id: I5dd00503a81c6819751c9f99b64615b497ef4e28 Cray-bug-id: LUS-3176 Signed-off-by: Lokesh Nagappa Jaliminche Signed-off-by: Alexander Zarochentsev Reviewed-on: https://review.whamcloud.com/21142 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger --- diff --git a/ldiskfs/kernel_patches/patches/rhel7.2/ext4-export-mb-stream-allocator-variables.patch b/ldiskfs/kernel_patches/patches/rhel7.2/ext4-export-mb-stream-allocator-variables.patch new file mode 100644 index 0000000..90e10ae --- /dev/null +++ b/ldiskfs/kernel_patches/patches/rhel7.2/ext4-export-mb-stream-allocator-variables.patch @@ -0,0 +1,103 @@ +Index: linux-3.10.0-327.10.1.el7.x86_64/fs/ext4/mballoc.c +=================================================================== +--- linux-3.10.0-327.10.1.el7.x86_64.orig/fs/ext4/mballoc.c ++++ linux-3.10.0-327.10.1.el7.x86_64/fs/ext4/mballoc.c +@@ -2435,6 +2435,77 @@ static struct kmem_cache *get_groupinfo_ + return cachep; + } + ++#define EXT4_MB_MAX_INPUT_STRING_SIZE 32 ++ ++static ssize_t ext4_mb_last_group_write(struct file *file, ++ const char __user *buf, ++ size_t cnt, loff_t *pos) ++{ ++ char dummy[EXT4_MB_MAX_INPUT_STRING_SIZE + 1]; ++ struct super_block *sb = PDE_DATA(file_inode(file)); ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ unsigned long val; ++ char *end; ++ ++ if (cnt > EXT4_MB_MAX_INPUT_STRING_SIZE) ++ return -EINVAL; ++ if (copy_from_user(dummy, buf, cnt)) ++ return -EFAULT; ++ dummy[cnt] = '\0'; ++ val = simple_strtoul(dummy, &end, 0); ++ if (dummy == end) ++ return -EINVAL; ++ if (val >= ext4_get_groups_count(sb)) ++ return -ERANGE; ++ spin_lock(&sbi->s_md_lock); ++ sbi->s_mb_last_group = val; ++ sbi->s_mb_last_start = 0; ++ spin_unlock(&sbi->s_md_lock); ++ return cnt; ++} ++ ++static int ext4_mb_seq_last_group_seq_show(struct seq_file *m, void *v) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(m->private); ++ ++ seq_printf(m , "%ld\n", sbi->s_mb_last_group); ++ return 0; ++} ++ ++static int ext4_mb_seq_last_group_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, ext4_mb_seq_last_group_seq_show, PDE_DATA(inode)); ++} ++ ++static const struct file_operations ext4_mb_seq_last_group_fops = { ++ .owner = THIS_MODULE, ++ .open = ext4_mb_seq_last_group_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = seq_release, ++ .write = ext4_mb_last_group_write, ++}; ++ ++static int ext4_mb_seq_last_start_seq_show(struct seq_file *m, void *v) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(m->private); ++ ++ seq_printf(m , "%ld\n", sbi->s_mb_last_start); ++ return 0; ++} ++ ++static int ext4_mb_seq_last_start_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, ext4_mb_seq_last_start_seq_show, PDE_DATA(inode)); ++} ++static const struct file_operations ext4_mb_seq_last_start_fops = { ++ .owner = THIS_MODULE, ++ .open = ext4_mb_seq_last_start_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = seq_release, ++}; ++ + /* + * Allocate the top-level s_group_info array for the specified number + * of groups +@@ -2790,6 +2861,11 @@ int ext4_mb_init(struct super_block *sb) + proc_create_data(EXT4_MB_PREALLOC_TABLE, S_IFREG | S_IRUGO | + S_IWUSR, sbi->s_proc, + &ext4_mb_prealloc_seq_fops, sb); ++ proc_create_data("mb_last_group", S_IFREG | S_IRUGO | ++ S_IWUSR, sbi->s_proc, ++ &ext4_mb_seq_last_group_fops, sb); ++ proc_create_data("mb_last_start", S_IFREG | S_IRUGO, ++ sbi->s_proc, &ext4_mb_seq_last_start_fops, sb); + } + + return 0; +@@ -2835,6 +2911,8 @@ int ext4_mb_release(struct super_block * + + if (sbi->s_proc) { + remove_proc_entry("mb_groups", sbi->s_proc); ++ remove_proc_entry("mb_last_group", sbi->s_proc); ++ remove_proc_entry("mb_last_start", sbi->s_proc); + remove_proc_entry(EXT4_MB_PREALLOC_TABLE, sbi->s_proc); + } + diff --git a/ldiskfs/kernel_patches/patches/sles12sp2/ext4-export-mb-stream-allocator-variables.patch b/ldiskfs/kernel_patches/patches/sles12sp2/ext4-export-mb-stream-allocator-variables.patch new file mode 100644 index 0000000..1d9007e --- /dev/null +++ b/ldiskfs/kernel_patches/patches/sles12sp2/ext4-export-mb-stream-allocator-variables.patch @@ -0,0 +1,108 @@ +Index: linux-4.4/fs/ext4/mballoc.c +=================================================================== +--- linux-4.4.orig/fs/ext4/mballoc.c ++++ linux-4.4/fs/ext4/mballoc.c +@@ -2483,6 +2483,77 @@ static struct kmem_cache *get_groupinfo_ + return cachep; + } + ++#define EXT4_MB_MAX_INPUT_STRING_SIZE 32 ++ ++static ssize_t ext4_mb_last_group_write(struct file *file, ++ const char __user *buf, ++ size_t cnt, loff_t *pos) ++{ ++ char dummy[EXT4_MB_MAX_INPUT_STRING_SIZE + 1]; ++ struct super_block *sb = PDE_DATA(file_inode(file)); ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ unsigned long val; ++ char *end; ++ ++ if (cnt > EXT4_MB_MAX_INPUT_STRING_SIZE) ++ return -EINVAL; ++ if (copy_from_user(dummy, buf, cnt)) ++ return -EFAULT; ++ dummy[cnt] = '\0'; ++ val = simple_strtoul(dummy, &end, 0); ++ if (dummy == end) ++ return -EINVAL; ++ if (val >= ext4_get_groups_count(sb)) ++ return -ERANGE; ++ spin_lock(&sbi->s_md_lock); ++ sbi->s_mb_last_group = val; ++ sbi->s_mb_last_start = 0; ++ spin_unlock(&sbi->s_md_lock); ++ return cnt; ++} ++ ++static int ext4_mb_seq_last_group_seq_show(struct seq_file *m, void *v) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(m->private); ++ ++ seq_printf(m , "%ld\n", sbi->s_mb_last_group); ++ return 0; ++} ++ ++static int ext4_mb_seq_last_group_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, ext4_mb_seq_last_group_seq_show, PDE_DATA(inode)); ++} ++ ++const struct file_operations ext4_seq_mb_last_group_fops = { ++ .owner = THIS_MODULE, ++ .open = ext4_mb_seq_last_group_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = seq_release, ++ .write = ext4_mb_last_group_write, ++}; ++ ++static int ext4_mb_seq_last_start_seq_show(struct seq_file *m, void *v) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(m->private); ++ ++ seq_printf(m , "%ld\n", sbi->s_mb_last_start); ++ return 0; ++} ++ ++static int ext4_mb_seq_last_start_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, ext4_mb_seq_last_start_seq_show, PDE_DATA(inode)); ++} ++const struct file_operations ext4_seq_mb_last_start_fops = { ++ .owner = THIS_MODULE, ++ .open = ext4_mb_seq_last_start_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = seq_release, ++}; ++ + /* + * Allocate the top-level s_group_info array for the specified number + * of groups +Index: linux-4.4/fs/ext4/ext4.h +=================================================================== +--- linux-4.4.orig/fs/ext4/ext4.h ++++ linux-4.4/fs/ext4/ext4.h +@@ -2595,6 +2595,8 @@ extern void ext4_end_bitmap_read(struct + /* mballoc.c */ + extern const struct file_operations ext4_seq_prealloc_table_fops; + extern const struct file_operations ext4_seq_mb_groups_fops; ++extern const struct file_operations ext4_seq_mb_last_group_fops; ++extern const struct file_operations ext4_seq_mb_last_start_fops; + extern long ext4_mb_stats; + extern long ext4_mb_max_to_scan; + extern int ext4_mb_init(struct super_block *); +Index: linux-4.4/fs/ext4/sysfs.c +=================================================================== +--- linux-4.4.orig/fs/ext4/sysfs.c ++++ linux-4.4/fs/ext4/sysfs.c +@@ -396,6 +396,8 @@ static struct ext4_proc_files { + PROC_FILE_LIST(es_shrinker_info), + PROC_FILE_LIST(mb_groups), + PROC_FILE_LIST(prealloc_table), ++ PROC_FILE_LIST(mb_last_group), ++ PROC_FILE_LIST(mb_last_start), + { NULL, NULL }, + }; + diff --git a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.5.series b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.5.series index 33c2ddf..ad3e2bd 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.5.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.5.series @@ -36,3 +36,4 @@ rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch rhel7/ext4-export-orphan-add.patch rhel7/ext4-mmp-dont-mark-bh-dirty.patch rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch +rhel7.2/ext4-export-mb-stream-allocator-variables.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.6.series b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.6.series index 128de77..4452882 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.6.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.6.series @@ -36,3 +36,4 @@ rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch rhel7/ext4-export-orphan-add.patch rhel7/ext4-mmp-dont-mark-bh-dirty.patch rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch +rhel7.2/ext4-export-mb-stream-allocator-variables.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-4.15.0-24-ubuntu18.series b/ldiskfs/kernel_patches/series/ldiskfs-4.15.0-24-ubuntu18.series index 69f0dc9..5c6c4a9 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-4.15.0-24-ubuntu18.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-4.15.0-24-ubuntu18.series @@ -22,3 +22,4 @@ rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch rhel7/ext4-export-orphan-add.patch rhel7/ext4-mmp-dont-mark-bh-dirty.patch ubuntu18/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch +sles12sp2/ext4-export-mb-stream-allocator-variables.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series b/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series index d3d1765..5aff249 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series @@ -28,3 +28,4 @@ rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch rhel7/ext4-export-orphan-add.patch rhel7/ext4-mmp-dont-mark-bh-dirty.patch rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch +sles12sp2/ext4-export-mb-stream-allocator-variables.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp3.series b/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp3.series index 03fc6e3..9f32a73 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp3.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp3.series @@ -27,3 +27,4 @@ sles12sp2/ext4-fix-xattr-shifting-when-expanding-inodes.patch rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch rhel7/ext4-export-orphan-add.patch rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch +sles12sp2/ext4-export-mb-stream-allocator-variables.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-4.4.0-73-ubuntu14+16.series b/ldiskfs/kernel_patches/series/ldiskfs-4.4.0-73-ubuntu14+16.series index 69bf394..934c97e 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-4.4.0-73-ubuntu14+16.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-4.4.0-73-ubuntu14+16.series @@ -25,3 +25,4 @@ rhel7/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch rhel7/ext4-export-orphan-add.patch rhel7/ext4-mmp-dont-mark-bh-dirty.patch rhel7/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch +sles12sp2/ext4-export-mb-stream-allocator-variables.patch