public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Question about deleting inode / drop inode
@ 2002-04-09  2:57 Anthony Chee
  0 siblings, 0 replies; only message in thread
From: Anthony Chee @ 2002-04-09  2:57 UTC (permalink / raw)
  To: linux-kernel

I made some modification inode.c for my purpose. I defined myfunc() for my
own use

I modified write_inode as following. My purpose is to use a function to
determine such inode should pass to lower to lower file system (ext2, vfat,
etc) for writing on disk.

static inline void write_inode(struct inode *inode, int sync)
{
    if (myfunc() == 0) {
              if (inode->i_sb && inode->i_sb->s_op &&
inode->i_sb->s_op->write_inode && !is_bad_inode inode)) {
                    inode->i_sb->s_op->write_inode(inode, sync);

  } else {
            if (inode->i_sb && inode->i_sb->s_op &&
inode->i_sb->s_op->write_inode && !is_bad_inode(inode)) {
                    inode->i_sb->s_op->write_inode(inode, sync);
            die(inode);
  }
 }
}

static inline void die(inode) {
    iput(inode);
}

I used iput(inode) in this case. Is it right? I supposed the inode will
immediatly deleted after written on disk, and release the block used. But I
found that I still can see such file when I press "ls". I also tried to add
inode->i_nlink = 0 and atomic_set(&inode->i_count, 0) in die(inode) function
before iput(inode), but not success. It may also have input/output error on
that file after I reboot system and "ls".

Or any method to drop the inode (do not pass to lower file system layer,
just delete it in VFS layer) when myfunc() != 0?

Any one can give suggestion on it? Thanks for help. :D



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-09  2:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-09  2:57 Question about deleting inode / drop inode Anthony Chee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox