linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH] zonefs: use iomap for synchronous direct writes
Date: Thu, 1 Jun 2023 18:33:13 +0900	[thread overview]
Message-ID: <98aa3e4a-e84d-b66b-a7df-42a41961183c@kernel.org> (raw)
In-Reply-To: <20230601092719.GA5774@lst.de>

On 6/1/23 18:27, Christoph Hellwig wrote:
>> +struct zonefs_bio {
>> +	/* The target inode of the BIO */
>> +	struct inode *inode;
>> +
>> +	/* For sync writes, the target write offset */
>> +	u64 woffset;
> 
> Maybe spell out write_offset?

Yep. will do as I need to send a v2 anyway as I am seeing random test failure of
the case handling writes to offline zones. Not sure why. Debugging.

> 
>> +
>> +static void zonefs_file_sync_write_dio_bio_end_io(struct bio *bio)
>> +{
>> +	struct zonefs_bio *zbio;
>> +	struct zonefs_zone *z;
>> +	sector_t wsector;
>> +
>> +	if (bio->bi_status != BLK_STS_OK)
>> +		goto bio_end;
>> +
>> +	/*
>> +	 * If the file zone was written underneath the file system, the zone
>> +	 * append operation can still succedd (if the zone is not full) but
>> +	 * the write append location will not be where we expect it to be.
>> +	 * Check that we wrote where we intended to, that is, at z->z_wpoffset.
>> +	 */
>> +	zbio = zonefs_bio(bio);
>> +	z = zonefs_inode_zone(zbio->inode);
> 
> I'd move thses to the lines where the variables are declared.

OK

> 
>> +	wsector = z->z_sector + (zbio->woffset >> SECTOR_SHIFT);
>> +	if (bio->bi_iter.bi_sector != wsector) {
>> +		zonefs_warn(zbio->inode->i_sb,
>> +			    "Invalid write sector %llu for zone at %llu\n",
>> +			    bio->bi_iter.bi_sector, z->z_sector);
>> +		bio->bi_status = BLK_STS_IOERR;
>> +	}
> 
> Seems like all this is actually just debug code and could be conditional
> and you could just use the normal bio pool otherwise?

Without this, the zonefs_bio struct and bio_end_io op are not even needed. That
would simplify things but I really would like to keep this around to be able to
detect file corruptions.

> 
>> +static struct bio_set zonefs_file_write_dio_bio_set;
>>  

-- 
Damien Le Moal
Western Digital Research


      reply	other threads:[~2023-06-01  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01  8:26 [PATCH] zonefs: use iomap for synchronous direct writes Damien Le Moal
2023-06-01  9:27 ` Christoph Hellwig
2023-06-01  9:33   ` Damien Le Moal [this message]

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=98aa3e4a-e84d-b66b-a7df-42a41961183c@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --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).