Re: [PATCH v6 07/10] xfs: add inode id filtering to eofblocks scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 06, 2012 at 09:50:44AM -0500, Brian Foster wrote:
> Support inode ID filtering in the eofblocks scan. The caller must
> set the associated XFS_EOF_FLAGS_*ID bit and ID field.
> 
> Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
> ---
>  fs/xfs/xfs_fs.h     |   11 +++++++++--
>  fs/xfs/xfs_icache.c |   22 ++++++++++++++++++++++
>  2 files changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
> index 26ff43a..88eb1bc 100644
> --- a/fs/xfs/xfs_fs.h
> +++ b/fs/xfs/xfs_fs.h
> @@ -345,13 +345,20 @@ typedef struct xfs_error_injection {
>  struct xfs_eofblocks {
>  	__u32		eof_version;
>  	__u32		eof_flags;
> -	__u64		pad[15];
> +	uid_t		eof_uid;
> +	gid_t		eof_gid;
> +	prid_t		eof_prid;
> +	__u32		pad[27];
>  };

The typical way of doing this to ensure that the structure remains
the same size and people are aware of alignment issues is this:

 -	__u64		pad[15];
 +	uid_t		eof_uid;
 +	gid_t		eof_gid;
 +	prid_t		eof_prid;
 +	__u32		pad32;
 +	__u64		pad64[13];

That way it is clear that we need pad out to 8 byte boundaries even
on 32 bit systems.

>  
>  /* eof_flags values */
>  #define XFS_EOF_FLAGS_SYNC		(1 << 0) /* sync/wait mode scan */
> +#define XFS_EOF_FLAGS_UID		(1 << 1) /* filter by uid */
> +#define XFS_EOF_FLAGS_GID		(1 << 2) /* filter by gid */
> +#define XFS_EOF_FLAGS_PRID		(1 << 3) /* filter by project id */
>  #define XFS_EOF_FLAGS_VALID	\
> -	(XFS_EOF_FLAGS_SYNC)
> +	(XFS_EOF_FLAGS_SYNC|XFS_EOF_FLAGS_UID|XFS_EOF_FLAGS_GID| \
> +	 XFS_EOF_FLAGS_PRID)

A little bit of white space goes a long way:

#define XFS_EOF_FLAGS_VALID \
	(XFS_EOF_FLAGS_SYNC | \
	 XFS_EOF_FLAGS_UID | \
	 XFS_EOF_FLAGS_GID | \
	 XFS_EOF_FLAGS_PRID)

Is much easier to read and extend in future.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux