public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Anthony Chee" <anthony.chee@polyu.edu.hk>
To: <linux-kernel@vger.kernel.org>
Subject: Question about deleting inode / drop inode
Date: Tue, 9 Apr 2002 10:57:47 +0800	[thread overview]
Message-ID: <000e01c1df72$554007d0$ccd7fea9@winxp> (raw)

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



                 reply	other threads:[~2002-04-09  2:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000e01c1df72$554007d0$ccd7fea9@winxp' \
    --to=anthony.chee@polyu.edu.hk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox