linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: clarify btrfs_ioctl_get_dev_stats padding
@ 2019-08-03 21:36 Hans van Kranenburg
  2019-08-05 18:07 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Hans van Kranenburg @ 2019-08-03 21:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Hans van Kranenburg

From: Hans van Kranenburg <hans.van.kranenburg@mendix.com>

In commit c11d2c236cc26 the get_dev_stats ioctl was added.

Shortly thereafter, in commit b27f7c0c150f7, the flags field was added.
However, the calculation for unused padding space was not updated, which
also invalidated the comment.

Clarify what happened to reduce confusion and wasted time for anyone
implementing this.

Signed-off-by: Hans van Kranenburg <hans.van.kranenburg@mendix.com>
---
 include/uapi/linux/btrfs.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 7885d79f7515..3ee0678c0a83 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -665,7 +665,12 @@ 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 */
+	/*
+	 * This pads the struct to 1032 bytes. It was originally meant to pad to
+	 * 1024 bytes, but when adding the flags field, the padding calculation
+	 * was not adjusted.
+	 */
+	__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
 };
 
 #define BTRFS_QUOTA_CTL_ENABLE	1
-- 
2.20.1


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

* Re: [PATCH] btrfs: clarify btrfs_ioctl_get_dev_stats padding
  2019-08-03 21:36 [PATCH] btrfs: clarify btrfs_ioctl_get_dev_stats padding Hans van Kranenburg
@ 2019-08-05 18:07 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2019-08-05 18:07 UTC (permalink / raw)
  To: Hans van Kranenburg; +Cc: linux-btrfs, Hans van Kranenburg

On Sat, Aug 03, 2019 at 11:36:34PM +0200, Hans van Kranenburg wrote:
> From: Hans van Kranenburg <hans.van.kranenburg@mendix.com>
> 
> In commit c11d2c236cc26 the get_dev_stats ioctl was added.
> 
> Shortly thereafter, in commit b27f7c0c150f7, the flags field was added.
> However, the calculation for unused padding space was not updated, which
> also invalidated the comment.
> 
> Clarify what happened to reduce confusion and wasted time for anyone
> implementing this.
> 
> Signed-off-by: Hans van Kranenburg <hans.van.kranenburg@mendix.com>

Reviewed-by: David Sterba <dsterba@suse.com>

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

end of thread, other threads:[~2019-08-05 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-03 21:36 [PATCH] btrfs: clarify btrfs_ioctl_get_dev_stats padding Hans van Kranenburg
2019-08-05 18:07 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).