lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150713151610.GC17075@quack.suse.cz>
Date:	Mon, 13 Jul 2015 17:16:10 +0200
From:	Jan Kara <jack@...e.cz>
To:	Matthew Wilcox <matthew.r.wilcox@...el.com>
Cc:	Theodore Ts'o <tytso@....edu>,
	Andreas Dilger <adilger.kernel@...ger.ca>,
	linux-ext4@...r.kernel.org, Matthew Wilcox <willy@...ux.intel.com>
Subject: Re: [PATCH] ext4: Return the length of a hole from get_block

On Fri 03-07-15 11:15:11, Matthew Wilcox wrote:
> From: Matthew Wilcox <willy@...ux.intel.com>
> 
> Currently, if ext4's get_block encounters a hole, it does not modify the
> buffer_head.  That's fine for many callers, but for DAX, it's useful to
> know how large the hole is.  XFS already returns the length of the hole,
> so this improvement should not confuse any callers.
> 
> Signed-off-by: Matthew Wilcox <willy@...ux.intel.com>

So I'm somewhat wondering: What is the reason of BH_Uptodate flag being
set? I can see the XFS sets it in some cases as well but the use of the
flag isn't really clear to me...

								Honza

> ---
>  fs/ext4/ext4.h  | 6 ++++--
>  fs/ext4/inode.c | 6 +++++-
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 9a83f14..7b7c097 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -154,12 +154,14 @@ struct ext4_allocation_request {
>   * well as to store the information returned by ext4_map_blocks().  It
>   * takes less room on the stack than a struct buffer_head.
>   */
> +#define EXT4_MAP_UPTODATE	(1 << BH_Uptodate)
>  #define EXT4_MAP_NEW		(1 << BH_New)
>  #define EXT4_MAP_MAPPED		(1 << BH_Mapped)
>  #define EXT4_MAP_UNWRITTEN	(1 << BH_Unwritten)
>  #define EXT4_MAP_BOUNDARY	(1 << BH_Boundary)
> -#define EXT4_MAP_FLAGS		(EXT4_MAP_NEW | EXT4_MAP_MAPPED |\
> -				 EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY)
> +#define EXT4_MAP_FLAGS		(EXT4_MAP_UPTODATE | EXT4_MAP_NEW | \
> +				 EXT4_MAP_MAPPED | EXT4_MAP_UNWRITTEN | \
> +				 EXT4_MAP_BOUNDARY)
>  
>  struct ext4_map_blocks {
>  	ext4_fsblk_t m_pblk;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 9b46f6f..0fc49ac 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -494,7 +494,11 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
>  				retval = map->m_len;
>  			map->m_len = retval;
>  		} else if (ext4_es_is_delayed(&es) || ext4_es_is_hole(&es)) {
> -			retval = 0;
> +			map->m_flags |= EXT4_MAP_UPTODATE;
> +			retval = es.es_len - (map->m_lblk - es.es_lblk);
> +			if (retval > map->m_len)
> +				retval = map->m_len;
> +			map->m_len = retval;
>  		} else {
>  			BUG_ON(1);
>  		}
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ