linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Timofey Titovets <nefelim4ag@gmail.com>
Cc: David Sterba <dsterba@suse.cz>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 3/4] Btrfs: handle unaligned tail of data ranges more efficient
Date: Tue, 17 Oct 2017 17:52:44 +0200	[thread overview]
Message-ID: <20171017155243.GA3521@twin.jikos.cz> (raw)
In-Reply-To: <CAGqmi76z2nisakzci3W6n=1PLc+8vd+9iKZ3mnhAj64hNVT_kQ@mail.gmail.com>

On Mon, Oct 16, 2017 at 01:09:04AM +0300, Timofey Titovets wrote:
> May be then just add a comment at least at one of that functions?
> Like:
> /*
>  * Handle unaligned end, end is inclusive, so always unaligned
>  */

This would be best documented in the data structure definition, so we
don't have to comment each and every test that compares something
against the range.

> Or something like:
> /*
>  * It's obvious, kernel use paging, so range
>  * Almost always have aligned start like 0
>  * and unaligned end like 8192 - 1
>  */
> 
> Or we assume that everybody who look at kernel code, must understood
> that basic things?

Some level of understanding is required of course, but it's different
for everybody. If the semantics or constraints of code/structures are not
discoverable, then it should be documented.  Adding comment-only patches
is ok, but adding trivial or commenting on the obvious is pointless. IME
the sense of what is/not trivial comes after reading a lot of code.

  reply	other threads:[~2017-10-17 15:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 15:06 [PATCH 0/4] Just bunch of btrfs patches Timofey Titovets
2017-10-03 15:06 ` [PATCH 1/4] Btrfs: compress_file_range() remove dead variable num_bytes Timofey Titovets
2017-10-10 17:39   ` David Sterba
2017-10-03 15:06 ` [PATCH 2/4] Btrfs: clear_dirty only on pages only in compression range Timofey Titovets
2017-10-10 16:22   ` David Sterba
2017-10-13 22:31     ` Timofey Titovets
2017-10-03 15:06 ` [PATCH 3/4] Btrfs: handle unaligned tail of data ranges more efficient Timofey Titovets
2017-10-10 16:37   ` David Sterba
2017-10-15 22:09     ` Timofey Titovets
2017-10-17 15:52       ` David Sterba [this message]
2017-10-03 15:06 ` [PATCH 4/4] Btrfs: btrfs_dedupe_file_range() ioctl, remove 16MiB restriction Timofey Titovets
2017-10-10 17:36   ` David Sterba
2017-11-14 10:19     ` Timofey Titovets

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=20171017155243.GA3521@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nefelim4ag@gmail.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
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).