Re: FWD: block_device_operations change since 2.6.27.X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux