Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124905
b: refs/heads/master
c: 92bfc6e
h: refs/heads/master
i:
  124903: e8321a4
v: v3
  • Loading branch information
Christoph Hellwig authored and Niv Sardi committed Dec 1, 2008
1 parent 0c29edf commit 018c111
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 72 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 94e1b69d1abd108d306e926c3012ec89e481c0da
refs/heads/master: 92bfc6e7c4eabbbd15e7d6d49123b296d05dcfd1
1 change: 0 additions & 1 deletion trunk/fs/xfs/xfs_ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "xfs_rtalloc.h"
#include "xfs_error.h"
#include "xfs_bmap.h"
#include "xfs_imap.h"


/*
Expand Down
31 changes: 0 additions & 31 deletions trunk/fs/xfs/xfs_imap.h

This file was deleted.

49 changes: 18 additions & 31 deletions trunk/fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "xfs_bit.h"
#include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_imap.h"
#include "xfs_trans.h"
#include "xfs_trans_priv.h"
#include "xfs_sb.h"
Expand Down Expand Up @@ -134,7 +133,7 @@ STATIC int
xfs_imap_to_bp(
xfs_mount_t *mp,
xfs_trans_t *tp,
xfs_imap_t *imap,
struct xfs_imap *imap,
xfs_buf_t **bpp,
uint buf_flags,
uint imap_flags)
Expand Down Expand Up @@ -232,7 +231,7 @@ xfs_inotobp(
int *offset,
uint imap_flags)
{
xfs_imap_t imap;
struct xfs_imap imap;
xfs_buf_t *bp;
int error;

Expand Down Expand Up @@ -277,17 +276,12 @@ xfs_itobp(
xfs_buf_t **bpp,
uint buf_flags)
{
xfs_imap_t imap;
xfs_buf_t *bp;
int error;

ASSERT(ip->i_blkno != 0);
ASSERT(ip->i_imap.im_blkno != 0);

imap.im_blkno = ip->i_blkno;
imap.im_len = ip->i_len;
imap.im_boffset = ip->i_boffset;

error = xfs_imap_to_bp(mp, tp, &imap, &bp, buf_flags, 0);
error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &bp, buf_flags, 0);
if (error)
return error;

Expand All @@ -298,7 +292,7 @@ xfs_itobp(
return EAGAIN;
}

*dipp = (xfs_dinode_t *)xfs_buf_offset(bp, imap.im_boffset);
*dipp = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);
*bpp = bp;
return 0;
}
Expand Down Expand Up @@ -799,9 +793,7 @@ xfs_inode_alloc(
/* initialise the xfs inode */
ip->i_ino = ino;
ip->i_mount = mp;
ip->i_blkno = 0;
ip->i_len = 0;
ip->i_boffset =0;
memset(&ip->i_imap, 0, sizeof(struct xfs_imap));
ip->i_afp = NULL;
memset(&ip->i_df, 0, sizeof(xfs_ifork_t));
ip->i_flags = 0;
Expand Down Expand Up @@ -857,34 +849,29 @@ xfs_iread(
xfs_buf_t *bp;
xfs_dinode_t *dip;
xfs_inode_t *ip;
xfs_imap_t imap;
int error;

ip = xfs_inode_alloc(mp, ino);
if (!ip)
return ENOMEM;

/*
* Get pointers to the on-disk inode and the buffer containing it.
* Fill in the location information in the in-core inode.
*/
imap.im_blkno = bno;
error = xfs_imap(mp, tp, ip->i_ino, &imap, imap_flags);
ip->i_imap.im_blkno = bno;
error = xfs_imap(mp, tp, ip->i_ino, &ip->i_imap, imap_flags);
if (error)
goto out_destroy_inode;
ASSERT(bno == 0 || bno == ip->i_imap.im_blkno);

/*
* Fill in the fields in the inode that will be used to
* map the inode to its buffer from now on.
* Get pointers to the on-disk inode and the buffer containing it.
*/
ip->i_blkno = imap.im_blkno;
ip->i_len = imap.im_len;
ip->i_boffset = imap.im_boffset;
ASSERT(bno == 0 || bno == imap.im_blkno);

error = xfs_imap_to_bp(mp, tp, &imap, &bp, XFS_BUF_LOCK, imap_flags);
error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &bp,
XFS_BUF_LOCK, imap_flags);
if (error)
goto out_destroy_inode;
dip = (xfs_dinode_t *)xfs_buf_offset(bp, imap.im_boffset);
dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);

/*
* If we got something that isn't an inode it means someone
Expand Down Expand Up @@ -1872,7 +1859,7 @@ xfs_iunlink(
ASSERT(be32_to_cpu(dip->di_next_unlinked) == NULLAGINO);
/* both on-disk, don't endian flip twice */
dip->di_next_unlinked = agi->agi_unlinked[bucket_index];
offset = ip->i_boffset +
offset = ip->i_imap.im_boffset +
offsetof(xfs_dinode_t, di_next_unlinked);
xfs_trans_inode_buf(tp, ibp);
xfs_trans_log_buf(tp, ibp, offset,
Expand Down Expand Up @@ -1958,7 +1945,7 @@ xfs_iunlink_remove(
ASSERT(next_agino != 0);
if (next_agino != NULLAGINO) {
dip->di_next_unlinked = cpu_to_be32(NULLAGINO);
offset = ip->i_boffset +
offset = ip->i_imap.im_boffset +
offsetof(xfs_dinode_t, di_next_unlinked);
xfs_trans_inode_buf(tp, ibp);
xfs_trans_log_buf(tp, ibp, offset,
Expand Down Expand Up @@ -2021,7 +2008,7 @@ xfs_iunlink_remove(
ASSERT(next_agino != agino);
if (next_agino != NULLAGINO) {
dip->di_next_unlinked = cpu_to_be32(NULLAGINO);
offset = ip->i_boffset +
offset = ip->i_imap.im_boffset +
offsetof(xfs_dinode_t, di_next_unlinked);
xfs_trans_inode_buf(tp, ibp);
xfs_trans_log_buf(tp, ibp, offset,
Expand Down Expand Up @@ -3201,7 +3188,7 @@ xfs_iflush_int(
}

/* set *dip = inode's place in the buffer */
dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_boffset);
dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);

/*
* Clear i_update_core before copying out the data.
Expand Down
14 changes: 11 additions & 3 deletions trunk/fs/xfs/xfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ typedef struct xfs_ifork {
} if_u2;
} xfs_ifork_t;

/*
* Inode location information. Stored in the inode and passed to
* xfs_imap_to_bp() to get a buffer and dinode for a given inode.
*/
struct xfs_imap {
xfs_daddr_t im_blkno; /* starting BB of inode chunk */
ushort im_len; /* length in BBs of inode chunk */
ushort im_boffset; /* inode offset in block in bytes */
};

/*
* This is the xfs in-core inode structure.
* Most of the on-disk inode is embedded in the i_d field.
Expand Down Expand Up @@ -238,9 +248,7 @@ typedef struct xfs_inode {

/* Inode location stuff */
xfs_ino_t i_ino; /* inode number (agno/agino)*/
xfs_daddr_t i_blkno; /* blkno of inode buffer */
ushort i_len; /* len of inode buffer */
ushort i_boffset; /* off of inode in buffer */
struct xfs_imap i_imap; /* location for xfs_imap() */

/* Extent information. */
xfs_ifork_t *i_afp; /* attribute fork pointer */
Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/xfs/xfs_inode_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,9 @@ xfs_inode_item_init(

iip->ili_format.ilf_type = XFS_LI_INODE;
iip->ili_format.ilf_ino = ip->i_ino;
iip->ili_format.ilf_blkno = ip->i_blkno;
iip->ili_format.ilf_len = ip->i_len;
iip->ili_format.ilf_boffset = ip->i_boffset;
iip->ili_format.ilf_blkno = ip->i_imap.im_blkno;
iip->ili_format.ilf_len = ip->i_imap.im_len;
iip->ili_format.ilf_boffset = ip->i_imap.im_boffset;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/xfs/xfs_itable.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ xfs_bulkstat_one_iget(
}

ASSERT(ip != NULL);
ASSERT(ip->i_blkno != (xfs_daddr_t)0);
ASSERT(ip->i_imap.im_blkno != 0);

dic = &ip->i_d;

Expand Down
1 change: 0 additions & 1 deletion trunk/fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_imap.h"
#include "xfs_alloc.h"
#include "xfs_ialloc.h"
#include "xfs_log_priv.h"
Expand Down

0 comments on commit 018c111

Please sign in to comment.