linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/3] zonefs: introduce helper for zone management
Date: Mon, 7 Sep 2020 02:55:41 +0000	[thread overview]
Message-ID: <CY4PR04MB3751ABC297A6CECAD198E21DE7280@CY4PR04MB3751.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200904112328.28887-2-johannes.thumshirn@wdc.com

On 2020/09/04 20:23, Johannes Thumshirn wrote:
> Introduce a helper function for sending zone management commands to the
> block device.
> 
> As zone management commands can change a zone write pointer position
> reflected in the size of the zone file, this function expects the truncate
> mutex to be held.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  fs/zonefs/super.c | 27 +++++++++++++++++++++++----
>  1 file changed, 23 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index 8ec7c8f109d7..9573aebee146 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -24,6 +24,26 @@
>  
>  #include "zonefs.h"
>  
> +static inline int zonefs_zone_mgmt(struct inode *inode,
> +				   enum req_opf op)
> +{
> +	struct zonefs_inode_info *zi = ZONEFS_I(inode);
> +	int ret;
> +
> +	lockdep_assert_held(&zi->i_truncate_mutex);
> +
> +	ret = blkdev_zone_mgmt(inode->i_sb->s_bdev, op, zi->i_zsector,
> +			       zi->i_zone_size >> SECTOR_SHIFT, GFP_NOFS);
> +	if (ret) {
> +		zonefs_err(inode->i_sb,
> +			   "Zone management operation %d at %llu failed %d",
> +			   op, zi->i_zsector, ret);

Printing blk_op_str() instead of the raw op value would make the message easier
to understand.

> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
>  static int zonefs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>  			      unsigned int flags, struct iomap *iomap,
>  			      struct iomap *srcmap)
> @@ -397,12 +417,11 @@ static int zonefs_file_truncate(struct inode *inode, loff_t isize)
>  	if (isize == old_isize)
>  		goto unlock;
>  
> -	ret = blkdev_zone_mgmt(inode->i_sb->s_bdev, op, zi->i_zsector,
> -			       zi->i_zone_size >> SECTOR_SHIFT, GFP_NOFS);
> +	ret = zonefs_zone_mgmt(inode, op);
>  	if (ret) {
>  		zonefs_err(inode->i_sb,
> -			   "Zone management operation at %llu failed %d",
> -			   zi->i_zsector, ret);
> +			   "Zone management operation %s at %llu failed %d",
> +			   blk_op_str(op), zi->i_zsector, ret);

That repeats the error message already printed by zonefs_zone_mgmt(). There is
no need for this one.

>  		goto unlock;
>  	}
>  
> 


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2020-09-07  2:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 11:23 [PATCH 0/3] zonefs: introduce -o explicit-open mount option Johannes Thumshirn
2020-09-04 11:23 ` [PATCH 1/3] zonefs: introduce helper for zone management Johannes Thumshirn
2020-09-07  2:55   ` Damien Le Moal [this message]
2020-09-04 11:23 ` [PATCH 2/3] zonefs: open/close zone on file open/close Johannes Thumshirn
2020-09-07  3:06   ` Damien Le Moal
2020-09-07  8:49     ` Johannes Thumshirn
2020-09-07  9:52       ` Damien Le Moal
2020-09-07  4:32   ` Damien Le Moal
2020-09-04 11:23 ` [PATCH 3/3] zonefs: document the explicit-open mount option Johannes Thumshirn
2020-09-04 15:17   ` Randy Dunlap
2020-09-07  3:09   ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR04MB3751ABC297A6CECAD198E21DE7280@CY4PR04MB3751.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).