lkml.org 
[lkml]   [2009]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v1 6/8] hugetlbfs drop_inode update
    Date
    Update hugetlbfs to compile with the new drop_inode callback mechanism that
    works with phases.

    Signed-off-by: Mike Waychison <mikew@google.com>
    ---

    fs/hugetlbfs/inode.c | 72 +++++++++++++++++++++++++++++---------------------
    1 files changed, 42 insertions(+), 30 deletions(-)

    diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
    index 6903d37..986fed4 100644
    --- a/fs/hugetlbfs/inode.c
    +++ b/fs/hugetlbfs/inode.c
    @@ -388,46 +388,58 @@ static void hugetlbfs_delete_inode(struct inode *inode)
    clear_inode(inode);
    }

    -static void hugetlbfs_forget_inode(struct inode *inode) __releases(inode_lock)
    +static int hugetlbfs_forget_inode(struct inode *inode,
    + enum drop_inode_phase phase)
    {
    struct super_block *sb = inode->i_sb;

    - if (!hlist_unhashed(&inode->i_hash)) {
    - if (!(inode->i_state & (I_DIRTY|I_SYNC)))
    - list_move(&inode->i_list, &inode_unused);
    - inodes_stat.nr_unused++;
    - if (!sb || (sb->s_flags & MS_ACTIVE)) {
    - spin_unlock(&inode_lock);
    - return;
    + switch (phase) {
    + case DIP_START_FREEING:
    + if (!hlist_unhashed(&inode->i_hash)) {
    + if (!(inode->i_state & (I_DIRTY|I_SYNC)))
    + list_move(&inode->i_list, &inode_unused);
    + inodes_stat.nr_unused++;
    + if (!sb || (sb->s_flags & MS_ACTIVE))
    + return 1;
    + inode->i_state |= I_WILL_FREE;
    }
    - inode->i_state |= I_WILL_FREE;
    - spin_unlock(&inode_lock);
    - /*
    - * write_inode_now is a noop as we set BDI_CAP_NO_WRITEBACK
    - * in our backing_dev_info.
    - */
    - write_inode_now(inode, 1);
    - spin_lock(&inode_lock);
    - inode->i_state &= ~I_WILL_FREE;
    - inodes_stat.nr_unused--;
    - hlist_del_init(&inode->i_hash);
    + break;
    + case DIP_DELETING:
    + if (!hlist_unhashed(&inode->i_hash)) {
    + /*
    + * write_inode_now is a noop as we set
    + * BDI_CAP_NO_WRITEBACK in our backing_dev_info.
    + */
    + write_inode_now(inode, 1);
    + }
    + break;
    + case DIP_UNHASHING:
    + if (!hlist_unhashed(&inode->i_hash)) {
    + inode->i_state &= ~I_WILL_FREE;
    + inodes_stat.nr_unused--;
    + hlist_del_init(&inode->i_hash);
    + }
    + list_del_init(&inode->i_list);
    + list_del_init(&inode->i_sb_list);
    + inode->i_state |= I_FREEING;
    + inodes_stat.nr_inodes--;
    + break;
    + case DIP_DESTROYING:
    + truncate_hugepages(inode, 0);
    + clear_inode(inode);
    + destroy_inode(inode);
    + break;
    }
    - list_del_init(&inode->i_list);
    - list_del_init(&inode->i_sb_list);
    - inode->i_state |= I_FREEING;
    - inodes_stat.nr_inodes--;
    - spin_unlock(&inode_lock);
    - truncate_hugepages(inode, 0);
    - clear_inode(inode);
    - destroy_inode(inode);
    + return 0;
    }

    -static void hugetlbfs_drop_inode(struct inode *inode)
    +static int hugetlbfs_drop_inode(struct inode *inode,
    + enum drop_inode_phase phase)
    {
    if (!inode->i_nlink)
    - generic_delete_inode(inode);
    + return generic_delete_inode(inode, phase);
    else
    - hugetlbfs_forget_inode(inode);
    + return hugetlbfs_forget_inode(inode, phase);
    }

    static inline void


    \
     
     \ /
      Last update: 2009-01-17 03:37    [W:0.025 / U:0.116 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site