lkml.org 
[lkml]   [2006]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file
    From
    inode.i_cindex isn't initialized until the character device is opened
    anyway, and there are far more struct inodes in memory than there are
    struct file. So move the cindex field to file.f_cindex, and change
    the one(!) user of cindex to use file pointer, which is in fact simpler.

    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


    Index: linux-2.6.17/include/linux/fs.h
    ===================================================================
    --- linux-2.6.17.orig/include/linux/fs.h 2006-06-18 19:53:54.000000000 -0400
    +++ linux-2.6.17/include/linux/fs.h 2006-06-18 19:59:59.000000000 -0400
    @@ -513,7 +513,6 @@
    struct block_device *i_bdev;
    struct cdev *i_cdev;
    };
    - int i_cindex;

    __u32 i_generation;

    @@ -659,6 +658,7 @@
    spinlock_t f_ep_lock;
    #endif /* #ifdef CONFIG_EPOLL */
    struct address_space *f_mapping;
    + int f_cindex;
    };
    extern spinlock_t files_lock;
    #define file_list_lock() spin_lock(&files_lock);
    Index: linux-2.6.17/fs/char_dev.c
    ===================================================================
    --- linux-2.6.17.orig/fs/char_dev.c 2006-06-18 19:37:14.000000000 -0400
    +++ linux-2.6.17/fs/char_dev.c 2006-06-18 19:59:59.000000000 -0400
    @@ -290,7 +290,7 @@
    p = inode->i_cdev;
    if (!p) {
    inode->i_cdev = p = new;
    - inode->i_cindex = idx;
    + filp->f_cindex = idx;
    list_add(&inode->i_devices, &p->list);
    new = NULL;
    } else if (!cdev_get(p))
    Index: linux-2.6.17/drivers/ieee1394/ieee1394_core.h
    ===================================================================
    --- linux-2.6.17.orig/drivers/ieee1394/ieee1394_core.h 2006-06-18 19:37:13.000000000 -0400
    +++ linux-2.6.17/drivers/ieee1394/ieee1394_core.h 2006-06-18 19:59:59.000000000 -0400
    @@ -212,7 +212,7 @@
    /* return the index (within a minor number block) of a file */
    static inline unsigned char ieee1394_file_to_instance(struct file *file)
    {
    - return file->f_dentry->d_inode->i_cindex;
    + return file->f_cindex;
    }

    extern int hpsb_disable_irm;
    --
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-06-19 17:35    [W:0.021 / U:33.776 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site