linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: trivial code style fix to shmem_statfs
@ 2014-07-14  7:52 Wang Sheng-Hui
  2014-07-14 19:36 ` Hugh Dickins
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Sheng-Hui @ 2014-07-14  7:52 UTC (permalink / raw)
  To: Hugh Dickins, linux-mm


Should read the super_block fields, even if current implementation uses
the same constants.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
 mm/shmem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 1140f49..368523b 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1874,10 +1874,11 @@ out:

 static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
-       struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
+       struct super_block *sb = dentry->d_sb;
+       struct shmem_sb_info *sbinfo = SHMEM_SB(sb);

-       buf->f_type = TMPFS_MAGIC;
-       buf->f_bsize = PAGE_CACHE_SIZE;
+       buf->f_type = sb->s_magic;
+       buf->f_bsize = sb->s_blocksize;
        buf->f_namelen = NAME_MAX;
        if (sbinfo->max_blocks) {
                buf->f_blocks = sbinfo->max_blocks;
-- 
1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: trivial code style fix to shmem_statfs
  2014-07-14  7:52 [PATCH] mm: trivial code style fix to shmem_statfs Wang Sheng-Hui
@ 2014-07-14 19:36 ` Hugh Dickins
  0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2014-07-14 19:36 UTC (permalink / raw)
  To: Wang Sheng-Hui; +Cc: linux-mm

On Mon, 14 Jul 2014, Wang Sheng-Hui wrote:
> 
> Should read the super_block fields, even if current implementation uses
> the same constants.
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>

I prefer how it is already, more direct, less code.
They are very unlikely to change: if they do, we can update then.

If you're looking for a trivial patch to make in mm/shmem.c,
I suggest removing the unused gfp arg to shmem_add_to_page_cache().

Hugh

> ---
>  mm/shmem.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 1140f49..368523b 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1874,10 +1874,11 @@ out:
> 
>  static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
>  {
> -       struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
> +       struct super_block *sb = dentry->d_sb;
> +       struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
> 
> -       buf->f_type = TMPFS_MAGIC;
> -       buf->f_bsize = PAGE_CACHE_SIZE;
> +       buf->f_type = sb->s_magic;
> +       buf->f_bsize = sb->s_blocksize;
>         buf->f_namelen = NAME_MAX;
>         if (sbinfo->max_blocks) {
>                 buf->f_blocks = sbinfo->max_blocks;
> -- 
> 1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-14 19:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-14  7:52 [PATCH] mm: trivial code style fix to shmem_statfs Wang Sheng-Hui
2014-07-14 19:36 ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox