[Devel] [PATCH VZ9 2/2] fs/fuse/kio: remove aligned-inside-packed kludge
    Pavel Tikhomirov 
    ptikhomirov at virtuozzo.com
       
    Wed Oct 22 14:23:42 MSK 2025
    
    
  
I see that we still use __pre_aligned() and __pre_packed in other places 
but they are defined like:
#if defined(__GNUC__) || defined(__clang__)
#define __pre_aligned(x)
#define __pre_packed
So my question is, do they actually do/did something? At least now they 
seem empty.
On 10/20/25 16:36, Alexey Kuznetsov wrote:
> Old days this ugly trick was copypasted from user space, where
> it allowed to use SSE on packet data. Note how ugly
> and counterintuitive it is: we deliberately misalign buffer
> start to enforce data to be aligned to 16 bytes.
> This trick has been removed from user space long ago, we optimized
> the engine to use aligned data.
> 
> And in kernel it never made a sense. I was just afraid I forgot
> something and avoided to touch this antique detail.
> 
> Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
> ---
>   fs/fuse/kio/pcs/pcs_sock_io.h | 80 +++++++++++++++++++++----------------------
>   1 file changed, 39 insertions(+), 41 deletions(-)
> 
> diff --git a/fs/fuse/kio/pcs/pcs_sock_io.h b/fs/fuse/kio/pcs/pcs_sock_io.h
> index b14e992..ab549a1 100644
> --- a/fs/fuse/kio/pcs/pcs_sock_io.h
> +++ b/fs/fuse/kio/pcs/pcs_sock_io.h
> @@ -46,49 +46,46 @@ enum pcs_msg_flag {
>   	PCS_MSG_ABORTED,
>   };
>   
> -__pre_packed struct pcs_msg
> +struct pcs_msg
>   {
> -	struct __pre_aligned(16) {
> -		struct list_head list;
> -
> -		pcs_error_t	error;
> -		abs_time_t	start_time;
> -
> -		void		*private;
> -		void		*private2;	/* Huh? Need to do something else here. */
> -		struct pcs_msg	*response;	/* Consider removing. It can be done passing the second
> -						 * argument to done();
> -						 */
> -		struct pcs_netio *netio;
> -		struct pcs_rpc	*rpc;
> -
> -		int		size;
> -		int		_iocount;
> -		unsigned short	timeout;
> -		unsigned char	kill_slot;
> -		unsigned char	stage;
> -		abs_time_t	io_start_time;
> -
> -		unsigned long flags;
> -
> -		struct hlist_node	kill_link;
> -
> -		void		(*get_iter)(struct pcs_msg *, int offset, struct iov_iter *it,
> -					    unsigned int direction);
> -
> -		void		(*done)(struct pcs_msg *);
> -		void		(*destructor)(struct pcs_msg *);
> -		void		*pool;
"pool" seems completely removed, is it intentional? Is it an unused field?
> -		struct iovec	_inline_iovec;
> -		int		accounted;
> -
> -		short		_align_offset;
> -		short		_inline_len;
> -		struct kvec	_inline_kv;
> -	} __aligned(16);
> -	u64		__pad16_8;
> +	struct list_head list;
> +
> +	pcs_error_t	error;
> +	abs_time_t	start_time;
> +
> +	void		*private;
> +	void		*private2;	/* Huh? Need to do something else here. */
> +	struct pcs_msg	*response;	/* Consider removing. It can be done passing the second
> +					 * argument to done();
> +					 */
> +	struct pcs_netio *netio;
> +	struct pcs_rpc	*rpc;
> +
> +	int		size;
> +	int		_iocount;
> +	unsigned short	timeout;
> +	unsigned char	kill_slot;
> +	unsigned char	stage;
> +	abs_time_t	io_start_time;
> +
> +	unsigned long flags;
> +
> +	struct hlist_node	kill_link;
> +
> +	void		(*get_iter)(struct pcs_msg *msg, int offset, struct iov_iter *it,
> +				    unsigned int direction);
> +
> +	void		(*done)(struct pcs_msg *msg);
> +	void		(*destructor)(struct pcs_msg *msg);
> +	struct iovec	_inline_iovec;
> +	int		accounted;
> +
> +	short		_align_offset;
> +	short		_inline_len;
> +	struct kvec	_inline_kv;
> +
>   	char		_inline_buffer[0];
> -} __packed;
> +};
>   
>   static inline void * pcs_msg_aligned_data(struct pcs_msg * msg, int offset)
>   {
-- 
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
    
    
More information about the Devel
mailing list