Skip to content

Commit

Permalink
tux3: Support dicard_new_inode() for v4.19
Browse files Browse the repository at this point in the history
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
  • Loading branch information
OGAWAHirofumi committed Nov 14, 2018
1 parent 12b2206 commit d78696e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
18 changes: 16 additions & 2 deletions fs/tux3/user/inode.c
Expand Up @@ -129,8 +129,15 @@ static int is_bad_inode(struct inode *inode)

void unlock_new_inode(struct inode *inode)
{
assert(inode->i_state & I_NEW);
WARN_ON(!(inode->i_state & I_NEW));
inode->i_state &= ~I_NEW & ~I_CREATING;
}

void discard_new_inode(struct inode *inode)
{
WARN_ON(!(inode->i_state & I_NEW));
inode->i_state &= ~I_NEW;
iput(inode);
}

static void iget_failed(struct inode *inode)
Expand Down Expand Up @@ -184,6 +191,10 @@ static struct inode *find_inode(struct super_block *sb, struct hlist_head *head,
spin_unlock(&inode->i_lock);
goto repeat;
}
if (unlikely(inode->i_state & I_CREATING)) {
spin_unlock(&inode->i_lock);
return ERR_PTR(-ESTALE);
}
__iget(inode);
spin_unlock(&inode->i_lock);
return inode;
Expand Down Expand Up @@ -281,7 +292,10 @@ static struct inode *iget5_locked(struct super_block *sb, inum_t inum,
static int insert_inode_locked4(struct inode *inode, inum_t inum,
int (*test)(struct inode *, void *), void *data)
{
struct inode *old = inode_insert5(inode, inum, test, NULL, data);
struct inode *old;

inode->i_state |= I_CREATING;
old = inode_insert5(inode, inum, test, NULL, data);

if (old != inode) {
iput(old);
Expand Down
1 change: 1 addition & 0 deletions fs/tux3/user/tux3user.h
Expand Up @@ -136,6 +136,7 @@ void inode_leak_check(void);
void remove_inode_hash(struct inode *inode);
void inode_init_once(struct inode *inode);
void unlock_new_inode(struct inode *inode);
void discard_new_inode(struct inode *inode);
void __iget(struct inode *inode);
void ihold(struct inode *inode);
loff_t i_size_read(const struct inode *inode);
Expand Down
1 change: 1 addition & 0 deletions fs/tux3/user/writeback.h
Expand Up @@ -12,6 +12,7 @@
#define I_DIRTY_TIME (1 << 11)
#define __I_DIRTY_TIME_EXPIRED 12
#define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED)
#define I_CREATING (1 << 15)

#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
Expand Down

0 comments on commit d78696e

Please sign in to comment.