diff options
author | Christoph Hellwig <hch@lst.de> | 2008-11-27 22:23:38 -0500 |
---|---|---|
committer | Niv Sardi <xaiki@sgi.com> | 2008-11-30 19:37:31 -0500 |
commit | d42f08f61c5e7f0ed4c6b6df4c9987ddb85ec66e (patch) | |
tree | dfba895d780bf54bb60c284a3b8e702d20719fa4 /fs/xfs | |
parent | b28708d6a0a3ed65a68f0dcd8e6d1c09f14e5cf3 (diff) |
[XFS] kill xfs_ialloc_log_di
xfs_ialloc_log_di is only used to log the full inode core + di_next_unlinked.
That means all the offset magic is not nessecary and we can simply use
xfs_trans_log_buf directly. Also add a comment describing what we should do
here instead.
(First sent on October 7th)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Niv Sardi <xaiki@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_dinode.h | 34 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 75 |
2 files changed, 10 insertions, 99 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index d7cf392cc852..10f9204b81eb 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h | |||
@@ -106,40 +106,6 @@ typedef struct xfs_dinode | |||
106 | #define XFS_MAXLINK_1 65535U | 106 | #define XFS_MAXLINK_1 65535U |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * Bit names for logging disk inodes only | ||
110 | */ | ||
111 | #define XFS_DI_MAGIC 0x0000001 | ||
112 | #define XFS_DI_MODE 0x0000002 | ||
113 | #define XFS_DI_VERSION 0x0000004 | ||
114 | #define XFS_DI_FORMAT 0x0000008 | ||
115 | #define XFS_DI_ONLINK 0x0000010 | ||
116 | #define XFS_DI_UID 0x0000020 | ||
117 | #define XFS_DI_GID 0x0000040 | ||
118 | #define XFS_DI_NLINK 0x0000080 | ||
119 | #define XFS_DI_PROJID 0x0000100 | ||
120 | #define XFS_DI_PAD 0x0000200 | ||
121 | #define XFS_DI_ATIME 0x0000400 | ||
122 | #define XFS_DI_MTIME 0x0000800 | ||
123 | #define XFS_DI_CTIME 0x0001000 | ||
124 | #define XFS_DI_SIZE 0x0002000 | ||
125 | #define XFS_DI_NBLOCKS 0x0004000 | ||
126 | #define XFS_DI_EXTSIZE 0x0008000 | ||
127 | #define XFS_DI_NEXTENTS 0x0010000 | ||
128 | #define XFS_DI_NAEXTENTS 0x0020000 | ||
129 | #define XFS_DI_FORKOFF 0x0040000 | ||
130 | #define XFS_DI_AFORMAT 0x0080000 | ||
131 | #define XFS_DI_DMEVMASK 0x0100000 | ||
132 | #define XFS_DI_DMSTATE 0x0200000 | ||
133 | #define XFS_DI_FLAGS 0x0400000 | ||
134 | #define XFS_DI_GEN 0x0800000 | ||
135 | #define XFS_DI_NEXT_UNLINKED 0x1000000 | ||
136 | #define XFS_DI_U 0x2000000 | ||
137 | #define XFS_DI_A 0x4000000 | ||
138 | #define XFS_DI_NUM_BITS 27 | ||
139 | #define XFS_DI_ALL_BITS ((1 << XFS_DI_NUM_BITS) - 1) | ||
140 | #define XFS_DI_CORE_BITS (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI_A)) | ||
141 | |||
142 | /* | ||
143 | * Values for di_format | 109 | * Values for di_format |
144 | */ | 110 | */ |
145 | typedef enum xfs_dinode_fmt | 111 | typedef enum xfs_dinode_fmt |
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index efb65fea203c..86d463ee7b9b 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -41,68 +41,6 @@ | |||
41 | #include "xfs_error.h" | 41 | #include "xfs_error.h" |
42 | #include "xfs_bmap.h" | 42 | #include "xfs_bmap.h" |
43 | 43 | ||
44 | /* | ||
45 | * Log specified fields for the inode given by bp and off. | ||
46 | */ | ||
47 | STATIC void | ||
48 | xfs_ialloc_log_di( | ||
49 | xfs_trans_t *tp, /* transaction pointer */ | ||
50 | xfs_buf_t *bp, /* inode buffer */ | ||
51 | int off, /* index of inode in buffer */ | ||
52 | int fields) /* bitmask of fields to log */ | ||
53 | { | ||
54 | int first; /* first byte number */ | ||
55 | int ioffset; /* off in bytes */ | ||
56 | int last; /* last byte number */ | ||
57 | xfs_mount_t *mp; /* mount point structure */ | ||
58 | static const short offsets[] = { /* field offsets */ | ||
59 | /* keep in sync with bits */ | ||
60 | offsetof(xfs_dinode_core_t, di_magic), | ||
61 | offsetof(xfs_dinode_core_t, di_mode), | ||
62 | offsetof(xfs_dinode_core_t, di_version), | ||
63 | offsetof(xfs_dinode_core_t, di_format), | ||
64 | offsetof(xfs_dinode_core_t, di_onlink), | ||
65 | offsetof(xfs_dinode_core_t, di_uid), | ||
66 | offsetof(xfs_dinode_core_t, di_gid), | ||
67 | offsetof(xfs_dinode_core_t, di_nlink), | ||
68 | offsetof(xfs_dinode_core_t, di_projid), | ||
69 | offsetof(xfs_dinode_core_t, di_pad), | ||
70 | offsetof(xfs_dinode_core_t, di_atime), | ||
71 | offsetof(xfs_dinode_core_t, di_mtime), | ||
72 | offsetof(xfs_dinode_core_t, di_ctime), | ||
73 | offsetof(xfs_dinode_core_t, di_size), | ||
74 | offsetof(xfs_dinode_core_t, di_nblocks), | ||
75 | offsetof(xfs_dinode_core_t, di_extsize), | ||
76 | offsetof(xfs_dinode_core_t, di_nextents), | ||
77 | offsetof(xfs_dinode_core_t, di_anextents), | ||
78 | offsetof(xfs_dinode_core_t, di_forkoff), | ||
79 | offsetof(xfs_dinode_core_t, di_aformat), | ||
80 | offsetof(xfs_dinode_core_t, di_dmevmask), | ||
81 | offsetof(xfs_dinode_core_t, di_dmstate), | ||
82 | offsetof(xfs_dinode_core_t, di_flags), | ||
83 | offsetof(xfs_dinode_core_t, di_gen), | ||
84 | offsetof(xfs_dinode_t, di_next_unlinked), | ||
85 | offsetof(xfs_dinode_t, di_u), | ||
86 | offsetof(xfs_dinode_t, di_a), | ||
87 | sizeof(xfs_dinode_t) | ||
88 | }; | ||
89 | |||
90 | |||
91 | ASSERT(offsetof(xfs_dinode_t, di_core) == 0); | ||
92 | ASSERT((fields & (XFS_DI_U|XFS_DI_A)) == 0); | ||
93 | mp = tp->t_mountp; | ||
94 | /* | ||
95 | * Get the inode-relative first and last bytes for these fields | ||
96 | */ | ||
97 | xfs_btree_offsets(fields, offsets, XFS_DI_NUM_BITS, &first, &last); | ||
98 | /* | ||
99 | * Convert to buffer offsets and log it. | ||
100 | */ | ||
101 | ioffset = off << mp->m_sb.sb_inodelog; | ||
102 | first += ioffset; | ||
103 | last += ioffset; | ||
104 | xfs_trans_log_buf(tp, bp, first, last); | ||
105 | } | ||
106 | 44 | ||
107 | /* | 45 | /* |
108 | * Allocation group level functions. | 46 | * Allocation group level functions. |
@@ -406,18 +344,25 @@ xfs_ialloc_ag_alloc( | |||
406 | XFS_BUF_LOCK); | 344 | XFS_BUF_LOCK); |
407 | ASSERT(fbuf); | 345 | ASSERT(fbuf); |
408 | ASSERT(!XFS_BUF_GETERROR(fbuf)); | 346 | ASSERT(!XFS_BUF_GETERROR(fbuf)); |
347 | |||
409 | /* | 348 | /* |
410 | * Set initial values for the inodes in this buffer. | 349 | * Initialize all inodes in this buffer and then log them. |
350 | * | ||
351 | * XXX: It would be much better if we had just one transaction to | ||
352 | * log a whole cluster of inodes instead of all the indivdual | ||
353 | * transactions causing a lot of log traffic. | ||
411 | */ | 354 | */ |
412 | xfs_biozero(fbuf, 0, ninodes << args.mp->m_sb.sb_inodelog); | 355 | xfs_biozero(fbuf, 0, ninodes << args.mp->m_sb.sb_inodelog); |
413 | for (i = 0; i < ninodes; i++) { | 356 | for (i = 0; i < ninodes; i++) { |
357 | int ioffset = i << args.mp->m_sb.sb_inodelog; | ||
358 | uint isize = sizeof(xfs_dinode_t) + sizeof(__be32); | ||
359 | |||
414 | free = XFS_MAKE_IPTR(args.mp, fbuf, i); | 360 | free = XFS_MAKE_IPTR(args.mp, fbuf, i); |
415 | free->di_core.di_magic = cpu_to_be16(XFS_DINODE_MAGIC); | 361 | free->di_core.di_magic = cpu_to_be16(XFS_DINODE_MAGIC); |
416 | free->di_core.di_version = version; | 362 | free->di_core.di_version = version; |
417 | free->di_core.di_gen = cpu_to_be32(gen); | 363 | free->di_core.di_gen = cpu_to_be32(gen); |
418 | free->di_next_unlinked = cpu_to_be32(NULLAGINO); | 364 | free->di_next_unlinked = cpu_to_be32(NULLAGINO); |
419 | xfs_ialloc_log_di(tp, fbuf, i, | 365 | xfs_trans_log_buf(tp, fbuf, ioffset, ioffset + isize - 1); |
420 | XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED); | ||
421 | } | 366 | } |
422 | xfs_trans_inode_alloc_buf(tp, fbuf); | 367 | xfs_trans_inode_alloc_buf(tp, fbuf); |
423 | } | 368 | } |