Blame view
fs/jfs/jfs_inode.c
4.04 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 |
/* * Copyright (C) International Business Machines Corp., 2000-2004 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |
63f83c9fc JFS: White space ... |
6 |
* the Free Software Foundation; either version 2 of the License, or |
1da177e4c Linux-2.6.12-rc2 |
7 |
* (at your option) any later version. |
63f83c9fc JFS: White space ... |
8 |
* |
1da177e4c Linux-2.6.12-rc2 |
9 10 11 12 13 14 |
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License |
63f83c9fc JFS: White space ... |
15 |
* along with this program; if not, write to the Free Software |
1da177e4c Linux-2.6.12-rc2 |
16 17 18 19 20 21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/fs.h> #include <linux/quotaops.h> #include "jfs_incore.h" |
1868f4aa5 JFS: fix sparse w... |
22 |
#include "jfs_inode.h" |
1da177e4c Linux-2.6.12-rc2 |
23 24 25 26 |
#include "jfs_filsys.h" #include "jfs_imap.h" #include "jfs_dinode.h" #include "jfs_debug.h" |
fa3241d24 JFS: ext2 inode a... |
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
void jfs_set_inode_flags(struct inode *inode) { unsigned int flags = JFS_IP(inode)->mode2; inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | S_NOATIME | S_DIRSYNC | S_SYNC); if (flags & JFS_IMMUTABLE_FL) inode->i_flags |= S_IMMUTABLE; if (flags & JFS_APPEND_FL) inode->i_flags |= S_APPEND; if (flags & JFS_NOATIME_FL) inode->i_flags |= S_NOATIME; if (flags & JFS_DIRSYNC_FL) inode->i_flags |= S_DIRSYNC; if (flags & JFS_SYNC_FL) inode->i_flags |= S_SYNC; } |
3e2221c73 Copy i_flags to j... |
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip) { unsigned int flags = jfs_ip->vfs_inode.i_flags; jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_APPEND_FL | JFS_NOATIME_FL | JFS_DIRSYNC_FL | JFS_SYNC_FL); if (flags & S_IMMUTABLE) jfs_ip->mode2 |= JFS_IMMUTABLE_FL; if (flags & S_APPEND) jfs_ip->mode2 |= JFS_APPEND_FL; if (flags & S_NOATIME) jfs_ip->mode2 |= JFS_NOATIME_FL; if (flags & S_DIRSYNC) jfs_ip->mode2 |= JFS_DIRSYNC_FL; if (flags & S_SYNC) jfs_ip->mode2 |= JFS_SYNC_FL; } |
1da177e4c Linux-2.6.12-rc2 |
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
/* * NAME: ialloc() * * FUNCTION: Allocate a new inode * */ struct inode *ialloc(struct inode *parent, umode_t mode) { struct super_block *sb = parent->i_sb; struct inode *inode; struct jfs_inode_info *jfs_inode; int rc; inode = new_inode(sb); if (!inode) { jfs_warn("ialloc: new_inode returned NULL!"); |
1f3403fa6 nfsd race fixes: jfs |
79 80 |
rc = -ENOMEM; goto fail; |
1da177e4c Linux-2.6.12-rc2 |
81 82 83 84 85 86 87 |
} jfs_inode = JFS_IP(inode); rc = diAlloc(parent, S_ISDIR(mode), inode); if (rc) { jfs_warn("ialloc: diAlloc returned %d!", rc); |
087387f90 [PATCH] JFS: retu... |
88 89 |
if (rc == -EIO) make_bad_inode(inode); |
1f3403fa6 nfsd race fixes: jfs |
90 91 92 93 94 95 |
goto fail_put; } if (insert_inode_locked(inode) < 0) { rc = -EINVAL; goto fail_unlock; |
1da177e4c Linux-2.6.12-rc2 |
96 |
} |
319b2be49 jfs: replace inod... |
97 |
inode_init_owner(inode, parent, mode); |
1da177e4c Linux-2.6.12-rc2 |
98 |
/* |
69eb66d7d JFS: add uid, gid... |
99 100 101 102 103 104 105 |
* New inodes need to save sane values on disk when * uid & gid mount options are used */ jfs_inode->saved_uid = inode->i_uid; jfs_inode->saved_gid = inode->i_gid; /* |
1da177e4c Linux-2.6.12-rc2 |
106 107 |
* Allocate inode to quota. */ |
871a29315 dquot: cleanup dq... |
108 |
dquot_initialize(inode); |
63936ddaa dquot: cleanup in... |
109 110 |
rc = dquot_alloc_inode(inode); if (rc) |
1f3403fa6 nfsd race fixes: jfs |
111 |
goto fail_drop; |
1da177e4c Linux-2.6.12-rc2 |
112 |
|
fa3241d24 JFS: ext2 inode a... |
113 114 115 116 117 118 119 |
/* inherit flags from parent */ jfs_inode->mode2 = JFS_IP(parent)->mode2 & JFS_FL_INHERIT; if (S_ISDIR(mode)) { jfs_inode->mode2 |= IDIRECTORY; jfs_inode->mode2 &= ~JFS_DIRSYNC_FL; } |
4837c672f JFS: Fix regressi... |
120 |
else { |
fa3241d24 JFS: ext2 inode a... |
121 |
jfs_inode->mode2 |= INLINEEA | ISPARSE; |
4837c672f JFS: Fix regressi... |
122 123 124 |
if (S_ISLNK(mode)) jfs_inode->mode2 &= ~(JFS_IMMUTABLE_FL|JFS_APPEND_FL); } |
319b2be49 jfs: replace inod... |
125 |
jfs_inode->mode2 |= inode->i_mode; |
fa3241d24 JFS: ext2 inode a... |
126 |
|
1da177e4c Linux-2.6.12-rc2 |
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
inode->i_blocks = 0; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; jfs_inode->otime = inode->i_ctime.tv_sec; inode->i_generation = JFS_SBI(sb)->gengen++; jfs_inode->cflag = 0; /* Zero remaining fields */ memset(&jfs_inode->acl, 0, sizeof(dxd_t)); memset(&jfs_inode->ea, 0, sizeof(dxd_t)); jfs_inode->next_index = 0; jfs_inode->acltype = 0; jfs_inode->btorder = 0; jfs_inode->btindex = 0; jfs_inode->bxflag = 0; jfs_inode->blid = 0; jfs_inode->atlhead = 0; jfs_inode->atltail = 0; jfs_inode->xtlid = 0; |
fa3241d24 JFS: ext2 inode a... |
146 |
jfs_set_inode_flags(inode); |
1da177e4c Linux-2.6.12-rc2 |
147 148 149 150 151 |
jfs_info("ialloc returns inode = 0x%p ", inode); return inode; |
1f3403fa6 nfsd race fixes: jfs |
152 153 |
fail_drop: |
9f7547580 dquot: cleanup dq... |
154 |
dquot_drop(inode); |
1f3403fa6 nfsd race fixes: jfs |
155 156 |
inode->i_flags |= S_NOQUOTA; fail_unlock: |
6d6b77f16 filesystems: add ... |
157 |
clear_nlink(inode); |
1f3403fa6 nfsd race fixes: jfs |
158 159 160 161 162 |
unlock_new_inode(inode); fail_put: iput(inode); fail: return ERR_PTR(rc); |
1da177e4c Linux-2.6.12-rc2 |
163 |
} |