diff mbox

btrfs: fix wrong pad for kernelspace arg of btrfs dev stat

Message ID 1413424419-15237-1-git-send-email-guihc.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gui Hecheng Oct. 16, 2014, 1:53 a.m. UTC
The @btrfs_ioctl_get_dev_stats fails to pad to 1k as descripted,
actually it valuates to 1032 bytes.
The corresponding userspace change follows this change.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
 include/uapi/linux/btrfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Behrens Oct. 16, 2014, 9:26 a.m. UTC | #1
On Thu, 16 Oct 2014 09:53:37 +0800, Gui Hecheng wrote:
> The @btrfs_ioctl_get_dev_stats fails to pad to 1k as descripted,
> actually it valuates to 1032 bytes.
> The corresponding userspace change follows this change.
> 
> Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
> ---
>  include/uapi/linux/btrfs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
> index 2f47824..fc4e326 100644
> --- a/include/uapi/linux/btrfs.h
> +++ b/include/uapi/linux/btrfs.h
> @@ -416,7 +416,7 @@ struct btrfs_ioctl_get_dev_stats {
>  	/* out values: */
>  	__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
>  
> -	__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */
> +	__u64 unused[128 - 3 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */

You can't change an existing ioctl interface like this and make it
incompatible, the length of the structure is used in _IOWR(). Just
change the comment from "pad to 1k" to "pad to 1032 bytes" instead.


>  };
>  
>  #define BTRFS_QUOTA_CTL_ENABLE	1
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gui Hecheng Oct. 16, 2014, 9:41 a.m. UTC | #2
On Thu, 2014-10-16 at 11:26 +0200, Stefan Behrens wrote:
> On Thu, 16 Oct 2014 09:53:37 +0800, Gui Hecheng wrote:
> > The @btrfs_ioctl_get_dev_stats fails to pad to 1k as descripted,
> > actually it valuates to 1032 bytes.
> > The corresponding userspace change follows this change.
> > 
> > Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
> > ---
> >  include/uapi/linux/btrfs.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
> > index 2f47824..fc4e326 100644
> > --- a/include/uapi/linux/btrfs.h
> > +++ b/include/uapi/linux/btrfs.h
> > @@ -416,7 +416,7 @@ struct btrfs_ioctl_get_dev_stats {
> >  	/* out values: */
> >  	__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
> >  
> > -	__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */
> > +	__u64 unused[128 - 3 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */
> 
> You can't change an existing ioctl interface like this and make it
> incompatible, the length of the structure is used in _IOWR(). Just
> change the comment from "pad to 1k" to "pad to 1032 bytes" instead.

Er... yeah, the problem exists, and such a fix seems cost much.
Since the related tool itself doesn't influence much, just scratch these
two may be a reasonable idea. ^_^

("pad to 1032 bytes" seems a bit...) 

> 
> >  };
> >  
> >  #define BTRFS_QUOTA_CTL_ENABLE	1
> > 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 2f47824..fc4e326 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -416,7 +416,7 @@  struct btrfs_ioctl_get_dev_stats {
 	/* out values: */
 	__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
 
-	__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */
+	__u64 unused[128 - 3 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */
 };
 
 #define BTRFS_QUOTA_CTL_ENABLE	1