Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Jiang Ying <jiangying8582@126.com>,
	Wang Long <wanglong19@meituan.com>,
	linux-ext4@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH v2] ext4: fix direct I/O read error
Date: Mon, 29 Jun 2020 08:26:27 +0200
Message-ID: <22f650fd-6348-30d8-763a-8e03b0772f10@web.de> (raw)
In-Reply-To: <1593400165-114818-1-git-send-email-jiangying8582@126.com>

> Fixes: 9fe55eea7e4b ("Fix race when checking i_size on direct i/o read").

* I suggest to move this tag to the bottom of the commit message.

* This specification is usually preferred without a dot at the line end.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68#n183


> This commit caused ext4 direct I/O read error when the read size is not
> alignment with block size.

Wording alternative:
aligned …


> (1) Make the file that is not alignment with block size:

… a file … aligned …


> (3) Compiling the script:

(3) Compile the source file:


> (4) Exec the script:

(4) Run the test program:


> … Thanks.

I propose to omit this word here.


> ---
>  fs/ext4/inode.c | 6 ++++++

Would you like to add patch version descriptions here?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68#n751> @@ -3821,6 +3821,12 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter)
>  	struct inode *inode = mapping->host;
>  	size_t count = iov_iter_count(iter);
>  	ssize_t ret;
> +	loff_t offset = iocb->ki_pos;
> +	loff_t size;
> +
> +	size = i_size_read(inode);

How do you think about to use the following source code variant?

+	loff_t size = i_size_read(inode);


> +	if (offset >= size)
> +		return 0;

Will any further fine-tuning matter for this function implementation?

Regards,
Markus

      parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29  3:09 Jiang Ying
2020-06-29  6:22 ` Christoph Hellwig
2020-06-29  6:26 ` Markus Elfring [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=22f650fd-6348-30d8-763a-8e03b0772f10@web.de \
    --to=markus.elfring@web.de \
    --cc=adilger.kernel@dilger.ca \
    --cc=jiangying8582@126.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=wanglong19@meituan.com \
    /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

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git