From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: Jeff Garzik <jgarzik@pobox.com>, Tejun Heo <htejun@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: ata_tf_read_block() question
Date: Sat, 15 Aug 2009 22:48:43 +0900 (JST) [thread overview]
Message-ID: <20090815.224843.240484147.anemo@mba.ocn.ne.jp> (raw)
I have a question on CHS calculation in ata_tf_read_block().
The calculation in ata_tf_read_block() is:
block = (cyl * dev->heads + head) * dev->sectors + sect;
but ata_build_rw_tf() does:
track = (u32)block / dev->sectors;
cyl = track / dev->heads;
head = track % dev->heads;
sect = (u32)block % dev->sectors + 1;
It seems inconsistent. The correct calculation is:
block = (cyl * dev->heads + head) * dev->sectors + sect - 1;
isn't it?
I don't have any real problem. Just noticed by code reading.
---
Atsushi Nemoto
next reply other threads:[~2009-08-15 13:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-15 13:48 Atsushi Nemoto [this message]
2009-08-16 2:15 ` Tejun Heo
2009-08-16 9:33 ` Atsushi Nemoto
2009-08-16 12:21 ` [PATCH #upstream-fixes] libata: fix off-by-one error in ata_tf_read_block() Tejun Heo
2009-09-09 1:19 ` Jeff Garzik
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=20090815.224843.240484147.anemo@mba.ocn.ne.jp \
--to=anemo@mba.ocn.ne.jp \
--cc=htejun@gmail.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®