From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: petkovbb@gmail.com
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 08/18] ide-floppy: use drive->capacity64 for caching current capacity
Date: Sat, 27 Sep 2008 17:34:55 +0200 [thread overview]
Message-ID: <200809271734.55433.bzolnier@gmail.com> (raw)
In-Reply-To: <20080910112006.GA10263@gollum.tnic>
Hi,
On Wednesday 10 September 2008, Borislav Petkov wrote:
> Hi,
>
> On Mon, Sep 08, 2008 at 12:15:19AM +0200, Bartlomiej Zolnierkiewicz wrote:
> > * Use drive->capacity64 for caching current capacity.
> >
> > * Switch ide_floppy_capacity() to use drive->capacity64.
> >
> > * Call set_capacity() in idefloppy_open() and ide_floppy_probe()
> > instead of ide_floppy_get_capacity().
> >
> > There should be no functional changes caused by this patch.
> >
> > Cc: Borislav Petkov <petkovbb@gmail.com>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> > drivers/ide/ide-floppy.c | 23 +++++++++++++----------
> > 1 file changed, 13 insertions(+), 10 deletions(-)
> >
> > Index: b/drivers/ide/ide-floppy.c
> > ===================================================================
> > --- a/drivers/ide/ide-floppy.c
> > +++ b/drivers/ide/ide-floppy.c
> > @@ -445,7 +445,9 @@ static int ide_floppy_get_flexible_disk_
> > drive->name, lba_capacity, capacity);
> > floppy->blocks = floppy->block_size ?
> > capacity / floppy->block_size : 0;
> > + drive->capacity64 = floppy->blocks * floppy->bs_factor;
>
> why do we do the assignment only in the capacity < lba_capacity case?
> drive->capacity64 is the total number of sectors, shouldn't we do
>
> drive->capacity64 = floppy->blocks;
>
> in the floppy->bs_factor == 1 case? Otherwise you have the case of calling
Probably we should...
> idefloppy_setup()
> |-> ide_floppy_get_capacity()
> |-> ide_floppy_get_flexible_disk_page()
>
> and having drive->capacity64 == 0 in the (capacity >= lba_capacity) case which
> assigns a capacity of 0 to disk->capacity in the set_capacity() call later ...
>
> or am I missing something?
...my patch just modified the code to also set ->capacity64 in places
which previously were modifying ->blocks and/or ->bs_factor (since
->capacity64 replaced open-coded ->blocks * ->bs_factor calculation),
so I think that the above problem is as an orthogonal issue and it
is the best to address it in separate pre- or post- patch (could you
please take care of it?).
[...]
> > @@ -547,17 +551,12 @@ static int ide_floppy_get_capacity(ide_d
> > if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE))
> > (void) ide_floppy_get_flexible_disk_page(drive);
> >
> > - set_capacity(disk, floppy->blocks * floppy->bs_factor);
> > -
> > return rc;
> > }
> >
> > sector_t ide_floppy_capacity(ide_drive_t *drive)
> > {
> > - idefloppy_floppy_t *floppy = drive->driver_data;
> > - unsigned long capacity = floppy->blocks * floppy->bs_factor;
> > -
> > - return capacity;
> > + return drive->capacity64;
>
> you can simplify this one even further by killing ide_floppy_capacity() and
> doing
>
> set_capacity(disk, floppy->drive->capacity64);
I did it ide_floppy_capacity()-way to match ide_disk_capacity()
and ease the merge (probably ide_gd_capacity() can be removed now).
Thanks,
Bart
next prev parent reply other threads:[~2008-09-27 17:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-07 22:14 [PATCH 00/18] ide: add generic ATA/ATAPI disk driver Bartlomiej Zolnierkiewicz
2008-09-07 22:14 ` [PATCH 01/18] ide-disk: fix IDE_DFLAG_LBA48 handling on resume Bartlomiej Zolnierkiewicz
2008-09-07 22:14 ` [PATCH 02/18] ide-disk: lock media before checking for media change Bartlomiej Zolnierkiewicz
2008-09-07 22:14 ` [PATCH 03/18] ide-floppy: use alloc_disk_node() Bartlomiej Zolnierkiewicz
2008-09-07 22:14 ` [PATCH 04/18] ide-disk: use to_ide_drv() and ide_drv_g() Bartlomiej Zolnierkiewicz
2008-09-07 22:14 ` [PATCH 05/18] ide-disk: move IDE_DFLAG_DOORLOCKING flag handling to idedisk_set_doorlock() Bartlomiej Zolnierkiewicz
2008-09-07 22:15 ` [PATCH 06/18] ide-{disk,floppy}: set IDE_DFLAG_ATTACH in *_setup() Bartlomiej Zolnierkiewicz
2008-09-07 22:15 ` [PATCH 07/18] ide-floppy: drop 'floppy' argument from idefloppy_setup() Bartlomiej Zolnierkiewicz
2008-09-07 22:15 ` [PATCH 08/18] ide-floppy: use drive->capacity64 for caching current capacity Bartlomiej Zolnierkiewicz
2008-09-10 11:20 ` Borislav Petkov
2008-09-27 15:34 ` Bartlomiej Zolnierkiewicz [this message]
2008-09-07 22:15 ` [PATCH 09/18] ide: IDE_AFLAG_MEDIA_CHANGED -> IDE_DFLAG_MEDIA_CHANGED Bartlomiej Zolnierkiewicz
2008-09-07 22:15 ` [PATCH 10/18] ide: IDE_AFLAG_WP -> IDE_DFLAG_WP Bartlomiej Zolnierkiewicz
2008-09-07 22:15 ` [PATCH 11/18] ide: IDE_AFLAG_FORMAT_IN_PROGRESS -> IDE_DFLAG_FORMAT_IN_PROGRESS Bartlomiej Zolnierkiewicz
2008-09-07 22:15 ` [PATCH 12/18] ide: remove IDE_AFLAG_NO_DOORLOCKING Bartlomiej Zolnierkiewicz
2008-09-07 22:15 ` [PATCH 13/18] ide-disk: factor out generic disk handling code to ide-gd.c Bartlomiej Zolnierkiewicz
2008-09-07 22:16 ` [PATCH 14/18] ide-disk: use IDE_DFLAG_MEDIA_CHANGED Bartlomiej Zolnierkiewicz
2008-09-07 22:16 ` [PATCH 15/18] ide-floppy: factor out generic disk handling code to ide-gd-floppy.c Bartlomiej Zolnierkiewicz
2008-09-07 22:16 ` [PATCH 16/18] ide: prepare for merging ide-gd-floppy.c with ide-gd.c Bartlomiej Zolnierkiewicz
2008-09-07 22:16 ` [PATCH 17/18] ide: allow device drivers to specify per-device type /proc settings Bartlomiej Zolnierkiewicz
2008-09-07 22:16 ` [PATCH 18/18] ide: add generic ATA/ATAPI disk driver Bartlomiej Zolnierkiewicz
2008-09-10 11:20 ` [PATCH 00/18] " Borislav Petkov
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=200809271734.55433.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@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).