From: Al Viro <viro@ZenIV.linux.org.uk>
To: Ralf Hornik Mailings <ralf@best.homeunix.org>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: FWD: block_device_operations change since 2.6.27.X
Date: Sat, 15 May 2010 07:20:51 +0100 [thread overview]
Message-ID: <20100515062051.GA16173@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20100507092623.40735f4vurpadme7@www.ralf-hornik.de>
On Fri, May 07, 2010 at 09:26:23AM +0200, Ralf Hornik Mailings wrote:
> Unfortunately the documentation in filesystems/Locking does still
> point to the old prototype.
> Can you give me some hints how to use the new
> block_device_operations defined in blkdev.h or send me some new
> dokumentation?
What is a filesystem doing with block_device_operations in the first
place? In any case, what happened is this:
* ->open(inode, file) became ->open(inode->i_bdev, file->f_mode)
* ->release(inode, file) became ->release(inode->i_bdev->bd_disk,
file->f_mode)
* similar for ->ioctl() and its ilk
* ->set_capacity() is IDE-only crap
Note that you *really* don't want to issue any of those manually from e.g.
fs code. Use ioctl_by_bdev() and friends instead. Block device driver
probably needs to define those (provided that it needs unusual ioctls,
etc.), but conversion from the old API to new one ought to be simple enough
with the above.
Note that O_NDELAY and O_EXCL are mirrored in ->f_mode (as FMODE_NDELAY
and FMODE_EXCL resp.), so block device drivers that used to look at
file->f_flags for those bits are just looking at fmode_t value they
are getting passed directly.
i_minor(inode) is equal to MINOR(inode->i_bdev->bd_dev), so if ->open()
used to use the former, you can replace it with MINOR(bdev->bd_dev)
in new variant; same for i_major (use MAJOR(...)). Most of the places
using those actually used them to locate inode->i_bdev->bd_disk->private_data,
and could be completely eliminated in either version. Faster and cleaner
that way...
If your block device uses other information that used to be reachable from
the old arguments, it had been broken. A long time ago, since the presence
of anything other that inode->i_bdev, inode->i_rdev, file->f_mode and
file->f_flags hadn't been guaranteed for a long time.
next prev parent reply other threads:[~2010-05-15 6:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 13:00 block_device_operations change since 2.6.27.X Ralf Hornik Mailings
2010-05-06 13:00 ` Ralf Hornik Mailings
2010-05-10 21:06 ` Jan Kara
[not found] ` <20100507092623.40735f4vurpadme7@www.ralf-hornik.de>
2010-05-15 6:20 ` Al Viro [this message]
2010-05-17 8:14 ` FWD: " Ralf Hornik Mailings
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=20100515062051.GA16173@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ralf@best.homeunix.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).