aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-01-17 18:34:51 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2007-01-17 18:34:51 -0500
commit9cdf083f981b8d37b3212400a359368661385099 (patch)
treeaa15a6a08ad87e650dea40fb59b3180bef0d345b /fs/inode.c
parente499e01d234a31d59679b7b1e1cf628d917ba49a (diff)
parenta8b3485287731978899ced11f24628c927890e78 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c54
1 files changed, 33 insertions, 21 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 26cdb115ce67..bf21dc6d0dbd 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -97,7 +97,7 @@ static DEFINE_MUTEX(iprune_mutex);
97 */ 97 */
98struct inodes_stat_t inodes_stat; 98struct inodes_stat_t inodes_stat;
99 99
100static kmem_cache_t * inode_cachep __read_mostly; 100static struct kmem_cache * inode_cachep __read_mostly;
101 101
102static struct inode *alloc_inode(struct super_block *sb) 102static struct inode *alloc_inode(struct super_block *sb)
103{ 103{
@@ -109,7 +109,7 @@ static struct inode *alloc_inode(struct super_block *sb)
109 if (sb->s_op->alloc_inode) 109 if (sb->s_op->alloc_inode)
110 inode = sb->s_op->alloc_inode(sb); 110 inode = sb->s_op->alloc_inode(sb);
111 else 111 else
112 inode = (struct inode *) kmem_cache_alloc(inode_cachep, SLAB_KERNEL); 112 inode = (struct inode *) kmem_cache_alloc(inode_cachep, GFP_KERNEL);
113 113
114 if (inode) { 114 if (inode) {
115 struct address_space * const mapping = &inode->i_data; 115 struct address_space * const mapping = &inode->i_data;
@@ -209,7 +209,7 @@ void inode_init_once(struct inode *inode)
209 209
210EXPORT_SYMBOL(inode_init_once); 210EXPORT_SYMBOL(inode_init_once);
211 211
212static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 212static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
213{ 213{
214 struct inode * inode = (struct inode *) foo; 214 struct inode * inode = (struct inode *) foo;
215 215
@@ -1144,7 +1144,6 @@ sector_t bmap(struct inode * inode, sector_t block)
1144 res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block); 1144 res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block);
1145 return res; 1145 return res;
1146} 1146}
1147
1148EXPORT_SYMBOL(bmap); 1147EXPORT_SYMBOL(bmap);
1149 1148
1150/** 1149/**
@@ -1163,27 +1162,43 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
1163 1162
1164 if (IS_RDONLY(inode)) 1163 if (IS_RDONLY(inode))
1165 return; 1164 return;
1166 1165 if (inode->i_flags & S_NOATIME)
1167 if ((inode->i_flags & S_NOATIME) || 1166 return;
1168 (inode->i_sb->s_flags & MS_NOATIME) || 1167 if (inode->i_sb->s_flags & MS_NOATIME)
1169 ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))) 1168 return;
1169 if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
1170 return; 1170 return;
1171 1171
1172 /* 1172 /*
1173 * We may have a NULL vfsmount when coming from NFSD 1173 * We may have a NULL vfsmount when coming from NFSD
1174 */ 1174 */
1175 if (mnt && 1175 if (mnt) {
1176 ((mnt->mnt_flags & MNT_NOATIME) || 1176 if (mnt->mnt_flags & MNT_NOATIME)
1177 ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)))) 1177 return;
1178 return; 1178 if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
1179 return;
1179 1180
1180 now = current_fs_time(inode->i_sb); 1181 if (mnt->mnt_flags & MNT_RELATIME) {
1181 if (!timespec_equal(&inode->i_atime, &now)) { 1182 /*
1182 inode->i_atime = now; 1183 * With relative atime, only update atime if the
1183 mark_inode_dirty_sync(inode); 1184 * previous atime is earlier than either the ctime or
1185 * mtime.
1186 */
1187 if (timespec_compare(&inode->i_mtime,
1188 &inode->i_atime) < 0 &&
1189 timespec_compare(&inode->i_ctime,
1190 &inode->i_atime) < 0)
1191 return;
1192 }
1184 } 1193 }
1185}
1186 1194
1195 now = current_fs_time(inode->i_sb);
1196 if (timespec_equal(&inode->i_atime, &now))
1197 return;
1198
1199 inode->i_atime = now;
1200 mark_inode_dirty_sync(inode);
1201}
1187EXPORT_SYMBOL(touch_atime); 1202EXPORT_SYMBOL(touch_atime);
1188 1203
1189/** 1204/**
@@ -1200,7 +1215,7 @@ EXPORT_SYMBOL(touch_atime);
1200 1215
1201void file_update_time(struct file *file) 1216void file_update_time(struct file *file)
1202{ 1217{
1203 struct inode *inode = file->f_dentry->d_inode; 1218 struct inode *inode = file->f_path.dentry->d_inode;
1204 struct timespec now; 1219 struct timespec now;
1205 int sync_it = 0; 1220 int sync_it = 0;
1206 1221
@@ -1242,9 +1257,6 @@ EXPORT_SYMBOL(inode_needs_sync);
1242 */ 1257 */
1243#ifdef CONFIG_QUOTA 1258#ifdef CONFIG_QUOTA
1244 1259
1245/* Function back in dquot.c */
1246int remove_inode_dquot_ref(struct inode *, int, struct list_head *);
1247
1248void remove_dquot_ref(struct super_block *sb, int type, 1260void remove_dquot_ref(struct super_block *sb, int type,
1249 struct list_head *tofree_head) 1261 struct list_head *tofree_head)
1250{ 1262{