[lkml]   [2010]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH v4] mtd: Do not corrupt backing device of device node inode
    On Fri 14-05-10 02:04:34, David Woodhouse wrote:
    > On Wed, 2010-05-05 at 18:40 +0300, Kirill A. Shutemov wrote:
    > > We cannot modify file->f_mapping->backing_dev_info, because it will corrupt
    > > backing device of device node inode, since file->f_mapping is equal to
    > > inode->i_mapping (see __dentry_open() in fs/open.c).
    > >
    > > Let's introduce separate inode for MTD device with appropriate backing
    > > device.
    > I hate the fact that we have to do this -- is it really the only option?
    > Is it _just_ for the backing_device_info? Can't that be done
    > differently?
    Well, if I understand the problem MTD tries to solve, what you really need
    is that file->f_mapping->backing_dev_info points to your structure so that
    you can specify the capability of backing device to support mmap and
    whatever else. What I'm not sure about is, why you cannot have this
    backing_dev_info directly in the original device inode but since this is
    the problem you are originally trying to solve, I guess you have some good
    reason for that.
    So with this requirement, you have to at least setup complete struct
    address_space to which f_mapping can point. This address_space has to be
    linked (via mapping->host) to some inode. So you could point i_mapping
    to your address_space structure if that would work for you. But this only
    has a reasonable chance to work if you would somehow tie the lifetime
    of your address_space with the lifetime of your device inode (code in
    block_dev.c does something like this because all inodes which represent
    the same block block device share one address_space). Moreover you would
    have to do all the address_space initialization inode_init_always does (or
    probably split out the mapping initialization from inode_init_always and
    call it from MTD code). So I'm not sure it's really better.
    When you decide you don't want to take care about proper setup of
    address_space and refcounting and whatever, you have to create a full
    inode. But this inode has to live in some filesystem -> what Kirill did is
    unavoidable in this case...

    Jan Kara <>
    SUSE Labs, CR

     \ /
      Last update: 2010-05-17 23:59    [W:0.021 / U:0.288 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site