aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-05-09 08:49:59 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-05-09 11:44:49 -0400
commitd4b2cf1b0566eebfe39a6d70e9e4b5fa01ddaace (patch)
tree2f682adea3ac272ea865335ee3449c056a96f088 /fs/gfs2/inode.c
parent94fb763b1a76a2000ad21f3119b05c90040acaf0 (diff)
GFS2: Move gfs2_refresh_inode() and friends into glops.c
Eventually there will only be a single caller of this code, so lets move it where it can be made static at some future date. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c117
1 files changed, 0 insertions, 117 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 7c2121fe10df..5d48baf46457 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -35,11 +35,6 @@
35#include "trans.h" 35#include "trans.h"
36#include "util.h" 36#include "util.h"
37 37
38struct gfs2_inum_range_host {
39 u64 ir_start;
40 u64 ir_length;
41};
42
43struct gfs2_skip_data { 38struct gfs2_skip_data {
44 u64 no_addr; 39 u64 no_addr;
45 int skipped; 40 int skipped;
@@ -248,118 +243,6 @@ fail_iput:
248 goto fail; 243 goto fail;
249} 244}
250 245
251/**
252 * gfs2_set_nlink - Set the inode's link count based on on-disk info
253 * @inode: The inode in question
254 * @nlink: The link count
255 *
256 * If the link count has hit zero, it must never be raised, whatever the
257 * on-disk inode might say. When new struct inodes are created the link
258 * count is set to 1, so that we can safely use this test even when reading
259 * in on disk information for the first time.
260 */
261
262static void gfs2_set_nlink(struct inode *inode, u32 nlink)
263{
264 /*
265 * We will need to review setting the nlink count here in the
266 * light of the forthcoming ro bind mount work. This is a reminder
267 * to do that.
268 */
269 if ((inode->i_nlink != nlink) && (inode->i_nlink != 0)) {
270 if (nlink == 0)
271 clear_nlink(inode);
272 else
273 inode->i_nlink = nlink;
274 }
275}
276
277static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
278{
279 const struct gfs2_dinode *str = buf;
280 struct timespec atime;
281 u16 height, depth;
282
283 if (unlikely(ip->i_no_addr != be64_to_cpu(str->di_num.no_addr)))
284 goto corrupt;
285 ip->i_no_formal_ino = be64_to_cpu(str->di_num.no_formal_ino);
286 ip->i_inode.i_mode = be32_to_cpu(str->di_mode);
287 ip->i_inode.i_rdev = 0;
288 switch (ip->i_inode.i_mode & S_IFMT) {
289 case S_IFBLK:
290 case S_IFCHR:
291 ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major),
292 be32_to_cpu(str->di_minor));
293 break;
294 };
295
296 ip->i_inode.i_uid = be32_to_cpu(str->di_uid);
297 ip->i_inode.i_gid = be32_to_cpu(str->di_gid);
298 gfs2_set_nlink(&ip->i_inode, be32_to_cpu(str->di_nlink));
299 i_size_write(&ip->i_inode, be64_to_cpu(str->di_size));
300 gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks));
301 atime.tv_sec = be64_to_cpu(str->di_atime);
302 atime.tv_nsec = be32_to_cpu(str->di_atime_nsec);
303 if (timespec_compare(&ip->i_inode.i_atime, &atime) < 0)
304 ip->i_inode.i_atime = atime;
305 ip->i_inode.i_mtime.tv_sec = be64_to_cpu(str->di_mtime);
306 ip->i_inode.i_mtime.tv_nsec = be32_to_cpu(str->di_mtime_nsec);
307 ip->i_inode.i_ctime.tv_sec = be64_to_cpu(str->di_ctime);
308 ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec);
309
310 ip->i_goal = be64_to_cpu(str->di_goal_meta);
311 ip->i_generation = be64_to_cpu(str->di_generation);
312
313 ip->i_diskflags = be32_to_cpu(str->di_flags);
314 gfs2_set_inode_flags(&ip->i_inode);
315 height = be16_to_cpu(str->di_height);
316 if (unlikely(height > GFS2_MAX_META_HEIGHT))
317 goto corrupt;
318 ip->i_height = (u8)height;
319
320 depth = be16_to_cpu(str->di_depth);
321 if (unlikely(depth > GFS2_DIR_MAX_DEPTH))
322 goto corrupt;
323 ip->i_depth = (u8)depth;
324 ip->i_entries = be32_to_cpu(str->di_entries);
325
326 ip->i_eattr = be64_to_cpu(str->di_eattr);
327 if (S_ISREG(ip->i_inode.i_mode))
328 gfs2_set_aops(&ip->i_inode);
329
330 return 0;
331corrupt:
332 gfs2_consist_inode(ip);
333 return -EIO;
334}
335
336/**
337 * gfs2_inode_refresh - Refresh the incore copy of the dinode
338 * @ip: The GFS2 inode
339 *
340 * Returns: errno
341 */
342
343int gfs2_inode_refresh(struct gfs2_inode *ip)
344{
345 struct buffer_head *dibh;
346 int error;
347
348 error = gfs2_meta_inode_buffer(ip, &dibh);
349 if (error)
350 return error;
351
352 if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), dibh, GFS2_METATYPE_DI)) {
353 brelse(dibh);
354 return -EIO;
355 }
356
357 error = gfs2_dinode_in(ip, dibh->b_data);
358 brelse(dibh);
359 clear_bit(GIF_INVALID, &ip->i_flags);
360
361 return error;
362}
363 246
364struct inode *gfs2_lookup_simple(struct inode *dip, const char *name) 247struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
365{ 248{