1 diff -urN linux.org/fs/xfs/linux/xfs_aops.c linux/fs/xfs/linux/xfs_aops.c
2 --- linux.org/fs/xfs/linux/xfs_aops.c 2003-12-31 05:48:20.000000000 +0100
3 +++ linux/fs/xfs/linux/xfs_aops.c 2004-01-02 04:21:43.000000000 +0100
8 +#include "xfs_iomap.h"
9 #include <linux/mpage.h>
11 STATIC void convert_page(struct inode *, struct page *,
12 - page_buf_bmap_t *, void *, int, int);
13 + xfs_iomap_t *, void *, int, int);
16 linvfs_unwritten_done(
18 vnode_t *vp = XFS_BUF_FSPRIVATE(bp, vnode_t *);
21 - if (atomic_read(&bp->pb_hold) < 1)
24 + BUG_ON(atomic_read(&bp->pb_hold) < 1);
25 VOP_BMAP(vp, XFS_BUF_OFFSET(bp), XFS_BUF_SIZE(bp),
26 - BMAP_UNWRITTEN, NULL, NULL, error);
27 + BMAPI_UNWRITTEN, NULL, NULL, error);
28 XFS_BUF_SET_FSPRIVATE(bp, NULL);
29 XFS_BUF_CLR_IODONE_FUNC(bp);
32 vnode_t *vp = LINVFS_GET_VP(inode);
35 - VOP_BMAP(vp, offset, size, BMAP_UNWRITTEN, NULL, NULL, error);
36 + VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error);
44 - page_buf_bmap_t *pbmapp,
45 + xfs_iomap_t *iomapp,
48 vnode_t *vp = LINVFS_GET_VP(inode);
49 - int error, nmaps = 1;
50 + int error, niomaps = 1;
52 - if (((flags & (BMAP_DIRECT|BMAP_SYNC)) == BMAP_DIRECT) &&
53 + if (((flags & (BMAPI_DIRECT|BMAPI_SYNC)) == BMAPI_DIRECT) &&
54 (offset >= i_size_read(inode)))
55 count = max_t(ssize_t, count, XFS_WRITE_IO_LOG);
57 - VOP_BMAP(vp, offset, count, flags, pbmapp, &nmaps, error);
58 + VOP_BMAP(vp, offset, count, flags, iomapp, &niomaps, error);
59 if ((error == EAGAIN) || (error == EIO))
61 - if (unlikely((flags & (BMAP_WRITE|BMAP_DIRECT)) ==
62 - (BMAP_WRITE|BMAP_DIRECT) && nmaps &&
63 - (pbmapp->pbm_flags & PBMF_DELAY))) {
64 - flags = BMAP_ALLOCATE;
65 + if (unlikely((flags & (BMAPI_WRITE|BMAPI_DIRECT)) ==
66 + (BMAPI_WRITE|BMAPI_DIRECT) && niomaps &&
67 + (iomapp->iomap_flags & IOMAP_DELAY))) {
68 + flags = BMAPI_ALLOCATE;
71 - if (flags & (BMAP_WRITE|BMAP_ALLOCATE)) {
72 + if (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)) {
77 * Finds the corresponding mapping in block @map array of the
78 * given @offset within a @page.
80 -STATIC page_buf_bmap_t *
82 match_offset_to_mapping(
84 - page_buf_bmap_t *map,
85 + xfs_iomap_t *iomapp,
88 loff_t full_offset; /* offset from start of file */
90 full_offset <<= PAGE_CACHE_SHIFT; /* offset from file start */
91 full_offset += offset; /* offset from page start */
93 - if (full_offset < map->pbm_offset)
94 + if (full_offset < iomapp->iomap_offset)
96 - if (map->pbm_offset + map->pbm_bsize > full_offset)
98 + if (iomapp->iomap_offset + iomapp->iomap_bsize > full_offset)
103 @@ -183,30 +182,30 @@
104 struct buffer_head *bh,
105 unsigned long offset,
107 - page_buf_bmap_t *mp)
108 + xfs_iomap_t *iomapp)
110 - page_buf_daddr_t bn;
115 - ASSERT(!(mp->pbm_flags & PBMF_HOLE));
116 - ASSERT(!(mp->pbm_flags & PBMF_DELAY));
117 - ASSERT(mp->pbm_bn != PAGE_BUF_DADDR_NULL);
118 + ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE));
119 + ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY));
120 + ASSERT(iomapp->iomap_bn != IOMAP_DADDR_NULL);
123 delta <<= PAGE_CACHE_SHIFT;
125 - delta -= mp->pbm_offset;
126 + delta -= iomapp->iomap_offset;
127 delta >>= block_bits;
129 sector_shift = block_bits - BBSHIFT;
130 - bn = mp->pbm_bn >> sector_shift;
131 + bn = iomapp->iomap_bn >> sector_shift;
133 - ASSERT((bn << sector_shift) >= mp->pbm_bn);
134 + ASSERT((bn << sector_shift) >= iomapp->iomap_bn);
138 - bh->b_bdev = mp->pbm_target->pbr_bdev;
139 + bh->b_bdev = iomapp->iomap_target->pbr_bdev;
140 set_buffer_mapped(bh);
141 clear_buffer_delay(bh);
144 probe_unwritten_page(
145 struct address_space *mapping,
147 - page_buf_bmap_t *mp,
148 + xfs_iomap_t *iomapp,
150 unsigned long max_offset,
152 @@ -245,11 +244,11 @@
154 if (!buffer_unwritten(bh))
156 - if (!match_offset_to_mapping(page, mp, p_offset))
157 + if (!match_offset_to_mapping(page, iomapp, p_offset))
159 if (p_offset >= max_offset)
161 - map_buffer_at_offset(page, bh, p_offset, bbits, mp);
162 + map_buffer_at_offset(page, bh, p_offset, bbits, iomapp);
163 set_buffer_unwritten_io(bh);
165 p_offset += bh->b_size;
166 @@ -394,11 +393,12 @@
167 struct buffer_head *curr,
168 unsigned long p_offset,
170 - page_buf_bmap_t *mp,
171 + xfs_iomap_t *iomapp,
175 struct buffer_head *bh = curr;
176 - page_buf_bmap_t *tmp;
180 unsigned long nblocks = 0;
182 offset <<= PAGE_CACHE_SHIFT;
185 - pb = pagebuf_lookup(mp->pbm_target,
186 - mp->pbm_offset, mp->pbm_bsize, 0);
187 + pb = pagebuf_lookup(iomapp->iomap_target,
188 + iomapp->iomap_offset, iomapp->iomap_bsize, 0);
192 @@ -433,10 +433,10 @@
194 if (!buffer_unwritten(bh))
196 - tmp = match_offset_to_mapping(start_page, mp, p_offset);
197 + tmp = match_offset_to_mapping(start_page, iomapp, p_offset);
200 - map_buffer_at_offset(start_page, bh, p_offset, block_bits, mp);
201 + map_buffer_at_offset(start_page, bh, p_offset, block_bits, iomapp);
202 set_buffer_unwritten_io(bh);
204 p_offset += bh->b_size;
206 } while ((bh = bh->b_this_page) != head);
208 if (unlikely(nblocks == 0)) {
209 - printk("XFS: bad unwritten extent map: bh=0x%p, mp=0x%p\n",
211 + printk("XFS: bad unwritten extent map: bh=0x%p, iomapp=0x%p\n",
216 @@ -461,26 +461,26 @@
219 tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT;
220 - tloff = (mp->pbm_offset + mp->pbm_bsize) >> PAGE_CACHE_SHIFT;
221 + tloff = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
222 tloff = min(tlast, tloff);
223 for (tindex = start_page->index + 1; tindex < tloff; tindex++) {
224 - page = probe_unwritten_page(mapping, tindex, mp, pb,
225 + page = probe_unwritten_page(mapping, tindex, iomapp, pb,
226 PAGE_CACHE_SIZE, &bs, bbits);
230 atomic_add(bs, &pb->pb_io_remaining);
231 - convert_page(inode, page, mp, pb, 1, all_bh);
232 + convert_page(inode, page, iomapp, pb, startio, all_bh);
235 if (tindex == tlast &&
236 (tloff = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1)))) {
237 - page = probe_unwritten_page(mapping, tindex, mp, pb,
238 + page = probe_unwritten_page(mapping, tindex, iomapp, pb,
242 atomic_add(bs, &pb->pb_io_remaining);
243 - convert_page(inode, page, mp, pb, 1, all_bh);
244 + convert_page(inode, page, iomapp, pb, startio, all_bh);
248 @@ -542,13 +542,13 @@
252 - page_buf_bmap_t *maps,
253 + xfs_iomap_t *iomapp,
258 struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
259 - page_buf_bmap_t *mp = maps, *tmp;
260 + xfs_iomap_t *mp = iomapp, *tmp;
261 unsigned long end, offset, end_index;
262 int i = 0, index = 0;
263 int bbits = inode->i_blkbits;
264 @@ -575,17 +575,17 @@
265 tmp = match_offset_to_mapping(page, mp, offset);
268 - ASSERT(!(tmp->pbm_flags & PBMF_HOLE));
269 - ASSERT(!(tmp->pbm_flags & PBMF_DELAY));
270 + ASSERT(!(tmp->iomap_flags & IOMAP_HOLE));
271 + ASSERT(!(tmp->iomap_flags & IOMAP_DELAY));
273 /* If this is a new unwritten extent buffer (i.e. one
274 * that we haven't passed in private data for, we must
275 * now map this buffer too.
277 if (buffer_unwritten(bh) && !bh->b_end_io) {
278 - ASSERT(tmp->pbm_flags & PBMF_UNWRITTEN);
279 + ASSERT(tmp->iomap_flags & IOMAP_UNWRITTEN);
280 map_unwritten(inode, page, head, bh,
281 - offset, bbits, tmp, all_bh);
282 + offset, bbits, tmp, startio, all_bh);
283 } else if (! (buffer_unwritten(bh) && buffer_locked(bh))) {
284 map_buffer_at_offset(page, bh, offset, bbits, tmp);
285 if (buffer_unwritten(bh)) {
286 @@ -618,19 +618,19 @@
289 unsigned long tindex,
290 - page_buf_bmap_t *mp,
291 + xfs_iomap_t *iomapp,
298 - tlast = (mp->pbm_offset + mp->pbm_bsize) >> PAGE_CACHE_SHIFT;
299 + tlast = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
300 for (; tindex < tlast; tindex++) {
301 page = probe_delalloc_page(inode, tindex);
304 - convert_page(inode, page, mp, NULL, startio, all_bh);
305 + convert_page(inode, page, iomapp, NULL, startio, all_bh);
309 @@ -661,20 +661,21 @@
310 int unmapped) /* also implies page uptodate */
312 struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
313 - page_buf_bmap_t *mp, map;
314 + xfs_iomap_t *iomp, iomap;
315 unsigned long p_offset = 0, end_index;
316 loff_t offset, end_offset;
317 int len, err, i, cnt = 0, uptodate = 1;
318 - int flags = startio ? 0 : BMAP_TRYLOCK;
319 + int flags = startio ? 0 : BMAPI_TRYLOCK;
323 /* Are we off the end of the file ? */
324 end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT;
325 if (page->index >= end_index) {
326 - unsigned remaining = i_size_read(inode) & (PAGE_CACHE_SIZE-1);
327 - if ((page->index >= end_index+1) || !remaining) {
329 + if ((page->index >= end_index + 1) ||
330 + !(i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
336 @@ -684,16 +685,19 @@
337 end_offset = i_size_read(inode);
339 bh = head = page_buffers(page);
345 - if (!(PageUptodate(page) || buffer_uptodate(bh)) && !startio) {
348 + if (offset >= end_offset)
350 + if (!buffer_uptodate(bh))
352 + if (!(PageUptodate(page) || buffer_uptodate(bh)) && !startio)
356 - mp = match_offset_to_mapping(page, &map, p_offset);
358 + iomp = match_offset_to_mapping(page, &iomap, p_offset);
362 @@ -701,21 +705,21 @@
363 * extent state conversion transaction on completion.
365 if (buffer_unwritten(bh)) {
367 - err = map_blocks(inode, offset, len, &map,
368 - BMAP_READ|BMAP_IGNSTATE);
370 + err = map_blocks(inode, offset, len, &iomap,
371 + BMAPI_READ|BMAPI_IGNSTATE);
375 - mp = match_offset_to_mapping(page, &map,
376 + iomp = match_offset_to_mapping(page, &iomap,
382 err = map_unwritten(inode, page,
386 + inode->i_blkbits, iomp,
387 + startio, unmapped);
391 @@ -734,18 +738,18 @@
392 * We can return EAGAIN here in the release page case.
394 } else if (buffer_delay(bh)) {
396 - err = map_blocks(inode, offset, len, &map,
397 - BMAP_ALLOCATE | flags);
399 + err = map_blocks(inode, offset, len, &iomap,
400 + BMAPI_ALLOCATE | flags);
404 - mp = match_offset_to_mapping(page, &map,
405 + iomp = match_offset_to_mapping(page, &iomap,
410 map_buffer_at_offset(page, bh, p_offset,
411 - inode->i_blkbits, mp);
412 + inode->i_blkbits, iomp);
416 @@ -766,22 +770,22 @@
417 * was found, and we are in a path where we
418 * need to write the whole page out.
422 size = probe_unmapped_cluster(
423 inode, page, bh, head);
424 err = map_blocks(inode, offset,
426 - BMAP_WRITE | BMAP_MMAP);
428 + BMAPI_WRITE | BMAPI_MMAP);
432 - mp = match_offset_to_mapping(page, &map,
433 + iomp = match_offset_to_mapping(page, &iomap,
438 map_buffer_at_offset(page,
440 - inode->i_blkbits, mp);
441 + inode->i_blkbits, iomp);
451 - if (!buffer_uptodate(bh))
455 - bh = bh->b_this_page;
456 - } while (offset < end_offset);
457 + } while (offset += len, p_offset += len,
458 + ((bh = bh->b_this_page) != head));
460 if (uptodate && bh == head)
461 SetPageUptodate(page);
464 submit_page(page, bh_arr, cnt);
467 - cluster_write(inode, page->index + 1, mp, startio, unmapped);
469 + cluster_write(inode, page->index + 1, iomp, startio, unmapped);
476 vnode_t *vp = LINVFS_GET_VP(inode);
477 - page_buf_bmap_t pbmap;
482 @@ -866,32 +864,32 @@
483 size = 1 << inode->i_blkbits;
485 VOP_BMAP(vp, offset, size,
486 - create ? flags : BMAP_READ, &pbmap, &retpbbm, error);
487 + create ? flags : BMAPI_READ, &iomap, &retpbbm, error);
494 - if (pbmap.pbm_bn != PAGE_BUF_DADDR_NULL) {
495 - page_buf_daddr_t bn;
496 + if (iomap.iomap_bn != IOMAP_DADDR_NULL) {
500 /* For unwritten extents do not report a disk address on
503 - if (create || ((pbmap.pbm_flags & PBMF_UNWRITTEN) == 0)) {
504 - delta = offset - pbmap.pbm_offset;
505 + if (create || ((iomap.iomap_flags & IOMAP_UNWRITTEN) == 0)) {
506 + delta = offset - iomap.iomap_offset;
507 delta >>= inode->i_blkbits;
509 - bn = pbmap.pbm_bn >> (inode->i_blkbits - BBSHIFT);
510 + bn = iomap.iomap_bn >> (inode->i_blkbits - BBSHIFT);
513 bh_result->b_blocknr = bn;
514 - bh_result->b_bdev = pbmap.pbm_target->pbr_bdev;
515 + bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
516 set_buffer_mapped(bh_result);
518 - if (pbmap.pbm_flags & PBMF_UNWRITTEN) {
519 + if (iomap.iomap_flags & IOMAP_UNWRITTEN) {
522 bh_result->b_private = inode;
523 @@ -902,29 +900,32 @@
527 + /* If this is a realtime file, data might be on a new device */
528 + bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
530 /* If we previously allocated a block out beyond eof and
531 * we are now coming back to use it then we will need to
532 * flag it as new even if it has a disk address.
535 ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) ||
536 - (offset >= i_size_read(inode)) || (pbmap.pbm_flags & PBMF_NEW))) {
537 + (offset >= i_size_read(inode)) || (iomap.iomap_flags & IOMAP_NEW))) {
538 set_buffer_new(bh_result);
541 - if (pbmap.pbm_flags & PBMF_DELAY) {
542 + if (iomap.iomap_flags & IOMAP_DELAY) {
543 if (unlikely(direct))
546 set_buffer_mapped(bh_result);
547 set_buffer_uptodate(bh_result);
549 - bh_result->b_bdev = pbmap.pbm_target->pbr_bdev;
550 + bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
551 set_buffer_delay(bh_result);
555 - size = (pbmap.pbm_bsize - pbmap.pbm_delta);
556 + size = (iomap.iomap_bsize - iomap.iomap_delta);
557 bh_result->b_size = min_t(ssize_t, size, blocks << inode->i_blkbits);
563 return linvfs_get_block_core(inode, iblock, 0, bh_result,
564 - create, 0, BMAP_WRITE);
565 + create, 0, BMAPI_WRITE);
572 return linvfs_get_block_core(inode, iblock, 0, bh_result,
573 - create, 0, BMAP_SYNC|BMAP_WRITE);
574 + create, 0, BMAPI_SYNC|BMAPI_WRITE);
581 return linvfs_get_block_core(inode, iblock, max_blocks, bh_result,
582 - create, 1, BMAP_WRITE|BMAP_DIRECT);
583 + create, 1, BMAPI_WRITE|BMAPI_DIRECT);
587 @@ -976,15 +977,15 @@
588 struct file *file = iocb->ki_filp;
589 struct inode *inode = file->f_dentry->d_inode->i_mapping->host;
590 vnode_t *vp = LINVFS_GET_VP(inode);
591 - page_buf_bmap_t pbmap;
596 - VOP_BMAP(vp, offset, 0, BMAP_DEVICE, &pbmap, &maps, error);
597 + VOP_BMAP(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps, error);
601 - return blockdev_direct_IO(rw, iocb, inode, pbmap.pbm_target->pbr_bdev,
602 + return blockdev_direct_IO(rw, iocb, inode, iomap.iomap_target->pbr_bdev,
603 iov, offset, nr_segs,
604 linvfs_get_blocks_direct,
605 linvfs_unwritten_convert_direct);
606 diff -urN linux.org/fs/xfs/linux/xfs_globals.c linux/fs/xfs/linux/xfs_globals.c
607 --- linux.org/fs/xfs/linux/xfs_globals.c 2003-12-31 05:47:44.000000000 +0100
608 +++ linux/fs/xfs/linux/xfs_globals.c 2004-01-02 04:21:43.000000000 +0100
615 +#include "xfs_buf.h"
616 +#include "xfs_inum.h"
617 +#include "xfs_log.h"
618 +#include "xfs_clnt.h"
619 +#include "xfs_trans.h"
622 +#include "xfs_dir.h"
623 +#include "xfs_dir2.h"
624 +#include "xfs_imap.h"
625 +#include "xfs_alloc.h"
626 +#include "xfs_dmapi.h"
627 +#include "xfs_quota.h"
628 +#include "xfs_mount.h"
629 +#include "xfs_alloc_btree.h"
630 #include "xfs_bmap_btree.h"
631 +#include "xfs_ialloc_btree.h"
632 +#include "xfs_btree.h"
633 +#include "xfs_ialloc.h"
634 +#include "xfs_attr_sf.h"
635 +#include "xfs_dir_sf.h"
636 +#include "xfs_dir2_sf.h"
637 +#include "xfs_dinode.h"
638 +#include "xfs_inode.h"
639 +#include "xfs_bmap.h"
641 +#include "xfs_rtalloc.h"
642 +#include "xfs_error.h"
643 +#include "xfs_itable.h"
645 +#include "xfs_da_btree.h"
646 +#include "xfs_dir_leaf.h"
647 +#include "xfs_dir2_data.h"
648 +#include "xfs_dir2_leaf.h"
649 +#include "xfs_dir2_block.h"
650 +#include "xfs_dir2_node.h"
651 +#include "xfs_dir2_trace.h"
652 +#include "xfs_acl.h"
653 +#include "xfs_cap.h"
654 +#include "xfs_mac.h"
655 +#include "xfs_attr.h"
656 +#include "xfs_attr_leaf.h"
657 +#include "xfs_inode_item.h"
658 +#include "xfs_buf_item.h"
659 +#include "xfs_extfree_item.h"
660 +#include "xfs_log_priv.h"
661 +#include "xfs_trans_priv.h"
662 +#include "xfs_trans_space.h"
663 +#include "xfs_utils.h"
666 * System memory size - used to scale certain data structures in XFS.
669 cred_t sys_cred_val, *sys_cred = &sys_cred_val;
671 -/* Export XFS symbols used by xfsidbg */
673 + * Export symbols used for XFS debugging
675 EXPORT_SYMBOL(xfs_next_bit);
676 EXPORT_SYMBOL(xfs_contig_bits);
677 EXPORT_SYMBOL(xfs_bmbt_get_all);
678 #if ARCH_CONVERT != ARCH_NOCONVERT
679 EXPORT_SYMBOL(xfs_bmbt_disk_get_all);
683 + * Export symbols used for XFS tracing
685 +#ifdef XFS_ALLOC_TRACE
686 +EXPORT_SYMBOL(xfs_alloc_trace_buf);
688 +#ifdef XFS_BMAP_TRACE
689 +EXPORT_SYMBOL(xfs_bmap_trace_buf);
691 +#ifdef XFS_BMBT_TRACE
692 +EXPORT_SYMBOL(xfs_bmbt_trace_buf);
694 +#ifdef XFS_ATTR_TRACE
695 +EXPORT_SYMBOL(xfs_attr_trace_buf);
697 +#ifdef XFS_DIR2_TRACE
698 +EXPORT_SYMBOL(xfs_dir2_trace_buf);
700 +#ifdef XFS_DIR_TRACE
701 +EXPORT_SYMBOL(xfs_dir_trace_buf);
703 diff -urN linux.org/fs/xfs/linux/xfs_ioctl.c linux/fs/xfs/linux/xfs_ioctl.c
704 --- linux.org/fs/xfs/linux/xfs_ioctl.c 2003-12-31 05:48:05.000000000 +0100
705 +++ linux/fs/xfs/linux/xfs_ioctl.c 2004-01-02 04:21:43.000000000 +0100
707 bulkreq.ubuffer, &done);
709 error = xfs_bulkstat(mp, NULL, &inlast, &count,
710 - (bulkstat_one_pf)xfs_bulkstat_one,
711 + (bulkstat_one_pf)xfs_bulkstat_one, NULL,
712 sizeof(xfs_bstat_t), bulkreq.ubuffer,
713 BULKSTAT_FG_QUICK, &done);
715 diff -urN linux.org/fs/xfs/linux/xfs_iomap.c linux/fs/xfs/linux/xfs_iomap.c
716 --- linux.org/fs/xfs/linux/xfs_iomap.c 2003-12-31 05:47:27.000000000 +0100
717 +++ linux/fs/xfs/linux/xfs_iomap.c 2004-01-02 04:21:43.000000000 +0100
719 #include "xfs_buf_item.h"
720 #include "xfs_trans_space.h"
721 #include "xfs_utils.h"
722 +#include "xfs_iomap.h"
724 #define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \
725 << mp->m_writeio_log)
727 #define XFS_WRITE_IMAPS XFS_BMAP_MAX_NMAP
735 xfs_bmbt_irec_t *imap,
736 - page_buf_bmap_t *pbmapp,
737 + xfs_iomap_t *iomapp,
738 int imaps, /* Number of imap entries */
739 - int pbmaps) /* Number of pbmap entries */
740 + int iomaps, /* Number of iomap entries */
746 if (io->io_new_size > nisize)
747 nisize = io->io_new_size;
749 - for (pbm = 0; imaps && pbm < pbmaps; imaps--, pbmapp++, imap++, pbm++) {
750 - pbmapp->pbm_target = io->io_flags & XFS_IOCORE_RT ?
751 + for (pbm = 0; imaps && pbm < iomaps; imaps--, iomapp++, imap++, pbm++) {
752 + iomapp->iomap_target = io->io_flags & XFS_IOCORE_RT ?
753 mp->m_rtdev_targp : mp->m_ddev_targp;
754 - pbmapp->pbm_offset = XFS_FSB_TO_B(mp, imap->br_startoff);
755 - pbmapp->pbm_delta = offset - pbmapp->pbm_offset;
756 - pbmapp->pbm_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
757 - pbmapp->pbm_flags = 0;
758 + iomapp->iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff);
759 + iomapp->iomap_delta = offset - iomapp->iomap_offset;
760 + iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
761 + iomapp->iomap_flags = flags;
763 start_block = imap->br_startblock;
764 if (start_block == HOLESTARTBLOCK) {
765 - pbmapp->pbm_bn = PAGE_BUF_DADDR_NULL;
766 - pbmapp->pbm_flags = PBMF_HOLE;
767 + iomapp->iomap_bn = IOMAP_DADDR_NULL;
768 + iomapp->iomap_flags = IOMAP_HOLE;
769 } else if (start_block == DELAYSTARTBLOCK) {
770 - pbmapp->pbm_bn = PAGE_BUF_DADDR_NULL;
771 - pbmapp->pbm_flags = PBMF_DELAY;
772 + iomapp->iomap_bn = IOMAP_DADDR_NULL;
773 + iomapp->iomap_flags = IOMAP_DELAY;
775 - pbmapp->pbm_bn = XFS_FSB_TO_DB_IO(io, start_block);
776 + iomapp->iomap_bn = XFS_FSB_TO_DB_IO(io, start_block);
777 if (ISUNWRITTEN(imap))
778 - pbmapp->pbm_flags |= PBMF_UNWRITTEN;
779 + iomapp->iomap_flags |= IOMAP_UNWRITTEN;
782 - if ((pbmapp->pbm_offset + pbmapp->pbm_bsize) >= nisize) {
783 - pbmapp->pbm_flags |= PBMF_EOF;
784 + if ((iomapp->iomap_offset + iomapp->iomap_bsize) >= nisize) {
785 + iomapp->iomap_flags |= IOMAP_EOF;
789 - pbmapp->pbm_flags |= PBMF_NEW;
791 - offset += pbmapp->pbm_bsize - pbmapp->pbm_delta;
792 + offset += iomapp->iomap_bsize - iomapp->iomap_delta;
794 return pbm; /* Return the number filled */
796 @@ -132,54 +130,54 @@
800 - page_buf_bmap_t *pbmapp,
802 + xfs_iomap_t *iomapp,
805 xfs_mount_t *mp = io->io_mount;
806 xfs_fileoff_t offset_fsb, end_fsb;
810 xfs_bmbt_irec_t imap;
812 - int bmap_flags = 0;
813 + int bmapi_flags = 0;
814 + int iomap_flags = 0;
816 if (XFS_FORCED_SHUTDOWN(mp))
817 - return -XFS_ERROR(EIO);
818 + return XFS_ERROR(EIO);
821 - (BMAP_READ | BMAP_WRITE | BMAP_ALLOCATE |
822 - BMAP_UNWRITTEN | BMAP_DEVICE)) {
824 + (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE |
825 + BMAPI_UNWRITTEN | BMAPI_DEVICE)) {
827 lockmode = XFS_LCK_MAP_SHARED(mp, io);
828 - bmap_flags = XFS_BMAPI_ENTIRE;
829 - if (flags & BMAP_IGNSTATE)
830 - bmap_flags |= XFS_BMAPI_IGSTATE;
831 + bmapi_flags = XFS_BMAPI_ENTIRE;
832 + if (flags & BMAPI_IGNSTATE)
833 + bmapi_flags |= XFS_BMAPI_IGSTATE;
837 lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR;
840 XFS_ILOCK(mp, io, lockmode);
842 - case BMAP_ALLOCATE:
843 + case BMAPI_ALLOCATE:
844 lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD;
845 - bmap_flags = XFS_BMAPI_ENTIRE;
846 + bmapi_flags = XFS_BMAPI_ENTIRE;
847 /* Attempt non-blocking lock */
848 - if (flags & BMAP_TRYLOCK) {
849 + if (flags & BMAPI_TRYLOCK) {
850 if (!XFS_ILOCK_NOWAIT(mp, io, lockmode))
851 return XFS_ERROR(EAGAIN);
853 XFS_ILOCK(mp, io, lockmode);
856 - case BMAP_UNWRITTEN:
857 + case BMAPI_UNWRITTEN:
861 lockmode = XFS_LCK_MAP_SHARED(mp, io);
862 - pbmapp->pbm_target = io->io_flags & XFS_IOCORE_RT ?
863 + iomapp->iomap_target = io->io_flags & XFS_IOCORE_RT ?
864 mp->m_rtdev_targp : mp->m_ddev_targp;
871 @@ -192,30 +190,30 @@
872 offset_fsb = XFS_B_TO_FSBT(mp, offset);
874 error = XFS_BMAPI(mp, NULL, io, offset_fsb,
875 - (xfs_filblks_t)(end_fsb - offset_fsb) ,
876 - bmap_flags, NULL, 0, &imap,
877 + (xfs_filblks_t)(end_fsb - offset_fsb),
878 + bmapi_flags, NULL, 0, &imap,
885 - switch (flags & (BMAP_WRITE|BMAP_ALLOCATE|BMAP_UNWRITTEN)) {
887 + switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) {
889 /* If we found an extent, return it */
890 if (nimaps && (imap.br_startblock != HOLESTARTBLOCK))
893 - if (flags & (BMAP_DIRECT|BMAP_MMAP)) {
894 + if (flags & (BMAPI_DIRECT|BMAPI_MMAP)) {
895 error = XFS_IOMAP_WRITE_DIRECT(mp, io, offset,
896 count, flags, &imap, &nimaps, nimaps);
898 error = XFS_IOMAP_WRITE_DELAY(mp, io, offset, count,
899 flags, &imap, &nimaps);
902 + iomap_flags = IOMAP_NEW;
904 - case BMAP_ALLOCATE:
905 + case BMAPI_ALLOCATE:
906 /* If we found an extent, return it */
907 XFS_IUNLOCK(mp, io, lockmode);
911 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps);
913 - case BMAP_UNWRITTEN:
914 + case BMAPI_UNWRITTEN:
916 error = XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count);
918 @@ -233,10 +231,10 @@
922 - *npbmaps = _xfs_imap_to_bmap(io, offset, new, &imap,
923 - pbmapp, nimaps, *npbmaps);
924 - } else if (npbmaps) {
926 + *niomaps = xfs_imap_to_bmap(io, offset, &imap,
927 + iomapp, nimaps, *niomaps, iomap_flags);
928 + } else if (niomaps) {
933 @@ -251,29 +249,25 @@
937 - vnode_t *vp = XFS_ITOV(ip);
941 if (ip->i_delayed_blks) {
942 xfs_iunlock(ip, XFS_ILOCK_EXCL);
943 - filemap_fdatawrite(LINVFS_GET_IP(vp)->i_mapping);
944 + xfs_flush_inode(ip);
945 xfs_ilock(ip, XFS_ILOCK_EXCL);
948 - *ioflags |= BMAP_SYNC;
949 + *ioflags |= BMAPI_SYNC;
955 - *ioflags |= BMAP_SYNC;
956 + *ioflags |= BMAPI_SYNC;
959 xfs_iunlock(ip, XFS_ILOCK_EXCL);
960 - sync_blockdev(vp->v_vfsp->vfs_super->s_bdev);
961 - xfs_log_force(ip->i_mount, (xfs_lsn_t)0,
962 - XFS_LOG_FORCE|XFS_LOG_SYNC);
963 + xfs_flush_device(ip);
964 xfs_ilock(ip, XFS_ILOCK_EXCL);
968 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
969 xfs_trans_ihold(tp, ip);
971 - if (!(flags & BMAP_MMAP) && (offset < ip->i_d.di_size || rt))
972 + if (!(flags & BMAPI_MMAP) && (offset < ip->i_d.di_size || rt))
973 bmapi_flag |= XFS_BMAPI_PREALLOC;
977 * We don't bother with this for sync writes, because we need
978 * to minimize the amount we write for good performance.
980 - if (!(ioflag & BMAP_SYNC) && ((offset + count) > ip->i_d.di_size)) {
981 + if (!(ioflag & BMAPI_SYNC) && ((offset + count) > ip->i_d.di_size)) {
982 xfs_off_t aligned_offset;
984 xfs_fileoff_t ioalign;
985 diff -urN linux.org/fs/xfs/linux/xfs_iops.c linux/fs/xfs/linux/xfs_iops.c
986 --- linux.org/fs/xfs/linux/xfs_iops.c 2003-12-31 05:46:55.000000000 +0100
987 +++ linux/fs/xfs/linux/xfs_iops.c 2004-01-02 04:21:43.000000000 +0100
990 vnode_t *vp = NULL, *dvp = LINVFS_GET_VP(dir);
991 xfs_acl_t *default_acl = NULL;
992 - xattr_exists_t test_default_acl = _ACL_DEFAULT_EXISTS;
993 + attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
998 block_truncate_page(inode->i_mapping, inode->i_size, linvfs_get_block);
1004 - * Extended attributes interfaces
1007 -#define SYSTEM_NAME "system." /* VFS shared names/values */
1008 -#define ROOT_NAME "trusted." /* root's own names/values */
1009 -#define USER_NAME "user." /* user's own names/values */
1010 -STATIC xattr_namespace_t xfs_namespace_array[] = {
1011 - { .name= SYSTEM_NAME, .namelen= sizeof(SYSTEM_NAME)-1,.exists= NULL },
1012 - { .name= ROOT_NAME, .namelen= sizeof(ROOT_NAME)-1, .exists= NULL },
1013 - { .name= USER_NAME, .namelen= sizeof(USER_NAME)-1, .exists= NULL },
1016 -xattr_namespace_t *xfs_namespaces = &xfs_namespace_array[0];
1018 -#define POSIXACL_ACCESS "posix_acl_access"
1019 -#define POSIXACL_ACCESS_SIZE (sizeof(POSIXACL_ACCESS)-1)
1020 -#define POSIXACL_DEFAULT "posix_acl_default"
1021 -#define POSIXACL_DEFAULT_SIZE (sizeof(POSIXACL_DEFAULT)-1)
1022 -#define POSIXCAP "posix_capabilities"
1023 -#define POSIXCAP_SIZE (sizeof(POSIXCAP)-1)
1024 -#define POSIXMAC "posix_mac"
1025 -#define POSIXMAC_SIZE (sizeof(POSIXMAC)-1)
1026 -STATIC xattr_namespace_t sys_namespace_array[] = {
1027 - { .name= POSIXACL_ACCESS,
1028 - .namelen= POSIXACL_ACCESS_SIZE, .exists= _ACL_ACCESS_EXISTS },
1029 - { .name= POSIXACL_DEFAULT,
1030 - .namelen= POSIXACL_DEFAULT_SIZE, .exists= _ACL_DEFAULT_EXISTS },
1031 - { .name= POSIXCAP,
1032 - .namelen= POSIXCAP_SIZE, .exists= _CAP_EXISTS },
1033 - { .name= POSIXMAC,
1034 - .namelen= POSIXMAC_SIZE, .exists= _MAC_EXISTS },
1039 - * Some checks to prevent people abusing EAs to get over quota:
1040 - * - Don't allow modifying user EAs on devices/symlinks;
1041 - * - Don't allow modifying user EAs if sticky bit set;
1044 -capable_user_xattr(
1045 - struct inode *inode)
1047 - if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) &&
1048 - !capable(CAP_SYS_ADMIN))
1050 - if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
1051 - (current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
1058 struct dentry *dentry,
1059 @@ -615,59 +560,27 @@
1063 - struct inode *inode = dentry->d_inode;
1064 - vnode_t *vp = LINVFS_GET_VP(inode);
1065 - char *p = (char *)name;
1066 + vnode_t *vp = LINVFS_GET_VP(dentry->d_inode);
1067 + char *attr = (char *)name;
1068 + attrnames_t *namesp;
1072 - if (strncmp(name, xfs_namespaces[SYSTEM_NAMES].name,
1073 - xfs_namespaces[SYSTEM_NAMES].namelen) == 0) {
1075 - if (flags & XATTR_CREATE)
1077 - error = -EOPNOTSUPP;
1078 - p += xfs_namespaces[SYSTEM_NAMES].namelen;
1079 - if (strcmp(p, POSIXACL_ACCESS) == 0)
1080 - error = xfs_acl_vset(vp, (void *) data, size,
1081 - _ACL_TYPE_ACCESS);
1082 - else if (strcmp(p, POSIXACL_DEFAULT) == 0)
1083 - error = xfs_acl_vset(vp, (void *) data, size,
1084 - _ACL_TYPE_DEFAULT);
1085 - else if (strcmp(p, POSIXCAP) == 0)
1086 - error = xfs_cap_vset(vp, (void *) data, size);
1088 - error = vn_revalidate(vp);
1089 + namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
1091 + return -EOPNOTSUPP;
1092 + attr += namesp->attr_namelen;
1093 + error = namesp->attr_capable(vp, NULL);
1098 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1101 /* Convert Linux syscall to XFS internal ATTR flags */
1102 if (flags & XATTR_CREATE)
1103 xflags |= ATTR_CREATE;
1104 if (flags & XATTR_REPLACE)
1105 xflags |= ATTR_REPLACE;
1107 - if (strncmp(name, xfs_namespaces[ROOT_NAMES].name,
1108 - xfs_namespaces[ROOT_NAMES].namelen) == 0) {
1109 - if (!capable(CAP_SYS_ADMIN))
1111 - xflags |= ATTR_ROOT;
1112 - p += xfs_namespaces[ROOT_NAMES].namelen;
1113 - VOP_ATTR_SET(vp, p, (void *) data, size, xflags, NULL, error);
1116 - if (strncmp(name, xfs_namespaces[USER_NAMES].name,
1117 - xfs_namespaces[USER_NAMES].namelen) == 0) {
1118 - if (!capable_user_xattr(inode))
1120 - p += xfs_namespaces[USER_NAMES].namelen;
1121 - VOP_ATTR_SET(vp, p, (void *) data, size, xflags, NULL, error);
1124 - return -EOPNOTSUPP;
1125 + xflags |= namesp->attr_flag;
1126 + return namesp->attr_set(vp, attr, (void *)data, size, xflags);
1130 @@ -677,53 +590,27 @@
1134 - struct inode *inode = dentry->d_inode;
1135 - vnode_t *vp = LINVFS_GET_VP(inode);
1136 - char *p = (char *)name;
1137 + vnode_t *vp = LINVFS_GET_VP(dentry->d_inode);
1138 + char *attr = (char *)name;
1139 + attrnames_t *namesp;
1143 - if (strncmp(name, xfs_namespaces[SYSTEM_NAMES].name,
1144 - xfs_namespaces[SYSTEM_NAMES].namelen) == 0) {
1145 - error = -EOPNOTSUPP;
1146 - p += xfs_namespaces[SYSTEM_NAMES].namelen;
1147 - if (strcmp(p, POSIXACL_ACCESS) == 0)
1148 - error = xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS);
1149 - else if (strcmp(p, POSIXACL_DEFAULT) == 0)
1150 - error = xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT);
1151 - else if (strcmp(p, POSIXCAP) == 0)
1152 - error = xfs_cap_vget(vp, data, size);
1153 + namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
1155 + return -EOPNOTSUPP;
1156 + attr += namesp->attr_namelen;
1157 + error = namesp->attr_capable(vp, NULL);
1162 /* Convert Linux syscall to XFS internal ATTR flags */
1164 xflags |= ATTR_KERNOVAL;
1168 - if (strncmp(name, xfs_namespaces[ROOT_NAMES].name,
1169 - xfs_namespaces[ROOT_NAMES].namelen) == 0) {
1170 - if (!capable(CAP_SYS_ADMIN))
1172 - xflags |= ATTR_ROOT;
1173 - p += xfs_namespaces[ROOT_NAMES].namelen;
1174 - VOP_ATTR_GET(vp, p, data, (int *)&size, xflags, NULL, error);
1179 - if (strncmp(name, xfs_namespaces[USER_NAMES].name,
1180 - xfs_namespaces[USER_NAMES].namelen) == 0) {
1181 - p += xfs_namespaces[USER_NAMES].namelen;
1182 - if (!capable_user_xattr(inode))
1184 - VOP_ATTR_GET(vp, p, data, (int *)&size, xflags, NULL, error);
1189 - return -EOPNOTSUPP;
1190 + xflags |= namesp->attr_flag;
1191 + return namesp->attr_get(vp, attr, (void *)data, size, xflags);
1195 @@ -732,40 +619,18 @@
1199 - attrlist_cursor_kern_t cursor;
1200 - xattr_namespace_t *sys;
1201 vnode_t *vp = LINVFS_GET_VP(dentry->d_inode);
1203 - int xflags = ATTR_KERNAMELS;
1206 + int error, xflags = ATTR_KERNAMELS;
1210 xflags |= ATTR_KERNOVAL;
1211 if (capable(CAP_SYS_ADMIN))
1212 xflags |= ATTR_KERNFULLS;
1214 - memset(&cursor, 0, sizeof(cursor));
1215 - VOP_ATTR_LIST(vp, data, size, xflags, &cursor, NULL, error);
1220 - k += result; /* advance start of our buffer */
1221 - for (sys = &sys_namespace_array[0]; sys->name != NULL; sys++) {
1222 - if (sys->exists == NULL || !sys->exists(vp))
1224 - result += xfs_namespaces[SYSTEM_NAMES].namelen;
1225 - result += sys->namelen + 1;
1227 - if (result > size)
1229 - strcpy(k, xfs_namespaces[SYSTEM_NAMES].name);
1230 - k += xfs_namespaces[SYSTEM_NAMES].namelen;
1231 - strcpy(k, sys->name);
1232 - k += sys->namelen + 1;
1235 + error = attr_generic_list(vp, data, size, xflags, &result);
1241 @@ -774,51 +639,25 @@
1242 struct dentry *dentry,
1245 - struct inode *inode = dentry->d_inode;
1246 - vnode_t *vp = LINVFS_GET_VP(inode);
1247 - char *p = (char *)name;
1248 + vnode_t *vp = LINVFS_GET_VP(dentry->d_inode);
1249 + char *attr = (char *)name;
1250 + attrnames_t *namesp;
1254 - if (strncmp(name, xfs_namespaces[SYSTEM_NAMES].name,
1255 - xfs_namespaces[SYSTEM_NAMES].namelen) == 0) {
1256 - error = -EOPNOTSUPP;
1257 - p += xfs_namespaces[SYSTEM_NAMES].namelen;
1258 - if (strcmp(p, POSIXACL_ACCESS) == 0)
1259 - error = xfs_acl_vremove(vp, _ACL_TYPE_ACCESS);
1260 - else if (strcmp(p, POSIXACL_DEFAULT) == 0)
1261 - error = xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT);
1262 - else if (strcmp(p, POSIXCAP) == 0)
1263 - error = xfs_cap_vremove(vp);
1264 + namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
1266 + return -EOPNOTSUPP;
1267 + attr += namesp->attr_namelen;
1268 + error = namesp->attr_capable(vp, NULL);
1273 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
1276 - if (strncmp(name, xfs_namespaces[ROOT_NAMES].name,
1277 - xfs_namespaces[ROOT_NAMES].namelen) == 0) {
1278 - if (!capable(CAP_SYS_ADMIN))
1280 - xflags |= ATTR_ROOT;
1281 - p += xfs_namespaces[ROOT_NAMES].namelen;
1282 - VOP_ATTR_REMOVE(vp, p, xflags, NULL, error);
1285 - if (strncmp(name, xfs_namespaces[USER_NAMES].name,
1286 - xfs_namespaces[USER_NAMES].namelen) == 0) {
1287 - p += xfs_namespaces[USER_NAMES].namelen;
1288 - if (!capable_user_xattr(inode))
1290 - VOP_ATTR_REMOVE(vp, p, xflags, NULL, error);
1293 - return -EOPNOTSUPP;
1294 + xflags |= namesp->attr_flag;
1295 + return namesp->attr_remove(vp, attr, xflags);
1299 -struct inode_operations linvfs_file_inode_operations =
1301 +struct inode_operations linvfs_file_inode_operations = {
1302 .permission = linvfs_permission,
1303 .truncate = linvfs_truncate,
1304 .getattr = linvfs_getattr,
1306 .removexattr = linvfs_removexattr,
1309 -struct inode_operations linvfs_dir_inode_operations =
1311 +struct inode_operations linvfs_dir_inode_operations = {
1312 .create = linvfs_create,
1313 .lookup = linvfs_lookup,
1314 .link = linvfs_link,
1316 .removexattr = linvfs_removexattr,
1319 -struct inode_operations linvfs_symlink_inode_operations =
1321 +struct inode_operations linvfs_symlink_inode_operations = {
1322 .readlink = linvfs_readlink,
1323 .follow_link = linvfs_follow_link,
1324 .permission = linvfs_permission,
1325 diff -urN linux.org/fs/xfs/linux/xfs_iops.h linux/fs/xfs/linux/xfs_iops.h
1326 --- linux.org/fs/xfs/linux/xfs_iops.h 2003-12-31 05:47:32.000000000 +0100
1327 +++ linux/fs/xfs/linux/xfs_iops.h 2004-01-02 04:21:43.000000000 +0100
1330 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
1331 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
1333 * This program is free software; you can redistribute it and/or modify it
1334 * under the terms of version 2 of the GNU General Public License as
1336 #ifndef __XFS_IOPS_H__
1337 #define __XFS_IOPS_H__
1340 - * Extended system attributes.
1341 - * So far only POSIX ACLs are supported, but this will need to
1342 - * grow in time (capabilities, mandatory access control, etc).
1344 -#define XFS_SYSTEM_NAMESPACE SYSTEM_POSIXACL
1347 - * Define a table of the namespaces XFS supports
1349 -typedef int (*xattr_exists_t)(vnode_t *);
1351 -typedef struct xattr_namespace {
1353 - unsigned int namelen;
1354 - xattr_exists_t exists;
1355 -} xattr_namespace_t;
1357 -#define SYSTEM_NAMES 0
1358 -#define ROOT_NAMES 1
1359 -#define USER_NAMES 2
1360 -extern struct xattr_namespace *xfs_namespaces;
1363 extern struct inode_operations linvfs_file_inode_operations;
1364 extern struct inode_operations linvfs_dir_inode_operations;
1365 extern struct inode_operations linvfs_symlink_inode_operations;
1367 extern int linvfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
1368 extern void linvfs_unwritten_done(struct buffer_head *, int);
1370 +extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
1371 + int, unsigned int, unsigned long);
1373 #endif /* __XFS_IOPS_H__ */
1374 diff -urN linux.org/fs/xfs/linux/xfs_linux.h linux/fs/xfs/linux/xfs_linux.h
1375 --- linux.org/fs/xfs/linux/xfs_linux.h 2003-12-31 05:46:20.000000000 +0100
1376 +++ linux/fs/xfs/linux/xfs_linux.h 2004-01-02 04:21:43.000000000 +0100
1378 #include <linux/seq_file.h>
1379 #include <linux/init.h>
1380 #include <linux/proc_fs.h>
1381 +#include <linux/version.h>
1383 #include <asm/page.h>
1384 #include <asm/div64.h>
1387 #include <pagebuf/page_buf.h>
1390 -#define STATIC static
1393 + * Feature macros (disable/enable)
1395 +#undef HAVE_REFCACHE /* reference cache not needed for NFS in 2.6 */
1396 +#define HAVE_SENDFILE /* sendfile(2) exists in 2.6, but not in 2.4 */
1399 * State flag for unwritten extent buffers.
1400 @@ -100,6 +103,11 @@
1401 #define xfs_inherit_nodump xfs_params.inherit_nodump.val
1402 #define xfs_inherit_noatime xfs_params.inherit_noatim.val
1404 +#define current_cpu() smp_processor_id()
1405 +#define current_pid() (current->pid)
1406 +#define current_fsuid(cred) (current->fsuid)
1407 +#define current_fsgid(cred) (current->fsgid)
1409 #define NBPP PAGE_SIZE
1410 #define DPPSHFT (PAGE_SHIFT - 9)
1411 #define NDPP (1 << (PAGE_SHIFT - 9))
1412 @@ -200,6 +208,11 @@
1413 #define howmany(x, y) (((x)+((y)-1))/(y))
1414 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
1416 +static inline void xfs_stack_trace(void)
1421 /* Move the kernel do_div definition off to one side */
1423 #if defined __i386__
1424 diff -urN linux.org/fs/xfs/linux/xfs_lrw.c linux/fs/xfs/linux/xfs_lrw.c
1425 --- linux.org/fs/xfs/linux/xfs_lrw.c 2003-12-31 05:46:18.000000000 +0100
1426 +++ linux/fs/xfs/linux/xfs_lrw.c 2004-01-02 04:21:43.000000000 +0100
1428 #include "xfs_inode_item.h"
1429 #include "xfs_buf_item.h"
1430 #include "xfs_utils.h"
1431 +#include "xfs_iomap.h"
1433 #include <linux/capability.h>
1436 +#if defined(XFS_RW_TRACE)
1438 +xfs_rw_enter_trace(
1441 + const struct iovec *iovp,
1446 + xfs_inode_t *ip = XFS_IO_INODE(io);
1448 + if (ip->i_rwtrace == NULL)
1450 + ktrace_enter(ip->i_rwtrace,
1451 + (void *)(unsigned long)tag,
1453 + (void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
1454 + (void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
1455 + (void *)(__psint_t)iovp,
1456 + (void *)((unsigned long)segs),
1457 + (void *)((unsigned long)((offset >> 32) & 0xffffffff)),
1458 + (void *)((unsigned long)(offset & 0xffffffff)),
1459 + (void *)((unsigned long)ioflags),
1460 + (void *)((unsigned long)((io->io_new_size >> 32) & 0xffffffff)),
1461 + (void *)((unsigned long)(io->io_new_size & 0xffffffff)),
1470 +xfs_inval_cached_trace(
1477 + xfs_inode_t *ip = XFS_IO_INODE(io);
1479 + if (ip->i_rwtrace == NULL)
1481 + ktrace_enter(ip->i_rwtrace,
1482 + (void *)(__psint_t)XFS_INVAL_CACHED,
1484 + (void *)((unsigned long)((offset >> 32) & 0xffffffff)),
1485 + (void *)((unsigned long)(offset & 0xffffffff)),
1486 + (void *)((unsigned long)((len >> 32) & 0xffffffff)),
1487 + (void *)((unsigned long)(len & 0xffffffff)),
1488 + (void *)((unsigned long)((first >> 32) & 0xffffffff)),
1489 + (void *)((unsigned long)(first & 0xffffffff)),
1490 + (void *)((unsigned long)((last >> 32) & 0xffffffff)),
1491 + (void *)((unsigned long)(last & 0xffffffff)),
1504 @@ -142,6 +208,59 @@
1509 + * xfs_inval_cached_pages
1511 + * This routine is responsible for keeping direct I/O and buffered I/O
1512 + * somewhat coherent. From here we make sure that we're at least
1513 + * temporarily holding the inode I/O lock exclusively and then call
1514 + * the page cache to flush and invalidate any cached pages. If there
1515 + * are no cached pages this routine will be very quick.
1518 +xfs_inval_cached_pages(
1527 + if (!VN_CACHED(vp)) {
1531 + mp = io->io_mount;
1534 + * We need to get the I/O lock exclusively in order
1535 + * to safely invalidate pages and mappings.
1538 + XFS_IUNLOCK(mp, io, XFS_IOLOCK_SHARED);
1539 + XFS_ILOCK(mp, io, XFS_IOLOCK_EXCL);
1542 + /* Writing beyond EOF creates a hole that must be zeroed */
1543 + if (write && (offset > XFS_SIZE(mp, io))) {
1544 + xfs_fsize_t isize;
1546 + XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
1547 + isize = XFS_SIZE(mp, io);
1548 + if (offset > isize) {
1549 + xfs_zero_eof(vp, io, offset, isize, offset);
1551 + XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
1554 + xfs_inval_cached_trace(io, offset, -1, ctooff(offtoct(offset)), -1);
1555 + VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);
1557 + XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL);
1561 ssize_t /* bytes read, or (-) error */
1565 * does not really happen here, but is scheduled
1568 - xfs_ilock(ip, XFS_IOLOCK_SHARED);
1569 + if (!(ioflags & IO_ISLOCKED))
1570 + xfs_ilock(ip, XFS_IOLOCK_SHARED);
1572 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
1573 !(ioflags & IO_INVIS)) {
1574 @@ -221,13 +341,15 @@
1575 error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), *offset, size,
1576 FILP_DELAY_FLAG(file), &locktype);
1578 - xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1579 + if (!(ioflags & IO_ISLOCKED))
1580 + xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1585 ret = __generic_file_aio_read(iocb, iovp, segs, offset);
1586 - xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1587 + if (!(ioflags & IO_ISLOCKED))
1588 + xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1591 XFS_STATS_ADD(xs_read_bytes, ret);
1593 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
1596 - xfs_ilock(ip, XFS_IOLOCK_SHARED);
1597 + if (!(ioflags & IO_ISLOCKED))
1598 + xfs_ilock(ip, XFS_IOLOCK_SHARED);
1600 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
1601 (!(ioflags & IO_INVIS))) {
1602 @@ -282,12 +405,14 @@
1603 error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), *offset, count,
1604 FILP_DELAY_FLAG(filp), &locktype);
1606 - xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1607 + if (!(ioflags & IO_ISLOCKED))
1608 + xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1612 ret = generic_file_sendfile(filp, offset, count, actor, target);
1613 - xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1614 + if (!(ioflags & IO_ISLOCKED))
1615 + xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1617 XFS_STATS_ADD(xs_read_bytes, ret);
1618 xfs_ichgtime(ip, XFS_ICHGTIME_ACC);
1620 locktype = VRWLOCK_WRITE;
1623 + if (ioflags & IO_ISLOCKED)
1626 xfs_ilock(xip, XFS_ILOCK_EXCL|iolock);
1628 isize = xip->i_d.di_size;
1631 FILP_DELAY_FLAG(file), &locktype);
1633 - xfs_iunlock(xip, iolock);
1634 + if (iolock) xfs_iunlock(xip, iolock);
1637 xfs_ilock(xip, XFS_ILOCK_EXCL);
1638 @@ -684,9 +812,13 @@
1641 if (ioflags & IO_ISDIRECT) {
1642 - xfs_inval_cached_pages(vp, &xip->i_iocore, *offset, 1, 1);
1643 + xfs_inval_cached_pages(vp, io, *offset, 1, 1);
1644 + xfs_rw_enter_trace(XFS_DIOWR_ENTER,
1645 + io, iovp, segs, *offset, ioflags);
1647 + xfs_rw_enter_trace(XFS_WRITE_ENTER,
1648 + io, iovp, segs, *offset, ioflags);
1651 ret = generic_file_aio_write_nolock(iocb, iovp, segs, offset);
1653 if ((ret == -ENOSPC) &&
1655 xfs_rwlock(bdp, locktype);
1656 *offset = xip->i_d.di_size;
1661 if (*offset > xip->i_d.di_size) {
1664 } /* (ioflags & O_SYNC) */
1666 - xfs_rwunlock(bdp, locktype);
1668 + xfs_rwunlock(bdp, locktype);
1677 - page_buf_bmap_t *pbmapp,
1679 + xfs_iomap_t *iomapp,
1682 xfs_inode_t *ip = XFS_BHVTOI(bdp);
1683 xfs_iocore_t *io = &ip->i_iocore;
1685 ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
1686 ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
1688 - return xfs_iomap(io, offset, count, flags, pbmapp, npbmaps);
1689 + return xfs_iomap(io, offset, count, flags, iomapp, niomaps);
1693 diff -urN linux.org/fs/xfs/linux/xfs_lrw.h linux/fs/xfs/linux/xfs_lrw.h
1694 --- linux.org/fs/xfs/linux/xfs_lrw.h 2003-12-31 05:46:25.000000000 +0100
1695 +++ linux/fs/xfs/linux/xfs_lrw.h 2004-01-02 04:21:43.000000000 +0100
1698 struct xfs_bmbt_irec;
1700 -struct page_buf_bmap_s;
1703 +#if defined(XFS_RW_TRACE)
1705 + * Defines for the trace mechanisms in xfs_lrw.c.
1707 +#define XFS_RW_KTRACE_SIZE 64
1708 +#define XFS_STRAT_KTRACE_SIZE 64
1709 +#define XFS_STRAT_GTRACE_SIZE 512
1711 +#define XFS_READ_ENTER 1
1712 +#define XFS_WRITE_ENTER 2
1713 #define XFS_IOMAP_READ_ENTER 3
1714 +#define XFS_IOMAP_WRITE_ENTER 4
1715 +#define XFS_IOMAP_READ_MAP 5
1716 +#define XFS_IOMAP_WRITE_MAP 6
1717 +#define XFS_IOMAP_WRITE_NOSPACE 7
1718 +#define XFS_ITRUNC_START 8
1719 +#define XFS_ITRUNC_FINISH1 9
1720 +#define XFS_ITRUNC_FINISH2 10
1721 +#define XFS_CTRUNC1 11
1722 +#define XFS_CTRUNC2 12
1723 +#define XFS_CTRUNC3 13
1724 +#define XFS_CTRUNC4 14
1725 +#define XFS_CTRUNC5 15
1726 +#define XFS_CTRUNC6 16
1727 +#define XFS_BUNMAPI 17
1728 +#define XFS_INVAL_CACHED 18
1729 +#define XFS_DIORD_ENTER 19
1730 +#define XFS_DIOWR_ENTER 20
1731 +extern void xfs_rw_enter_trace(int, struct xfs_iocore *,
1732 + const struct iovec *, size_t, loff_t, int);
1733 +extern void xfs_inval_cached_trace(struct xfs_iocore *,
1734 + xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t);
1736 +#define xfs_rw_enter_trace(tag, io, iovec, segs, offset, ioflags)
1737 +#define xfs_inval_cached_trace(io, offset, len, first, last)
1741 * Maximum count of bmaps used by read and write paths.
1743 #define XFS_MAX_RW_NBMAPS 4
1745 extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
1746 - struct page_buf_bmap_s *, int *);
1747 + struct xfs_iomap *, int *);
1748 extern int xfsbdstrat(struct xfs_mount *, struct page_buf_s *);
1749 extern int xfs_bdstrat_cb(struct page_buf_s *);
1751 extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
1752 xfs_fsize_t, xfs_fsize_t);
1753 +extern void xfs_inval_cached_pages(struct vnode *, struct xfs_iocore *,
1754 + xfs_off_t, int, int);
1755 extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
1756 const struct iovec *, unsigned int,
1757 loff_t *, int, struct cred *);
1759 loff_t *, int, size_t, read_actor_t,
1760 void *, struct cred *);
1762 -extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int,
1763 - struct page_buf_bmap_s *, int *);
1764 -extern int xfs_iomap_write_direct(struct xfs_inode *, loff_t, size_t,
1765 - int, struct xfs_bmbt_irec *, int *, int);
1766 -extern int xfs_iomap_write_delay(struct xfs_inode *, loff_t, size_t,
1767 - int, struct xfs_bmbt_irec *, int *);
1768 -extern int xfs_iomap_write_allocate(struct xfs_inode *,
1769 - struct xfs_bmbt_irec *, int *);
1770 -extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t);
1772 extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
1774 #define XFS_FSB_TO_DB_IO(io,fsb) \
1775 diff -urN linux.org/fs/xfs/linux/xfs_super.c linux/fs/xfs/linux/xfs_super.c
1776 --- linux.org/fs/xfs/linux/xfs_super.c 2003-12-31 05:48:23.000000000 +0100
1777 +++ linux/fs/xfs/linux/xfs_super.c 2004-01-02 04:21:43.000000000 +0100
1781 #if BITS_PER_LONG == 32
1782 -# if defined(HAVE_SECTOR_T)
1783 +# if defined(CONFIG_LBD)
1784 ASSERT(sizeof(sector_t) == 8);
1785 pagefactor = PAGE_CACHE_SIZE;
1786 bitshift = BITS_PER_LONG;
1787 @@ -241,6 +241,36 @@
1797 + struct vfs *vfsp = bhvtovfs(bdp);
1799 + if (flags & IGET_NOALLOC)
1800 + return ilookup(vfsp->vfs_super, ino);
1801 + return iget_locked(vfsp->vfs_super, ino);
1808 + struct inode *inode = LINVFS_GET_IP(XFS_ITOV(ip));
1810 + filemap_fdatawrite(inode->i_mapping);
1817 + sync_blockdev(XFS_ITOV(ip)->v_vfsp->vfs_super->s_bdev);
1818 + xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
1824 @@ -860,15 +890,16 @@
1828 - static char message[] __initdata =
1829 - KERN_INFO "SGI XFS " XFS_VERSION_STRING " with "
1830 - XFS_BUILD_OPTIONS " enabled\n";
1831 + static char message[] __initdata = KERN_INFO \
1832 + XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
1837 xfs_physmem = si.totalram;
1841 error = init_inodecache();
1843 goto undo_inodecache;
1844 @@ -907,12 +938,12 @@
1846 pagebuf_terminate();
1847 destroy_inodecache();
1851 module_init(init_xfs_fs);
1852 module_exit(exit_xfs_fs);
1854 MODULE_AUTHOR("Silicon Graphics, Inc.");
1855 -MODULE_DESCRIPTION(
1856 - "SGI XFS " XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled");
1857 +MODULE_DESCRIPTION(XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled");
1858 MODULE_LICENSE("GPL");
1859 diff -urN linux.org/fs/xfs/linux/xfs_super.h linux/fs/xfs/linux/xfs_super.h
1860 --- linux.org/fs/xfs/linux/xfs_super.h 2003-12-31 05:46:52.000000000 +0100
1861 +++ linux/fs/xfs/linux/xfs_super.h 2004-01-02 04:21:43.000000000 +0100
1863 # define XFS_BIGFS_STRING
1866 -#ifdef CONFIG_XFS_VNODE_TRACING
1867 -# define XFS_VNTRACE_STRING "VN-trace, "
1868 +#ifdef CONFIG_XFS_TRACE
1869 +# define XFS_TRACE_STRING "tracing, "
1871 -# define XFS_VNTRACE_STRING
1872 +# define XFS_TRACE_STRING
1877 #define XFS_BUILD_OPTIONS XFS_ACL_STRING \
1878 XFS_REALTIME_STRING \
1880 - XFS_VNTRACE_STRING \
1881 + XFS_TRACE_STRING \
1882 XFS_DBG_STRING /* DBG must be last */
1884 #define LINVFS_GET_VFS(s) \
1886 #define LINVFS_SET_VFS(s, vfsp) \
1887 ((s)->s_fs_info = vfsp)
1892 struct block_device;
1894 extern __uint64_t xfs_max_file_offset(unsigned int);
1896 +extern struct inode *xfs_get_inode(bhv_desc_t *, xfs_ino_t, int);
1897 extern void xfs_initialize_vnode(bhv_desc_t *, vnode_t *, bhv_desc_t *, int);
1899 +extern void xfs_flush_inode(struct xfs_inode *);
1900 +extern void xfs_flush_device(struct xfs_inode *);
1902 extern int xfs_blkdev_get(struct xfs_mount *, const char *,
1903 struct block_device **);
1904 extern void xfs_blkdev_put(struct block_device *);
1905 diff -urN linux.org/fs/xfs/linux/xfs_sysctl.c linux/fs/xfs/linux/xfs_sysctl.c
1906 --- linux.org/fs/xfs/linux/xfs_sysctl.c 2003-12-31 05:48:56.000000000 +0100
1907 +++ linux/fs/xfs/linux/xfs_sysctl.c 2004-01-02 04:21:44.000000000 +0100
1909 int c, ret, *valp = ctl->data;
1910 __uint32_t vn_active;
1912 - ret = proc_doulongvec_minmax(ctl, write, filp, buffer, lenp);
1913 + ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
1915 if (!ret && write && *valp) {
1916 printk("XFS Clearing xfsstats\n");
1917 diff -urN linux.org/fs/xfs/linux/xfs_version.h linux/fs/xfs/linux/xfs_version.h
1918 --- linux.org/fs/xfs/linux/xfs_version.h 2003-12-31 05:48:35.000000000 +0100
1919 +++ linux/fs/xfs/linux/xfs_version.h 2004-01-02 04:21:44.000000000 +0100
1921 #ifndef __XFS_VERSION_H__
1922 #define __XFS_VERSION_H__
1924 -#define XFS_VERSION_STRING "for Linux"
1925 +#define XFS_VERSION_STRING "SGI-XFS CVS-2004-01-01_06:00_UTC"
1927 #endif /* __XFS_VERSION_H__ */
1928 diff -urN linux.org/fs/xfs/linux/xfs_vfs.c linux/fs/xfs/linux/xfs_vfs.c
1929 --- linux.org/fs/xfs/linux/xfs_vfs.c 2003-12-31 05:46:21.000000000 +0100
1930 +++ linux/fs/xfs/linux/xfs_vfs.c 2004-01-02 04:21:44.000000000 +0100
1934 struct bhv_desc *bdp,
1935 - struct kstatfs *sp,
1939 struct bhv_desc *next = bdp;
1940 @@ -201,6 +201,19 @@
1941 return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
1946 + struct bhv_desc *bdp,
1950 + struct bhv_desc *next = bdp;
1952 + while (! (bhvtovfsops(next))->vfs_get_inode)
1953 + next = BHV_NEXTNULL(next);
1954 + return ((*bhvtovfsops(next)->vfs_get_inode)(next, ino, fl));
1959 struct bhv_desc *bdp,
1960 diff -urN linux.org/fs/xfs/linux/xfs_vfs.h linux/fs/xfs/linux/xfs_vfs.h
1961 --- linux.org/fs/xfs/linux/xfs_vfs.h 2003-12-31 05:46:23.000000000 +0100
1962 +++ linux/fs/xfs/linux/xfs_vfs.h 2004-01-02 04:21:44.000000000 +0100
1964 #define __XFS_VFS_H__
1966 #include <linux/vfs.h>
1967 +#include "xfs_fs.h"
1973 struct xfs_mount_args;
1975 +typedef struct kstatfs xfs_statfs_t;
1977 typedef struct vfs {
1978 u_int vfs_flag; /* flags */
1979 - fsid_t vfs_fsid; /* file system ID */
1980 - fsid_t *vfs_altfsid; /* An ID fixed for life of FS */
1981 + xfs_fsid_t vfs_fsid; /* file system ID */
1982 + xfs_fsid_t *vfs_altfsid; /* An ID fixed for life of FS */
1983 bhv_head_t vfs_bh; /* head of vfs behavior chain */
1984 struct super_block *vfs_super; /* Linux superblock structure */
1985 struct task_struct *vfs_sync_task;
1987 #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
1988 #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
1990 +#define IGET_NOALLOC 0x0001 /* vfs_get_inode may return NULL */
1992 typedef int (*vfs_mount_t)(bhv_desc_t *,
1993 struct xfs_mount_args *, struct cred *);
1994 typedef int (*vfs_parseargs_t)(bhv_desc_t *, char *,
1996 typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *,
1997 struct xfs_mount_args *);
1998 typedef int (*vfs_root_t)(bhv_desc_t *, struct vnode **);
1999 -typedef int (*vfs_statvfs_t)(bhv_desc_t *, struct kstatfs *, struct vnode *);
2000 +typedef int (*vfs_statvfs_t)(bhv_desc_t *, xfs_statfs_t *, struct vnode *);
2001 typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
2002 typedef int (*vfs_vget_t)(bhv_desc_t *, struct vnode **, struct fid *);
2003 typedef int (*vfs_dmapiops_t)(bhv_desc_t *, caddr_t);
2005 typedef void (*vfs_init_vnode_t)(bhv_desc_t *,
2006 struct vnode *, bhv_desc_t *, int);
2007 typedef void (*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int);
2008 +typedef struct inode * (*vfs_get_inode_t)(bhv_desc_t *, xfs_ino_t, int);
2010 typedef struct vfsops {
2011 bhv_position_t vf_position; /* behavior chain position */
2013 vfs_vget_t vfs_vget; /* get vnode from fid */
2014 vfs_dmapiops_t vfs_dmapiops; /* data migration */
2015 vfs_quotactl_t vfs_quotactl; /* disk quota */
2016 + vfs_get_inode_t vfs_get_inode; /* bhv specific iget */
2017 vfs_init_vnode_t vfs_init_vnode; /* initialize a new vnode */
2018 vfs_force_shutdown_t vfs_force_shutdown; /* crash and burn */
2021 #define VFS_VGET(v, vpp,fidp, rv) ((rv) = vfs_vget(VHEAD(v), vpp,fidp))
2022 #define VFS_DMAPIOPS(v, p, rv) ((rv) = vfs_dmapiops(VHEAD(v), p))
2023 #define VFS_QUOTACTL(v, c,id,p, rv) ((rv) = vfs_quotactl(VHEAD(v), c,id,p))
2024 +#define VFS_GET_INODE(v, ino, fl) ( vfs_get_inode(VHEAD(v), ino,fl) )
2025 #define VFS_INIT_VNODE(v, vp,b,ul) ( vfs_init_vnode(VHEAD(v), vp,b,ul) )
2026 #define VFS_FORCE_SHUTDOWN(v, fl,f,l) ( vfs_force_shutdown(VHEAD(v), fl,f,l) )
2029 #define PVFS_VGET(b, vpp,fidp, rv) ((rv) = vfs_vget(b, vpp,fidp))
2030 #define PVFS_DMAPIOPS(b, p, rv) ((rv) = vfs_dmapiops(b, p))
2031 #define PVFS_QUOTACTL(b, c,id,p, rv) ((rv) = vfs_quotactl(b, c,id,p))
2032 +#define PVFS_GET_INODE(b, ino,fl) ( vfs_get_inode(b, ino,fl) )
2033 #define PVFS_INIT_VNODE(b, vp,b2,ul) ( vfs_init_vnode(b, vp,b2,ul) )
2034 #define PVFS_FORCE_SHUTDOWN(b, fl,f,l) ( vfs_force_shutdown(b, fl,f,l) )
2036 @@ -168,11 +177,12 @@
2037 extern int vfs_unmount(bhv_desc_t *, int, struct cred *);
2038 extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *);
2039 extern int vfs_root(bhv_desc_t *, struct vnode **);
2040 -extern int vfs_statvfs(bhv_desc_t *, struct kstatfs *, struct vnode *);
2041 +extern int vfs_statvfs(bhv_desc_t *, xfs_statfs_t *, struct vnode *);
2042 extern int vfs_sync(bhv_desc_t *, int, struct cred *);
2043 extern int vfs_vget(bhv_desc_t *, struct vnode **, struct fid *);
2044 extern int vfs_dmapiops(bhv_desc_t *, caddr_t);
2045 extern int vfs_quotactl(bhv_desc_t *, int, int, caddr_t);
2046 +extern struct inode *vfs_get_inode(bhv_desc_t *, xfs_ino_t, int);
2047 extern void vfs_init_vnode(bhv_desc_t *, struct vnode *, bhv_desc_t *, int);
2048 extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int);
2050 diff -urN linux.org/fs/xfs/linux/xfs_vnode.c linux/fs/xfs/linux/xfs_vnode.c
2051 --- linux.org/fs/xfs/linux/xfs_vnode.c 2003-12-31 05:46:55.000000000 +0100
2052 +++ linux/fs/xfs/linux/xfs_vnode.c 2004-01-02 04:21:44.000000000 +0100
2057 -#ifdef CONFIG_XFS_VNODE_TRACING
2058 +#ifdef XFS_VNODE_TRACE
2059 ktrace_free(vp->v_trace);
2062 @@ -154,9 +154,10 @@
2063 /* Initialize the first behavior and the behavior chain head. */
2064 vn_bhv_head_init(VN_BHV_HEAD(vp), "vnode");
2066 -#ifdef CONFIG_XFS_VNODE_TRACING
2067 +#ifdef XFS_VNODE_TRACE
2068 vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
2069 -#endif /* CONFIG_XFS_VNODE_TRACING */
2070 + printk("Allocated VNODE_TRACE at 0x%p\n", vp->v_trace);
2071 +#endif /* XFS_VNODE_TRACE */
2073 vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address);
2076 if (inode->i_state & I_FREEING)
2079 - inode = ilookup(vmap->v_vfsp->vfs_super, vmap->v_ino);
2080 + inode = VFS_GET_INODE(vmap->v_vfsp, vmap->v_ino, IGET_NOALLOC);
2081 if (!inode) /* Inode not present */
2088 -#ifdef CONFIG_XFS_VNODE_TRACING
2089 +#ifdef XFS_VNODE_TRACE
2091 #define KTRACE_ENTER(vp, vk, s, line, ra) \
2092 ktrace_enter( (vp)->v_trace, \
2095 KTRACE_ENTER(vp, VNODE_KTRACE_RELE, file, line, ra);
2097 -#endif /* CONFIG_XFS_VNODE_TRACING */
2098 +#endif /* XFS_VNODE_TRACE */
2099 diff -urN linux.org/fs/xfs/linux/xfs_vnode.h linux/fs/xfs/linux/xfs_vnode.h
2100 --- linux.org/fs/xfs/linux/xfs_vnode.h 2003-12-31 05:48:46.000000000 +0100
2101 +++ linux/fs/xfs/linux/xfs_vnode.h 2004-01-02 04:21:44.000000000 +0100
2106 -struct page_buf_bmap_s;
2108 struct attrlist_cursor_kern;
2112 vn_bhv_head_t v_bh; /* behavior head */
2113 spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */
2114 struct inode v_inode; /* Linux inode */
2115 -#ifdef CONFIG_XFS_VNODE_TRACING
2116 +#ifdef XFS_VNODE_TRACE
2117 struct ktrace *v_trace; /* trace header structure */
2120 @@ -225,8 +225,10 @@
2121 typedef int (*vop_release_t)(bhv_desc_t *);
2122 typedef int (*vop_rwlock_t)(bhv_desc_t *, vrwlock_t);
2123 typedef void (*vop_rwunlock_t)(bhv_desc_t *, vrwlock_t);
2124 +typedef int (*vop_frlock_t)(bhv_desc_t *, int, struct file_lock *,int,
2125 + xfs_off_t, struct cred *);
2126 typedef int (*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int,
2127 - struct page_buf_bmap_s *, int *);
2128 + struct xfs_iomap *, int *);
2129 typedef int (*vop_reclaim_t)(bhv_desc_t *);
2130 typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int,
2133 vop_fid2_t vop_fid2;
2134 vop_rwlock_t vop_rwlock;
2135 vop_rwunlock_t vop_rwunlock;
2136 + vop_frlock_t vop_frlock;
2137 vop_bmap_t vop_bmap;
2138 vop_reclaim_t vop_reclaim;
2139 vop_attr_get_t vop_attr_get;
2142 #define IO_ISDIRECT 0x00004 /* bypass page cache */
2143 #define IO_INVIS 0x00020 /* don't update inode timestamps */
2144 +#define IO_ISLOCKED 0x00800 /* don't do inode locking */
2147 * Flags for VOP_IFLUSH call
2148 @@ -545,21 +549,17 @@
2149 extern vnode_t *vn_hold(struct vnode *);
2150 extern void vn_rele(struct vnode *);
2152 -#if defined(CONFIG_XFS_VNODE_TRACING)
2154 +#if defined(XFS_VNODE_TRACE)
2155 #define VN_HOLD(vp) \
2156 - ((void)vn_hold(vp), \
2157 + ((void)vn_hold(vp), \
2158 vn_trace_hold(vp, __FILE__, __LINE__, (inst_t *)__return_address))
2159 #define VN_RELE(vp) \
2160 (vn_trace_rele(vp, __FILE__, __LINE__, (inst_t *)__return_address), \
2161 iput(LINVFS_GET_IP(vp)))
2163 -#else /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */
2166 #define VN_HOLD(vp) ((void)vn_hold(vp))
2167 #define VN_RELE(vp) (iput(LINVFS_GET_IP(vp)))
2169 -#endif /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */
2173 * Vname handling macros.
2174 @@ -591,6 +591,13 @@
2178 + * Update modify/access/change times on the vnode
2180 +#define VN_MTIMESET(vp, tvp) (LINVFS_GET_IP(vp)->i_mtime = *(tvp))
2181 +#define VN_ATIMESET(vp, tvp) (LINVFS_GET_IP(vp)->i_atime = *(tvp))
2182 +#define VN_CTIMESET(vp, tvp) (LINVFS_GET_IP(vp)->i_ctime = *(tvp))
2185 * Some useful predicates.
2187 #define VN_MAPPED(vp) \
2188 @@ -617,13 +624,12 @@
2189 #define FSYNC_INVAL 0x2 /* flush and invalidate cached data */
2190 #define FSYNC_DATA 0x4 /* synchronous fsync of data only */
2192 -#if (defined(CONFIG_XFS_VNODE_TRACING))
2194 -#define VNODE_TRACE_SIZE 16 /* number of trace entries */
2197 - * Tracing entries.
2198 + * Tracking vnode activity.
2200 +#if defined(XFS_VNODE_TRACE)
2202 +#define VNODE_TRACE_SIZE 16 /* number of trace entries */
2203 #define VNODE_KTRACE_ENTRY 1
2204 #define VNODE_KTRACE_EXIT 2
2205 #define VNODE_KTRACE_HOLD 3
2206 @@ -635,18 +641,16 @@
2207 extern void vn_trace_hold(struct vnode *, char *, int, inst_t *);
2208 extern void vn_trace_ref(struct vnode *, char *, int, inst_t *);
2209 extern void vn_trace_rele(struct vnode *, char *, int, inst_t *);
2211 #define VN_TRACE(vp) \
2212 vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address)
2214 -#else /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */
2217 #define vn_trace_entry(a,b,c)
2218 #define vn_trace_exit(a,b,c)
2219 #define vn_trace_hold(a,b,c,d)
2220 #define vn_trace_ref(a,b,c,d)
2221 #define vn_trace_rele(a,b,c,d)
2222 #define VN_TRACE(vp)
2224 -#endif /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */
2227 #endif /* __XFS_VNODE_H__ */
2228 diff -urN linux.org/fs/xfs/Makefile linux/fs/xfs/Makefile
2229 --- linux.org/fs/xfs/Makefile 2003-12-31 05:47:58.000000000 +0100
2230 +++ linux/fs/xfs/Makefile 2004-01-02 04:21:42.000000000 +0100
2233 ifeq ($(CONFIG_XFS_DEBUG),y)
2234 EXTRA_CFLAGS += -g -DSTATIC="" -DDEBUG -DXFSDEBUG
2235 + EXTRA_CFLAGS += -DPAGEBUF_LOCK_TRACKING
2237 -ifeq ($(CONFIG_PAGEBUF_DEBUG),y)
2238 +ifeq ($(CONFIG_XFS_TRACE),y)
2239 + EXTRA_CFLAGS += -DXFS_ALLOC_TRACE
2240 + EXTRA_CFLAGS += -DXFS_ATTR_TRACE
2241 + EXTRA_CFLAGS += -DXFS_BLI_TRACE
2242 + EXTRA_CFLAGS += -DXFS_BMAP_TRACE
2243 + EXTRA_CFLAGS += -DXFS_BMBT_TRACE
2244 + EXTRA_CFLAGS += -DXFS_DIR_TRACE
2245 + EXTRA_CFLAGS += -DXFS_DIR2_TRACE
2246 + EXTRA_CFLAGS += -DXFS_DQUOT_TRACE
2247 + EXTRA_CFLAGS += -DXFS_ILOCK_TRACE
2248 + EXTRA_CFLAGS += -DXFS_LOG_TRACE
2249 + EXTRA_CFLAGS += -DXFS_RW_TRACE
2250 EXTRA_CFLAGS += -DPAGEBUF_TRACE
2251 + # EXTRA_CFLAGS += -DXFS_VNODE_TRACE
2254 obj-$(CONFIG_XFS_FS) += xfs.o
2272 +ifneq ($(CONFIG_XFS_DMAPI),y)
2273 +xfs-y += xfs_dmops.o
2276 xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \
2283 ifeq ($(CONFIG_XFS_QUOTA),y)
2284 xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o
2286 +xfs-y += xfs_qmops.o
2289 xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
2294 - xfs_dir2_trace.o \
2297 xfs_extfree_item.o \
2298 @@ -108,10 +140,10 @@
2302 +xfs-$(CONFIG_XFS_TRACE) += xfs_dir2_trace.o
2304 # Objects in pagebuf/
2305 -xfs-y += $(addprefix pagebuf/, \
2307 - page_buf_locking.o)
2308 +xfs-y += pagebuf/page_buf.o
2311 xfs-y += $(addprefix linux/, \
2312 @@ -131,15 +163,12 @@
2313 # Objects in support/
2314 xfs-y += $(addprefix support/, \
2322 -# Quota and DMAPI stubs
2323 -xfs-y += xfs_dmops.o \
2325 +xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
2327 # If both xfs and kdb modules are built in then xfsidbg is built in. If xfs is
2328 # a module and kdb modules are being compiled then xfsidbg must be a module, to
2329 diff -urN linux.org/fs/xfs/pagebuf/page_buf.c linux/fs/xfs/pagebuf/page_buf.c
2330 --- linux.org/fs/xfs/pagebuf/page_buf.c 2003-12-31 05:46:24.000000000 +0100
2331 +++ linux/fs/xfs/pagebuf/page_buf.c 2004-01-02 04:21:44.000000000 +0100
2333 #include <linux/proc_fs.h>
2334 #include <linux/workqueue.h>
2335 #include <linux/suspend.h>
2336 +#include <linux/percpu.h>
2338 +#include <support/ktrace.h>
2339 #include <support/debug.h>
2340 #include <support/kmem.h>
2342 -#include "page_buf_internal.h"
2343 +#include "page_buf.h"
2346 #define BN_ALIGN_MASK ((1 << (PAGE_CACHE_SHIFT - BBSHIFT)) - 1)
2354 -#ifdef PAGEBUF_TRACE
2355 -static spinlock_t pb_trace_lock = SPIN_LOCK_UNLOCKED;
2356 -struct pagebuf_trace_buf pb_trace;
2357 -EXPORT_SYMBOL(pb_trace);
2358 -EXPORT_SYMBOL(pb_trace_func);
2359 -#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1))
2369 - unsigned long flags;
2371 - if (!pb_params.debug.val) return;
2373 - if (ra == NULL) ra = (void *)__builtin_return_address(0);
2375 - spin_lock_irqsave(&pb_trace_lock, flags);
2376 - j = pb_trace.start;
2377 - pb_trace.start = CIRC_INC(j);
2378 - spin_unlock_irqrestore(&pb_trace_lock, flags);
2380 - pb_trace.buf[j].pb = (unsigned long) pb;
2381 - pb_trace.buf[j].event = event;
2382 - pb_trace.buf[j].flags = pb->pb_flags;
2383 - pb_trace.buf[j].hold = pb->pb_hold.counter;
2384 - pb_trace.buf[j].lock_value = pb->pb_sema.count.counter;
2385 - pb_trace.buf[j].task = (void *)current;
2386 - pb_trace.buf[j].misc = misc;
2387 - pb_trace.buf[j].ra = ra;
2388 - pb_trace.buf[j].offset = pb->pb_file_offset;
2389 - pb_trace.buf[j].size = pb->pb_buffer_length;
2391 -#endif /* PAGEBUF_TRACE */
2394 - * File wide globals
2395 + * File wide globals
2398 STATIC kmem_cache_t *pagebuf_cache;
2400 * /proc/sys/vm/pagebuf
2403 -pagebuf_param_t pb_params = {
2404 +typedef struct pb_sysctl_val {
2411 + pb_sysctl_val_t flush_interval; /* interval between runs of the
2412 + * delwri flush daemon. */
2413 + pb_sysctl_val_t age_buffer; /* time for buffer to age before
2415 + pb_sysctl_val_t stats_clear; /* clear the pagebuf stats */
2416 + pb_sysctl_val_t debug; /* debug tracing on or off */
2419 .flush_interval = { HZ/2, HZ, 30*HZ },
2420 .age_buffer = { 1*HZ, 15*HZ, 300*HZ },
2421 @@ -137,12 +109,79 @@
2422 .debug = { 0, 0, 1 },
2428 + PB_STATS_CLEAR = 3,
2433 * Pagebuf statistics variables
2438 + u_int32_t pb_create;
2439 + u_int32_t pb_get_locked;
2440 + u_int32_t pb_get_locked_waited;
2441 + u_int32_t pb_busy_locked;
2442 + u_int32_t pb_miss_locked;
2443 + u_int32_t pb_page_retries;
2444 + u_int32_t pb_page_found;
2445 + u_int32_t pb_get_read;
2447 DEFINE_PER_CPU(struct pbstats, pbstats);
2449 +/* We don't disable preempt, not too worried about poking the
2450 + * wrong cpu's stat for now */
2451 +#define PB_STATS_INC(count) (__get_cpu_var(pbstats).count++)
2454 + * Pagebuf debugging
2457 +#ifdef PAGEBUF_TRACE
2465 + if (!pb_params.debug.val)
2467 + ktrace_enter(pagebuf_trace_buf,
2469 + (void *)(unsigned long)pb->pb_flags,
2470 + (void *)(unsigned long)pb->pb_hold.counter,
2471 + (void *)(unsigned long)pb->pb_sema.count.counter,
2474 + (void *)(unsigned long)((pb->pb_file_offset>>32) & 0xffffffff),
2475 + (void *)(unsigned long)(pb->pb_file_offset & 0xffffffff),
2476 + (void *)(unsigned long)pb->pb_buffer_length,
2477 + NULL, NULL, NULL, NULL, NULL);
2479 +ktrace_t *pagebuf_trace_buf;
2480 +EXPORT_SYMBOL(pagebuf_trace_buf);
2481 +#define PAGEBUF_TRACE_SIZE 4096
2482 +#define PB_TRACE(pb, id, data) \
2483 + pagebuf_trace(pb, id, (void *)data, (void *)__builtin_return_address(0))
2485 +#define PB_TRACE(pb, id, data) do { } while (0)
2488 +#ifdef PAGEBUF_LOCK_TRACKING
2489 +# define PB_SET_OWNER(pb) ((pb)->pb_last_holder = current->pid)
2490 +# define PB_CLEAR_OWNER(pb) ((pb)->pb_last_holder = -1)
2491 +# define PB_GET_OWNER(pb) ((pb)->pb_last_holder)
2493 +# define PB_SET_OWNER(pb) do { } while (0)
2494 +# define PB_CLEAR_OWNER(pb) do { } while (0)
2495 +# define PB_GET_OWNER(pb) do { } while (0)
2499 * Pagebuf allocation / freeing.
2501 @@ -198,11 +237,11 @@
2503 struct a_list *next;
2506 STATIC a_list_t *as_free_head;
2507 STATIC int as_list_len;
2508 STATIC spinlock_t as_lock = SPIN_LOCK_UNLOCKED;
2512 * Try to batch vunmaps because they are costly.
2514 @@ -247,16 +286,6 @@
2520 - * Buffers associated with inodes for which buffer locking
2521 - * is not enabled are not protected by semaphores, and are
2522 - * assumed to be exclusively owned by the caller. There is
2523 - * spinlock in the buffer, for use by the caller when concurrent
2524 - * access is possible.
2528 * Internal pagebuf object manipulation
2532 init_waitqueue_head(&pb->pb_waiters);
2534 PB_STATS_INC(pb_create);
2535 - PB_TRACE(pb, PB_TRACE_REC(get), target);
2536 + PB_TRACE(pb, "initialize", target);
2541 page_cache_release(page);
2545 - if (pb->pb_pages != pb->pb_page_array)
2546 - kfree(pb->pb_pages);
2552 page_buf_flags_t pb_flags = pb->pb_flags;
2554 - PB_TRACE(pb, PB_TRACE_REC(free_obj), 0);
2555 + PB_TRACE(pb, "free_object", 0);
2556 pb->pb_flags |= PBF_FREED;
2559 @@ -384,20 +410,17 @@
2560 if (pb->pb_flags & _PBF_MEM_ALLOCATED) {
2562 /* release the pages in the address list */
2563 - if (pb->pb_pages[0] &&
2564 - PageSlab(pb->pb_pages[0])) {
2566 - * This came from the slab
2567 - * allocator free it as such
2569 + if ((pb->pb_pages[0]) &&
2570 + (pb->pb_flags & _PBF_MEM_SLAB)) {
2573 _pagebuf_freepages(pb);
2576 + if (pb->pb_pages != pb->pb_page_array)
2577 + kfree(pb->pb_pages);
2578 pb->pb_pages = NULL;
2580 - pb->pb_flags &= ~_PBF_MEM_ALLOCATED;
2581 + pb->pb_flags &= ~(_PBF_MEM_ALLOCATED|_PBF_MEM_SLAB);
2589 - PB_TRACE(pb, PB_TRACE_REC(look_pg), good_pages);
2590 + PB_TRACE(pb, "lookup_pages", (long)good_pages);
2596 if (!(flags & PBF_TRYLOCK)) {
2597 /* wait for buffer ownership */
2598 - PB_TRACE(pb, PB_TRACE_REC(get_lk), 0);
2599 + PB_TRACE(pb, "get_lock", 0);
2601 PB_STATS_INC(pb_get_locked_waited);
2605 _PBF_ALL_PAGES_MAPPED | \
2606 _PBF_ADDR_ALLOCATED | \
2607 - _PBF_MEM_ALLOCATED;
2608 - PB_TRACE(pb, PB_TRACE_REC(got_lk), 0);
2609 + _PBF_MEM_ALLOCATED | \
2611 + PB_TRACE(pb, "got_lock", 0);
2612 PB_STATS_INC(pb_get_locked);
2615 @@ -765,10 +789,11 @@
2617 if (flags & PBF_READ) {
2618 if (PBF_NOT_DONE(pb)) {
2619 - PB_TRACE(pb, PB_TRACE_REC(get_read), flags);
2620 + PB_TRACE(pb, "get_read", (unsigned long)flags);
2621 PB_STATS_INC(pb_get_read);
2622 pagebuf_iostart(pb, flags);
2623 } else if (flags & PBF_ASYNC) {
2624 + PB_TRACE(pb, "get_read_async", (unsigned long)flags);
2626 * Read ahead call which is already satisfied,
2628 @@ -778,12 +803,13 @@
2632 + PB_TRACE(pb, "get_read_done", (unsigned long)flags);
2633 /* We do not want read in the flags */
2634 pb->pb_flags &= ~PBF_READ;
2637 + PB_TRACE(pb, "get_write", (unsigned long)flags);
2640 - PB_TRACE(pb, PB_TRACE_REC(get_obj), flags);
2648 - if (len > 0x20000)
2650 + if (unlikely(len > 0x20000))
2653 pb = pagebuf_allocate(flags);
2655 @@ -944,11 +970,11 @@
2658 /* otherwise pagebuf_free just ignores it */
2659 - pb->pb_flags |= _PBF_MEM_ALLOCATED;
2660 + pb->pb_flags |= (_PBF_MEM_ALLOCATED | _PBF_MEM_SLAB);
2662 up(&pb->pb_sema); /* Return unlocked pagebuf */
2664 - PB_TRACE(pb, PB_TRACE_REC(no_daddr), rmem);
2665 + PB_TRACE(pb, "no_daddr", rmem);
2672 atomic_inc(&pb->pb_hold);
2673 - PB_TRACE(pb, PB_TRACE_REC(hold), 0);
2674 + PB_TRACE(pb, "hold", 0);
2678 @@ -1002,7 +1028,7 @@
2682 - PB_TRACE(pb, PB_TRACE_REC(rele), pb->pb_relse);
2683 + PB_TRACE(pb, "rele", pb->pb_relse);
2684 if (pb->pb_flags & _PBF_LOCKABLE) {
2686 spin_lock(&h->pb_hash_lock);
2687 @@ -1043,6 +1069,95 @@
2691 + * Mutual exclusion on buffers. Locking model:
2693 + * Buffers associated with inodes for which buffer locking
2694 + * is not enabled are not protected by semaphores, and are
2695 + * assumed to be exclusively owned by the caller. There is a
2696 + * spinlock in the buffer, used by the caller when concurrent
2697 + * access is possible.
2701 + * pagebuf_cond_lock
2703 + * pagebuf_cond_lock locks a buffer object, if it is not already locked.
2704 + * Note that this in no way
2705 + * locks the underlying pages, so it is only useful for synchronizing
2706 + * concurrent use of page buffer objects, not for synchronizing independent
2707 + * access to the underlying pages.
2710 +pagebuf_cond_lock( /* lock buffer, if not locked */
2711 + /* returns -EBUSY if locked) */
2716 + ASSERT(pb->pb_flags & _PBF_LOCKABLE);
2717 + locked = down_trylock(&pb->pb_sema) == 0;
2721 + PB_TRACE(pb, "cond_lock", (long)locked);
2722 + return(locked ? 0 : -EBUSY);
2726 + * pagebuf_lock_value
2728 + * Return lock value for a pagebuf
2731 +pagebuf_lock_value(
2734 + ASSERT(pb->pb_flags & _PBF_LOCKABLE);
2735 + return(atomic_read(&pb->pb_sema.count));
2741 + * pagebuf_lock locks a buffer object. Note that this in no way
2742 + * locks the underlying pages, so it is only useful for synchronizing
2743 + * concurrent use of page buffer objects, not for synchronizing independent
2744 + * access to the underlying pages.
2750 + ASSERT(pb->pb_flags & _PBF_LOCKABLE);
2752 + PB_TRACE(pb, "lock", 0);
2753 + if (atomic_read(&pb->pb_io_remaining))
2755 + down(&pb->pb_sema);
2757 + PB_TRACE(pb, "locked", 0);
2764 + * pagebuf_unlock releases the lock on the buffer object created by
2765 + * pagebuf_lock or pagebuf_cond_lock (not any
2766 + * pinning of underlying pages created by pagebuf_pin).
2769 +pagebuf_unlock( /* unlock buffer */
2770 + page_buf_t *pb) /* buffer to unlock */
2772 + ASSERT(pb->pb_flags & _PBF_LOCKABLE);
2773 + PB_CLEAR_OWNER(pb);
2775 + PB_TRACE(pb, "unlock", 0);
2780 * Pinning Buffer Storage in Memory
2783 @@ -1065,7 +1180,7 @@
2786 atomic_inc(&pb->pb_pin_count);
2787 - PB_TRACE(pb, PB_TRACE_REC(pin), pb->pb_pin_count.counter);
2788 + PB_TRACE(pb, "pin", (long)pb->pb_pin_count.counter);
2792 @@ -1082,7 +1197,7 @@
2793 if (atomic_dec_and_test(&pb->pb_pin_count)) {
2794 wake_up_all(&pb->pb_waiters);
2796 - PB_TRACE(pb, PB_TRACE_REC(unpin), pb->pb_pin_count.counter);
2797 + PB_TRACE(pb, "unpin", (long)pb->pb_pin_count.counter);
2801 @@ -1161,7 +1276,7 @@
2802 pb->pb_flags &= ~(PBF_PARTIAL | PBF_NONE);
2805 - PB_TRACE(pb, PB_TRACE_REC(done), pb->pb_iodone);
2806 + PB_TRACE(pb, "iodone", pb->pb_iodone);
2808 if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) {
2810 @@ -1187,7 +1302,7 @@
2811 unsigned int error) /* error to store (0 if none) */
2813 pb->pb_error = error;
2814 - PB_TRACE(pb, PB_TRACE_REC(ioerror), error);
2815 + PB_TRACE(pb, "ioerror", (unsigned long)error);
2819 @@ -1211,7 +1326,7 @@
2823 - PB_TRACE(pb, PB_TRACE_REC(iostart), flags);
2824 + PB_TRACE(pb, "iostart", (unsigned long)flags);
2826 if (flags & PBF_DELWRI) {
2827 pb->pb_flags &= ~(PBF_READ | PBF_WRITE | PBF_ASYNC);
2828 @@ -1444,7 +1554,7 @@
2829 pagebuf_iorequest( /* start real I/O */
2830 page_buf_t *pb) /* buffer to convey to device */
2832 - PB_TRACE(pb, PB_TRACE_REC(ioreq), 0);
2833 + PB_TRACE(pb, "iorequest", 0);
2835 if (pb->pb_flags & PBF_DELWRI) {
2836 pagebuf_delwri_queue(pb, 1);
2837 @@ -1480,11 +1590,11 @@
2841 - PB_TRACE(pb, PB_TRACE_REC(iowait), 0);
2842 + PB_TRACE(pb, "iowait", 0);
2843 if (atomic_read(&pb->pb_io_remaining))
2845 down(&pb->pb_iodonesema);
2846 - PB_TRACE(pb, PB_TRACE_REC(iowaited), (int)pb->pb_error);
2847 + PB_TRACE(pb, "iowaited", (long)pb->pb_error);
2848 return pb->pb_error;
2851 @@ -1575,7 +1685,7 @@
2855 - PB_TRACE(pb, PB_TRACE_REC(delwri_q), unlock);
2856 + PB_TRACE(pb, "delwri_q", (long)unlock);
2857 spin_lock(&pbd_delwrite_lock);
2858 /* If already in the queue, dequeue and place at tail */
2859 if (!list_empty(&pb->pb_list)) {
2860 @@ -1598,7 +1708,7 @@
2861 pagebuf_delwri_dequeue(
2864 - PB_TRACE(pb, PB_TRACE_REC(delwri_uq), 0);
2865 + PB_TRACE(pb, "delwri_uq", 0);
2866 spin_lock(&pbd_delwrite_lock);
2867 list_del_init(&pb->pb_list);
2868 pb->pb_flags &= ~PBF_DELWRI;
2869 @@ -1665,7 +1775,7 @@
2870 list_for_each_safe(curr, next, &pbd_delwrite_queue) {
2871 pb = list_entry(curr, page_buf_t, pb_list);
2873 - PB_TRACE(pb, PB_TRACE_REC(walkq1), pagebuf_ispin(pb));
2874 + PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb));
2876 if ((pb->pb_flags & PBF_DELWRI) && !pagebuf_ispin(pb) &&
2877 (((pb->pb_flags & _PBF_LOCKABLE) == 0) ||
2878 @@ -1738,7 +1848,7 @@
2882 - PB_TRACE(pb, PB_TRACE_REC(walkq2), pagebuf_ispin(pb));
2883 + PB_TRACE(pb, "walkq2", (long)pagebuf_ispin(pb));
2884 if (pagebuf_ispin(pb)) {
2887 @@ -1839,7 +1949,7 @@
2889 int *valp = ctl->data;
2891 - ret = proc_doulongvec_minmax(ctl, write, filp, buffer, lenp);
2892 + ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
2894 if (!ret && write && *valp) {
2895 printk("XFS Clearing pbstats\n");
2896 @@ -1960,11 +2070,7 @@
2899 #ifdef PAGEBUF_TRACE
2900 - pb_trace.buf = (pagebuf_trace_t *)kmalloc(
2901 - PB_TRACE_BUFSIZE * sizeof(pagebuf_trace_t), GFP_KERNEL);
2902 - memset(pb_trace.buf, 0, PB_TRACE_BUFSIZE * sizeof(pagebuf_trace_t));
2903 - pb_trace.start = 0;
2904 - pb_trace.end = PB_TRACE_BUFSIZE - 1;
2905 + pagebuf_trace_buf = ktrace_alloc(PAGEBUF_TRACE_SIZE, KM_SLEEP);
2908 pagebuf_daemon_start();
2909 @@ -1996,3 +2102,6 @@
2910 * Module management (for kernel debugger module)
2912 EXPORT_SYMBOL(pagebuf_offset);
2914 +EXPORT_SYMBOL(pbd_delwrite_queue);
2916 diff -urN linux.org/fs/xfs/pagebuf/page_buf.h linux/fs/xfs/pagebuf/page_buf.h
2917 --- linux.org/fs/xfs/pagebuf/page_buf.h 2003-12-31 05:47:38.000000000 +0100
2918 +++ linux/fs/xfs/pagebuf/page_buf.h 2004-01-02 04:21:44.000000000 +0100
2921 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
2922 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
2924 * This program is free software; you can redistribute it and/or modify it
2925 * under the terms of version 2 of the GNU General Public License as
2927 #include <linux/uio.h>
2930 - * Turn this on to get pagebuf lock ownership
2931 -#define PAGEBUF_LOCK_TRACKING
2940 #define PAGE_BUF_DADDR_NULL ((page_buf_daddr_t) (-1LL))
2942 -typedef size_t page_buf_dsize_t; /* size of buffer in blocks */
2944 #define page_buf_ctob(pp) ((pp) * PAGE_CACHE_SIZE)
2945 #define page_buf_btoc(dd) (((dd) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)
2946 #define page_buf_btoct(dd) ((dd) >> PAGE_CACHE_SHIFT)
2948 PBRW_ZERO = 3 /* Zero target memory */
2951 -typedef enum { /* pbm_flags values */
2952 - PBMF_EOF = 0x01, /* mapping contains EOF */
2953 - PBMF_HOLE = 0x02, /* mapping covers a hole */
2954 - PBMF_DELAY = 0x04, /* mapping covers delalloc region */
2955 - PBMF_UNWRITTEN = 0x20, /* mapping covers allocated */
2956 - /* but uninitialized file data */
2957 - PBMF_NEW = 0x40 /* just allocated */
2961 - /* base extent manipulation calls */
2962 - BMAP_READ = (1 << 0), /* read extents */
2963 - BMAP_WRITE = (1 << 1), /* create extents */
2964 - BMAP_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
2965 - BMAP_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
2967 - BMAP_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
2968 - BMAP_DIRECT = (1 << 5), /* direct instead of buffered write */
2969 - BMAP_MMAP = (1 << 6), /* allocate for mmap write */
2970 - BMAP_SYNC = (1 << 7), /* sync write */
2971 - BMAP_TRYLOCK = (1 << 8), /* non-blocking request */
2972 - BMAP_DEVICE = (1 << 9), /* we only want to know the device */
2975 typedef enum page_buf_flags_e { /* pb_flags values */
2976 PBF_READ = (1 << 0), /* buffer intended for reading from device */
2977 @@ -123,12 +93,13 @@
2978 _PBF_PRIVATE_BH = (1 << 17), /* do not use public buffer heads */
2979 _PBF_ALL_PAGES_MAPPED = (1 << 18), /* all pages in range mapped */
2980 _PBF_ADDR_ALLOCATED = (1 << 19), /* pb_addr space was allocated */
2981 - _PBF_MEM_ALLOCATED = (1 << 20), /* pb_mem+underlying pages alloc'd */
2982 + _PBF_MEM_ALLOCATED = (1 << 20), /* underlying pages are allocated */
2983 + _PBF_MEM_SLAB = (1 << 21), /* underlying pages are slab allocated */
2985 - PBF_FORCEIO = (1 << 21),
2986 - PBF_FLUSH = (1 << 22), /* flush disk write cache */
2987 - PBF_READ_AHEAD = (1 << 23),
2988 - PBF_RUN_QUEUES = (1 << 24), /* run block device task queue */
2989 + PBF_FORCEIO = (1 << 22), /* ignore any cache state */
2990 + PBF_FLUSH = (1 << 23), /* flush disk write cache */
2991 + PBF_READ_AHEAD = (1 << 24), /* asynchronous read-ahead */
2992 + PBF_RUN_QUEUES = (1 << 25), /* run block device task queue */
2996 @@ -146,36 +117,6 @@
3000 - * page_buf_bmap_t: File system I/O map
3002 - * The pbm_bn, pbm_offset and pbm_length fields are expressed in disk blocks.
3003 - * The pbm_length field specifies the size of the underlying backing store
3004 - * for the particular mapping.
3006 - * The pbm_bsize, pbm_size and pbm_delta fields are in bytes and indicate
3007 - * the size of the mapping, the number of bytes that are valid to access
3008 - * (read or write), and the offset into the mapping, given the offset
3009 - * supplied to the file I/O map routine. pbm_delta is the offset of the
3010 - * desired data from the beginning of the mapping.
3012 - * When a request is made to read beyond the logical end of the object,
3013 - * pbm_size may be set to 0, but pbm_offset and pbm_length should be set to
3014 - * the actual amount of underlying storage that has been allocated, if any.
3017 -typedef struct page_buf_bmap_s {
3018 - page_buf_daddr_t pbm_bn; /* block number in file system */
3019 - pb_target_t *pbm_target; /* device to do I/O to */
3020 - loff_t pbm_offset; /* byte offset of mapping in file */
3021 - size_t pbm_delta; /* offset of request into bmap */
3022 - size_t pbm_bsize; /* size of this mapping in bytes */
3023 - bmap_flags_t pbm_flags; /* options flags for mapping */
3026 -typedef page_buf_bmap_t pb_bmap_t;
3030 * page_buf_t: Buffer structure for page cache-based buffers
3032 * This buffer structure is used by the page cache buffer management routines
3033 @@ -381,4 +322,19 @@
3034 extern int pagebuf_init(void);
3035 extern void pagebuf_terminate(void);
3038 +#ifdef PAGEBUF_TRACE
3039 +extern ktrace_t *pagebuf_trace_buf;
3040 +extern void pagebuf_trace(
3041 + page_buf_t *, /* buffer being traced */
3042 + char *, /* description of operation */
3043 + void *, /* arbitrary diagnostic value */
3044 + void *); /* return address */
3046 +# define pagebuf_trace(pb, id, ptr, ra) do { } while (0)
3049 +#define pagebuf_target_name(target) \
3050 + ({ char __b[BDEVNAME_SIZE]; bdevname((target)->pbr_bdev, __b); __b; })
3052 #endif /* __PAGE_BUF_H__ */
3053 diff -urN linux.org/fs/xfs/pagebuf/page_buf_internal.h linux/fs/xfs/pagebuf/page_buf_internal.h
3054 --- linux.org/fs/xfs/pagebuf/page_buf_internal.h 2003-12-31 05:47:14.000000000 +0100
3055 +++ linux/fs/xfs/pagebuf/page_buf_internal.h 1970-01-01 01:00:00.000000000 +0100
3058 - * Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved.
3060 - * This program is free software; you can redistribute it and/or modify it
3061 - * under the terms of version 2 of the GNU General Public License as
3062 - * published by the Free Software Foundation.
3064 - * This program is distributed in the hope that it would be useful, but
3065 - * WITHOUT ANY WARRANTY; without even the implied warranty of
3066 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3068 - * Further, this software is distributed without any warranty that it is
3069 - * free of the rightful claim of any third person regarding infringement
3070 - * or the like. Any license provided herein, whether implied or
3071 - * otherwise, applies only to this software file. Patent licenses, if
3072 - * any, provided herein do not apply to combinations of this program with
3073 - * other software, or any other product whatsoever.
3075 - * You should have received a copy of the GNU General Public License along
3076 - * with this program; if not, write the Free Software Foundation, Inc., 59
3077 - * Temple Place - Suite 330, Boston MA 02111-1307, USA.
3079 - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
3080 - * Mountain View, CA 94043, or:
3082 - * http://www.sgi.com
3084 - * For further information regarding this notice, see:
3086 - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
3090 - * Written by Steve Lord at SGI
3093 -#ifndef __PAGE_BUF_PRIVATE_H__
3094 -#define __PAGE_BUF_PRIVATE_H__
3096 -#include <linux/percpu.h>
3097 -#include "page_buf.h"
3099 -#define _PAGE_BUF_INTERNAL_
3100 -#define PB_DEFINE_TRACES
3101 -#include "page_buf_trace.h"
3103 -#ifdef PAGEBUF_LOCK_TRACKING
3104 -#define PB_SET_OWNER(pb) (pb->pb_last_holder = current->pid)
3105 -#define PB_CLEAR_OWNER(pb) (pb->pb_last_holder = -1)
3106 -#define PB_GET_OWNER(pb) (pb->pb_last_holder)
3108 -#define PB_SET_OWNER(pb)
3109 -#define PB_CLEAR_OWNER(pb)
3110 -#define PB_GET_OWNER(pb)
3111 -#endif /* PAGEBUF_LOCK_TRACKING */
3113 -/* Tracing utilities for pagebuf */
3117 - page_buf_flags_t flags;
3118 - unsigned short hold;
3119 - unsigned short lock_value;
3127 -struct pagebuf_trace_buf {
3128 - pagebuf_trace_t *buf;
3129 - volatile int start;
3133 -#define PB_TRACE_BUFSIZE 1024
3134 -#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1))
3137 - * Tunable pagebuf parameters
3140 -typedef struct pb_sysctl_val {
3146 -typedef struct pagebuf_param {
3147 - pb_sysctl_val_t flush_interval; /* interval between runs of the
3148 - * delwri flush daemon. */
3149 - pb_sysctl_val_t age_buffer; /* time for buffer to age before
3151 - pb_sysctl_val_t stats_clear; /* clear the pagebuf stats */
3152 - pb_sysctl_val_t debug; /* debug tracing on or off */
3158 - PB_STATS_CLEAR = 3,
3162 -extern pagebuf_param_t pb_params;
3165 - * Pagebuf statistics
3170 - u_int32_t pb_create;
3171 - u_int32_t pb_get_locked;
3172 - u_int32_t pb_get_locked_waited;
3173 - u_int32_t pb_busy_locked;
3174 - u_int32_t pb_miss_locked;
3175 - u_int32_t pb_page_retries;
3176 - u_int32_t pb_page_found;
3177 - u_int32_t pb_get_read;
3180 -DECLARE_PER_CPU(struct pbstats, pbstats);
3182 -/* We don't disable preempt, not too worried about poking the
3183 - * wrong cpu's stat for now */
3184 -#define PB_STATS_INC(count) (__get_cpu_var(pbstats).count++)
3187 -# define STATIC static
3190 -#endif /* __PAGE_BUF_PRIVATE_H__ */
3191 diff -urN linux.org/fs/xfs/pagebuf/page_buf_locking.c linux/fs/xfs/pagebuf/page_buf_locking.c
3192 --- linux.org/fs/xfs/pagebuf/page_buf_locking.c 2003-12-31 05:47:32.000000000 +0100
3193 +++ linux/fs/xfs/pagebuf/page_buf_locking.c 1970-01-01 01:00:00.000000000 +0100
3196 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3198 - * This program is free software; you can redistribute it and/or modify it
3199 - * under the terms of version 2 of the GNU General Public License as
3200 - * published by the Free Software Foundation.
3202 - * This program is distributed in the hope that it would be useful, but
3203 - * WITHOUT ANY WARRANTY; without even the implied warranty of
3204 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3206 - * Further, this software is distributed without any warranty that it is
3207 - * free of the rightful claim of any third person regarding infringement
3208 - * or the like. Any license provided herein, whether implied or
3209 - * otherwise, applies only to this software file. Patent licenses, if
3210 - * any, provided herein do not apply to combinations of this program with
3211 - * other software, or any other product whatsoever.
3213 - * You should have received a copy of the GNU General Public License along
3214 - * with this program; if not, write the Free Software Foundation, Inc., 59
3215 - * Temple Place - Suite 330, Boston MA 02111-1307, USA.
3217 - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
3218 - * Mountain View, CA 94043, or:
3220 - * http://www.sgi.com
3222 - * For further information regarding this notice, see:
3224 - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
3228 - * page_buf_locking.c
3230 - * The page_buf module provides an abstract buffer cache model on top of
3231 - * the Linux page cache. Cached metadata blocks for a file system are
3232 - * hashed to the inode for the block device. The page_buf module
3233 - * assembles buffer (page_buf_t) objects on demand to aggregate such
3234 - * cached pages for I/O. The page_buf_locking module adds support for
3235 - * locking such page buffers.
3237 - * Written by Steve Lord at SGI
3241 -#include <linux/stddef.h>
3242 -#include <linux/errno.h>
3243 -#include <linux/slab.h>
3244 -#include <linux/bitops.h>
3245 -#include <linux/string.h>
3246 -#include <linux/pagemap.h>
3247 -#include <linux/init.h>
3248 -#include <linux/major.h>
3250 -#include <support/debug.h>
3252 -#include "page_buf_internal.h"
3255 - * pagebuf_cond_lock
3257 - * pagebuf_cond_lock locks a buffer object, if it is not already locked.
3258 - * Note that this in no way
3259 - * locks the underlying pages, so it is only useful for synchronizing
3260 - * concurrent use of page buffer objects, not for synchronizing independent
3261 - * access to the underlying pages.
3264 -pagebuf_cond_lock( /* lock buffer, if not locked */
3265 - /* returns -EBUSY if locked) */
3270 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3272 - locked = down_trylock(&pb->pb_sema) == 0;
3277 - PB_TRACE(pb, PB_TRACE_REC(condlck), locked);
3279 - return(locked ? 0 : -EBUSY);
3283 - * pagebuf_lock_value
3285 - * Return lock value for a pagebuf
3288 -pagebuf_lock_value(
3291 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3292 - return(atomic_read(&pb->pb_sema.count));
3298 - * pagebuf_lock locks a buffer object. Note that this in no way
3299 - * locks the underlying pages, so it is only useful for synchronizing
3300 - * concurrent use of page buffer objects, not for synchronizing independent
3301 - * access to the underlying pages.
3307 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3309 - PB_TRACE(pb, PB_TRACE_REC(lock), 0);
3310 - if (atomic_read(&pb->pb_io_remaining))
3312 - down(&pb->pb_sema);
3314 - PB_TRACE(pb, PB_TRACE_REC(locked), 0);
3321 - * pagebuf_unlock releases the lock on the buffer object created by
3322 - * pagebuf_lock or pagebuf_cond_lock (not any
3323 - * pinning of underlying pages created by pagebuf_pin).
3326 -pagebuf_unlock( /* unlock buffer */
3327 - page_buf_t *pb) /* buffer to unlock */
3329 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3330 - PB_CLEAR_OWNER(pb);
3332 - PB_TRACE(pb, PB_TRACE_REC(unlock), 0);
3334 diff -urN linux.org/fs/xfs/pagebuf/page_buf_trace.h linux/fs/xfs/pagebuf/page_buf_trace.h
3335 --- linux.org/fs/xfs/pagebuf/page_buf_trace.h 2003-12-31 05:47:37.000000000 +0100
3336 +++ linux/fs/xfs/pagebuf/page_buf_trace.h 1970-01-01 01:00:00.000000000 +0100
3339 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3341 - * This program is free software; you can redistribute it and/or modify it
3342 - * under the terms of version 2 of the GNU General Public License as
3343 - * published by the Free Software Foundation.
3345 - * This program is distributed in the hope that it would be useful, but
3346 - * WITHOUT ANY WARRANTY; without even the implied warranty of
3347 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3349 - * Further, this software is distributed without any warranty that it is
3350 - * free of the rightful claim of any third person regarding infringement
3351 - * or the like. Any license provided herein, whether implied or
3352 - * otherwise, applies only to this software file. Patent licenses, if
3353 - * any, provided herein do not apply to combinations of this program with
3354 - * other software, or any other product whatsoever.
3356 - * You should have received a copy of the GNU General Public License along
3357 - * with this program; if not, write the Free Software Foundation, Inc., 59
3358 - * Temple Place - Suite 330, Boston MA 02111-1307, USA.
3360 - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
3361 - * Mountain View, CA 94043, or:
3363 - * http://www.sgi.com
3365 - * For further information regarding this notice, see:
3367 - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
3370 -#ifndef __PAGEBUF_TRACE__
3371 -#define __PAGEBUF_TRACE__
3373 -#ifdef PB_DEFINE_TRACES
3374 -#define PB_TRACE_START typedef enum {
3375 -#define PB_TRACE_REC(x) pb_trace_point_##x
3376 -#define PB_TRACE_END } pb_trace_var_t;
3378 -#define PB_TRACE_START static char *event_names[] = {
3379 -#define PB_TRACE_REC(x) #x
3380 -#define PB_TRACE_END };
3385 -PB_TRACE_REC(get_obj),
3386 -PB_TRACE_REC(free_obj),
3387 -PB_TRACE_REC(look_pg),
3388 -PB_TRACE_REC(get_read),
3389 -PB_TRACE_REC(no_daddr),
3390 -PB_TRACE_REC(hold),
3391 -PB_TRACE_REC(rele),
3392 -PB_TRACE_REC(done),
3393 -PB_TRACE_REC(ioerror),
3394 -PB_TRACE_REC(iostart),
3395 -PB_TRACE_REC(end_io),
3396 -PB_TRACE_REC(do_io),
3397 -PB_TRACE_REC(ioreq),
3398 -PB_TRACE_REC(iowait),
3399 -PB_TRACE_REC(iowaited),
3400 -PB_TRACE_REC(free_lk),
3401 -PB_TRACE_REC(freed_l),
3403 -PB_TRACE_REC(get_lk),
3404 -PB_TRACE_REC(got_lk),
3405 -PB_TRACE_REC(skip),
3406 -PB_TRACE_REC(lock),
3407 -PB_TRACE_REC(locked),
3408 -PB_TRACE_REC(unlock),
3409 -PB_TRACE_REC(avl_ret),
3410 -PB_TRACE_REC(condlck),
3411 -PB_TRACE_REC(avl_ins),
3412 -PB_TRACE_REC(walkq1),
3413 -PB_TRACE_REC(walkq2),
3414 -PB_TRACE_REC(walkq3),
3415 -PB_TRACE_REC(delwri_q),
3416 -PB_TRACE_REC(delwri_uq),
3418 -PB_TRACE_REC(unpin),
3419 -PB_TRACE_REC(file_write),
3420 -PB_TRACE_REC(external),
3423 -extern void pb_trace_func(page_buf_t *, int, void *, void *);
3424 -#ifdef PAGEBUF_TRACE
3425 -# define PB_TRACE(pb, event, misc) \
3426 - pb_trace_func(pb, event, (void *) misc, \
3427 - (void *)__builtin_return_address(0))
3429 -# define PB_TRACE(pb, event, misc) do { } while (0)
3432 -#endif /* __PAGEBUF_TRACE__ */
3433 diff -urN linux.org/fs/xfs/quota/xfs_dquot.c linux/fs/xfs/quota/xfs_dquot.c
3434 --- linux.org/fs/xfs/quota/xfs_dquot.c 2003-12-31 05:47:13.000000000 +0100
3435 +++ linux/fs/xfs/quota/xfs_dquot.c 2004-01-02 04:21:44.000000000 +0100
3437 initnsema(&dqp->q_flock, 1, "fdq");
3438 sv_init(&dqp->q_pinwait, SV_DEFAULT, "pdq");
3440 -#ifdef DQUOT_TRACING
3441 +#ifdef XFS_DQUOT_TRACE
3442 dqp->q_trace = ktrace_alloc(DQUOT_TRACE_SIZE, KM_SLEEP);
3443 xfs_dqtrace_entry(dqp, "DQINIT");
3447 ASSERT(dqp->dq_flnext == dqp->dq_flprev);
3449 -#ifdef DQUOT_TRACING
3450 +#ifdef XFS_DQUOT_TRACE
3451 ASSERT(dqp->q_trace);
3452 xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT");
3455 freesema(&dqp->q_flock);
3456 sv_destroy(&dqp->q_pinwait);
3458 -#ifdef DQUOT_TRACING
3459 +#ifdef XFS_DQUOT_TRACE
3461 ktrace_free(dqp->q_trace);
3462 dqp->q_trace = NULL;
3463 @@ -201,20 +201,20 @@
3467 -#ifdef DQUOT_TRACING
3468 +#ifdef XFS_DQUOT_TRACE
3470 * Dquot tracing for debugging.
3474 -xfs_dqtrace_entry__(
3479 +__xfs_dqtrace_entry(
3485 - xfs_dquot_t *udqp = NULL;
3487 + xfs_dquot_t *udqp = NULL;
3488 + xfs_ino_t ino = 0;
3490 ASSERT(dqp->q_trace);
3492 @@ -227,13 +227,19 @@
3493 (void *)(__psint_t)dqp->q_nrefs,
3494 (void *)(__psint_t)dqp->dq_flags,
3495 (void *)(__psint_t)dqp->q_res_bcount,
3496 - (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT),
3497 - (void *)(__psint_t)INT_GET(dqp->q_core.d_icount, ARCH_CONVERT),
3498 - (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT),
3499 - (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT),
3500 - (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT),
3501 - (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT),
3502 - (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT), /* 11 */
3503 + (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount,
3505 + (void *)(__psint_t)INT_GET(dqp->q_core.d_icount,
3507 + (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit,
3509 + (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit,
3511 + (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit,
3513 + (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit,
3515 + (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT),
3516 (void *)(__psint_t)current_pid(),
3517 (void *)(__psint_t)ino,
3518 (void *)(__psint_t)retaddr,
3523 - ASSERT(! XFS_DQ_IS_LOCKED(dqp));
3527 @@ -1000,7 +1005,6 @@
3529 * Dquot lock comes after hashlock in the lock ordering
3531 - ASSERT(! XFS_DQ_IS_LOCKED(dqp));
3533 xfs_ilock(ip, XFS_ILOCK_EXCL);
3534 if (! XFS_IS_DQTYPE_ON(mp, type)) {
3535 @@ -1504,7 +1508,7 @@
3537 ASSERT(XFS_DQ_IS_ON_FREELIST(dqp));
3539 - dqp->q_mount = NULL;;
3540 + dqp->q_mount = NULL;
3542 dqp->dq_flags = XFS_DQ_INACTIVE;
3543 memset(&dqp->q_core, 0, sizeof(dqp->q_core));
3544 diff -urN linux.org/fs/xfs/quota/xfs_dquot.h linux/fs/xfs/quota/xfs_dquot.h
3545 --- linux.org/fs/xfs/quota/xfs_dquot.h 2003-12-31 05:48:42.000000000 +0100
3546 +++ linux/fs/xfs/quota/xfs_dquot.h 2004-01-02 04:21:44.000000000 +0100
3548 sema_t q_flock; /* flush lock */
3549 uint q_pincount; /* pin count for this dquot */
3550 sv_t q_pinwait; /* sync var for pinning */
3551 -#ifdef DQUOT_TRACING
3552 +#ifdef XFS_DQUOT_TRACE
3553 struct ktrace *q_trace; /* trace header structure */
3556 @@ -175,23 +175,25 @@
3557 #define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \
3558 (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
3559 (XFS_IS_GQUOTA_ON((d)->q_mount))))
3560 -#ifdef DQUOT_TRACING
3562 +#ifdef XFS_DQUOT_TRACE
3564 * Dquot Tracing stuff.
3566 #define DQUOT_TRACE_SIZE 64
3567 #define DQUOT_KTRACE_ENTRY 1
3569 +extern void __xfs_dqtrace_entry(xfs_dquot_t *dqp, char *func,
3570 + void *, xfs_inode_t *);
3571 #define xfs_dqtrace_entry_ino(a,b,ip) \
3572 -xfs_dqtrace_entry__((a), (b), (void*)__return_address, (ip))
3573 + __xfs_dqtrace_entry((a), (b), (void*)__return_address, (ip))
3574 #define xfs_dqtrace_entry(a,b) \
3575 -xfs_dqtrace_entry__((a), (b), (void*)__return_address, NULL)
3576 -extern void xfs_dqtrace_entry__(xfs_dquot_t *dqp, char *func,
3577 - void *, xfs_inode_t *);
3578 + __xfs_dqtrace_entry((a), (b), (void*)__return_address, NULL)
3580 #define xfs_dqtrace_entry(a,b)
3581 #define xfs_dqtrace_entry_ino(a,b,ip)
3585 extern void xfs_qm_dqprint(xfs_dquot_t *);
3587 diff -urN linux.org/fs/xfs/quota/xfs_qm.c linux/fs/xfs/quota/xfs_qm.c
3588 --- linux.org/fs/xfs/quota/xfs_qm.c 2003-12-31 05:46:24.000000000 +0100
3589 +++ linux/fs/xfs/quota/xfs_qm.c 2004-01-02 04:21:44.000000000 +0100
3592 kmem_zone_t *qm_dqzone;
3593 kmem_zone_t *qm_dqtrxzone;
3594 +kmem_shaker_t xfs_qm_shaker;
3596 STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int);
3597 STATIC void xfs_qm_list_destroy(xfs_dqlist_t *);
3599 #define XQM_LIST_PRINT(l, NXT, title) do { } while (0)
3602 -struct shrinker *xfs_qm_shrinker;
3605 * Initialize the XQM structure.
3606 * Note that there is not one quota manager per file system.
3609 xqm->qm_dqzone = qm_dqzone;
3611 - xfs_qm_shrinker = set_shrinker(DEFAULT_SEEKS, xfs_qm_shake);
3612 + xfs_qm_shaker = kmem_shake_register(xfs_qm_shake);
3615 * The t_dqinfo portion of transactions.
3618 ASSERT(xqm != NULL);
3619 ASSERT(xqm->qm_nrefs == 0);
3621 - remove_shrinker(xfs_qm_shrinker);
3622 + kmem_shake_deregister(xfs_qm_shaker);
3623 hsize = xqm->qm_dqhashmask + 1;
3624 for (i = 0; i < hsize; i++) {
3625 xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));
3627 ASSERT(XFS_DQ_IS_LOCKED(dqp));
3630 - ASSERT(!udqhint || !XFS_DQ_IS_LOCKED(udqhint));
3638 - ASSERT(! XFS_DQ_IS_LOCKED(udqhint));
3639 ASSERT(XFS_DQ_IS_LOCKED(dqp));
3640 if (! xfs_qm_dqlock_nowait(udqhint)) {
3642 @@ -826,14 +822,10 @@
3645 ASSERT(XFS_DQ_IS_LOCKED(udqhint));
3647 - ASSERT(! XFS_DQ_IS_LOCKED(udqhint));
3651 ASSERT(XFS_DQ_IS_LOCKED(dqp));
3653 - ASSERT(! XFS_DQ_IS_LOCKED(dqp));
3659 ASSERT(XFS_DQ_IS_LOCKED(udq));
3660 ASSERT(XFS_DQ_IS_LOCKED(gdq));
3662 - ASSERT(! XFS_DQ_IS_LOCKED(udq));
3663 - ASSERT(! XFS_DQ_IS_LOCKED(gdq));
3667 @@ -890,15 +879,12 @@
3671 - ASSERT(! XFS_DQ_IS_LOCKED(udq));
3672 - ASSERT(! XFS_DQ_IS_LOCKED(gdq));
3677 ASSERT(XFS_DQ_IS_LOCKED(udq));
3679 - ASSERT(! XFS_DQ_IS_LOCKED(gdq));
3683 @@ -1006,14 +992,10 @@
3685 if (flags & XFS_QMOPT_DQLOCK)
3686 ASSERT(XFS_DQ_IS_LOCKED(ip->i_udquot));
3688 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_udquot));
3691 if (flags & XFS_QMOPT_DQLOCK)
3692 ASSERT(XFS_DQ_IS_LOCKED(ip->i_gdquot));
3694 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_gdquot));
3696 if (XFS_IS_UQUOTA_ON(mp))
3697 ASSERT(ip->i_udquot);
3698 @@ -1756,7 +1738,10 @@
3699 xfs_trans_t *tp, /* transaction pointer - NULL */
3700 xfs_ino_t ino, /* inode number to get data for */
3701 void *buffer, /* not used */
3702 + int ubsize, /* not used */
3703 + void *private_data, /* not used */
3704 xfs_daddr_t bno, /* starting block of inode cluster */
3705 + int *ubused, /* not used */
3706 void *dip, /* on-disk inode pointer (not used) */
3707 int *res) /* result code value */
3709 @@ -1920,7 +1905,7 @@
3710 * adjusting the corresponding dquot counters in core.
3712 if ((error = xfs_bulkstat(mp, NULL, &lastino, &count,
3713 - xfs_qm_dqusage_adjust,
3714 + xfs_qm_dqusage_adjust, NULL,
3716 BULKSTAT_FG_IGET|BULKSTAT_FG_VFSLOCKED,
3718 @@ -2091,7 +2076,7 @@
3720 xfs_qm_freelist_unlock(xfs_Gqm);
3721 if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS)
3723 + return (nreclaimed);
3724 XQM_STATS_INC(xqmstats.xs_qm_dqwants);
3727 @@ -2166,7 +2151,7 @@
3728 XFS_DQ_HASH_UNLOCK(hash);
3729 xfs_qm_freelist_unlock(xfs_Gqm);
3730 if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS)
3732 + return (nreclaimed);
3735 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
3736 @@ -2191,14 +2176,12 @@
3739 xfs_qm_freelist_unlock(xfs_Gqm);
3741 - return nreclaimed;
3742 + return (nreclaimed);
3747 - * The shake manager routine called by shaked() when memory is
3749 + * The kmem_shake interface is invoked when memory is running low.
3753 @@ -2206,10 +2189,10 @@
3755 int ndqused, nfree, n;
3757 - if (!(gfp_mask & __GFP_WAIT))
3759 + if (!kmem_shake_allow(gfp_mask))
3765 nfree = xfs_Gqm->qm_dqfreelist.qh_nelems; /* free dquots */
3766 /* incore dquots in all f/s's */
3767 @@ -2218,7 +2201,7 @@
3768 ASSERT(ndqused >= 0);
3770 if (nfree <= ndqused && nfree < ndquot)
3774 ndqused *= xfs_Gqm->qm_dqfree_ratio; /* target # of free dquots */
3775 n = nfree - ndqused - ndquot; /* # over target */
3776 diff -urN linux.org/fs/xfs/quota/xfs_qm_syscalls.c linux/fs/xfs/quota/xfs_qm_syscalls.c
3777 --- linux.org/fs/xfs/quota/xfs_qm_syscalls.c 2003-12-31 05:47:47.000000000 +0100
3778 +++ linux/fs/xfs/quota/xfs_qm_syscalls.c 2004-01-02 04:21:44.000000000 +0100
3779 @@ -1301,7 +1301,10 @@
3780 xfs_trans_t *tp, /* transaction pointer */
3781 xfs_ino_t ino, /* inode number to get data for */
3782 void *buffer, /* not used */
3783 + int ubsize, /* not used */
3784 + void *private_data, /* not used */
3785 xfs_daddr_t bno, /* starting block of inode cluster */
3786 + int *ubused, /* not used */
3787 void *dip, /* not used */
3788 int *res) /* bulkstat result code */
3790 @@ -1403,7 +1406,7 @@
3791 * adjusting the corresponding dquot counters
3793 if ((error = xfs_bulkstat(mp, NULL, &lastino, &count,
3794 - xfs_qm_internalqcheck_adjust,
3795 + xfs_qm_internalqcheck_adjust, NULL,
3796 0, NULL, BULKSTAT_FG_IGET, &done))) {
3799 diff -urN linux.org/fs/xfs/quota/xfs_trans_dquot.c linux/fs/xfs/quota/xfs_trans_dquot.c
3800 --- linux.org/fs/xfs/quota/xfs_trans_dquot.c 2003-12-31 05:46:41.000000000 +0100
3801 +++ linux/fs/xfs/quota/xfs_trans_dquot.c 2004-01-02 04:21:44.000000000 +0100
3802 @@ -835,13 +835,6 @@
3803 ASSERT(ip->i_ino != mp->m_sb.sb_uquotino);
3804 ASSERT(ip->i_ino != mp->m_sb.sb_gquotino);
3808 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_udquot));
3810 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_gdquot));
3813 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
3814 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount));
3815 ASSERT((type & ~XFS_QMOPT_FORCE_RES) == XFS_TRANS_DQ_RES_RTBLKS ||
3816 diff -urN linux.org/fs/xfs/support/debug.h linux/fs/xfs/support/debug.h
3817 --- linux.org/fs/xfs/support/debug.h 2003-12-31 05:48:49.000000000 +0100
3818 +++ linux/fs/xfs/support/debug.h 2004-01-02 04:21:44.000000000 +0100
3820 extern void icmn_err(int, char *, va_list);
3821 extern void cmn_err(int, char *, ...);
3824 +# define STATIC static
3829 # define ASSERT(EX) ((void)0) /* avoid "constant in conditional" babble */
3830 diff -urN linux.org/fs/xfs/support/kmem.h linux/fs/xfs/support/kmem.h
3831 --- linux.org/fs/xfs/support/kmem.h 2003-12-31 05:48:56.000000000 +0100
3832 +++ linux/fs/xfs/support/kmem.h 2004-01-02 04:21:44.000000000 +0100
3833 @@ -165,4 +165,25 @@
3834 kmem_cache_free(zone, ptr);
3837 +typedef struct shrinker *kmem_shaker_t;
3838 +typedef int (*kmem_shake_func_t)(int, unsigned int);
3840 +static __inline kmem_shaker_t
3841 +kmem_shake_register(kmem_shake_func_t sfunc)
3843 + return set_shrinker(DEFAULT_SEEKS, sfunc);
3846 +static __inline void
3847 +kmem_shake_deregister(kmem_shaker_t shrinker)
3849 + remove_shrinker(shrinker);
3852 +static __inline int
3853 +kmem_shake_allow(unsigned int gfp_mask)
3855 + return (gfp_mask & __GFP_WAIT);
3858 #endif /* __XFS_SUPPORT_KMEM_H__ */
3859 diff -urN linux.org/fs/xfs/support/ktrace.c linux/fs/xfs/support/ktrace.c
3860 --- linux.org/fs/xfs/support/ktrace.c 2003-12-31 05:47:09.000000000 +0100
3861 +++ linux/fs/xfs/support/ktrace.c 2004-01-02 04:21:44.000000000 +0100
3864 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3865 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
3867 * This program is free software; you can redistribute it and/or modify it
3868 * under the terms of version 2 of the GNU General Public License as
3873 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
3875 static kmem_zone_t *ktrace_hdr_zone;
3876 static kmem_zone_t *ktrace_ent_zone;
3877 static int ktrace_zentries;
3879 ktp->kt_nentries = nentries;
3881 ktp->kt_rollover = 0;
3889 static lock_t wrap_lock = SPIN_LOCK_UNLOCKED;
3890 + unsigned long flags;
3892 ktrace_entry_t *ktep;
3894 @@ -190,11 +188,11 @@
3896 * Grab an entry by pushing the index up to the next one.
3898 - spin_lock(&wrap_lock);
3899 + spin_lock_irqsave(&wrap_lock, flags);
3900 index = ktp->kt_index;
3901 if (++ktp->kt_index == ktp->kt_nentries)
3903 - spin_unlock(&wrap_lock);
3904 + spin_unlock_irqrestore(&wrap_lock, flags);
3906 if (!ktp->kt_rollover && index == ktp->kt_nentries - 1)
3907 ktp->kt_rollover = 1;
3909 return (ktp->kt_rollover ? ktp->kt_nentries : ktp->kt_index);
3921 +EXPORT_SYMBOL(ktrace_first);
3925 @@ -311,11 +308,7 @@
3930 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
3931 -EXPORT_SYMBOL(ktrace_first);
3932 EXPORT_SYMBOL(ktrace_next);
3938 * Skip the next "count" entries and return the entry after that.
3939 * Return NULL if this causes us to iterate past the beginning again.
3945 @@ -362,18 +354,3 @@
3953 -ktrace_alloc(int nentries, int sleep)
3956 - * KM_SLEEP callers don't expect failure.
3958 - if (sleep & KM_SLEEP)
3959 - panic("ktrace_alloc: NULL memory on KM_SLEEP request!");
3964 diff -urN linux.org/fs/xfs/support/ktrace.h linux/fs/xfs/support/ktrace.h
3965 --- linux.org/fs/xfs/support/ktrace.h 2003-12-31 05:47:26.000000000 +0100
3966 +++ linux/fs/xfs/support/ktrace.h 2004-01-02 04:21:44.000000000 +0100
3969 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3970 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
3972 * This program is free software; you can redistribute it and/or modify it
3973 * under the terms of version 2 of the GNU General Public License as
3975 #ifndef __XFS_SUPPORT_KTRACE_H__
3976 #define __XFS_SUPPORT_KTRACE_H__
3978 +#include <support/spin.h>
3981 * Trace buffer entry structure.
3983 int ks_index; /* current index */
3987 - * Exported interfaces.
3989 -extern ktrace_t *ktrace_alloc(int, int);
3991 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
3992 +#ifdef CONFIG_XFS_TRACE
3994 extern void ktrace_init(int zentries);
3995 extern void ktrace_uninit(void);
3997 +extern ktrace_t *ktrace_alloc(int, int);
3998 extern void ktrace_free(ktrace_t *);
4000 extern void ktrace_enter(
4002 extern ktrace_entry_t *ktrace_skip(ktrace_t *, int, ktrace_snap_t *);
4005 +#define ktrace_init(x) do { } while (0)
4006 +#define ktrace_uninit() do { } while (0)
4007 +#endif /* CONFIG_XFS_TRACE */
4009 -#define ktrace_free(ktp)
4010 -#define ktrace_enter(ktp,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15)
4014 -#endif /* __XFS_SUPPORT_KTRACE_H__ */
4015 +#endif /* __XFS_SUPPORT_KTRACE_H__ */
4016 diff -urN linux.org/fs/xfs/support/qsort.c linux/fs/xfs/support/qsort.c
4017 --- linux.org/fs/xfs/support/qsort.c 2003-12-31 05:48:26.000000000 +0100
4018 +++ linux/fs/xfs/support/qsort.c 2004-01-02 04:21:44.000000000 +0100
4020 -/* Copyright (C) 1991, 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
4021 - This file is part of the GNU C Library.
4022 - Written by Douglas C. Schmidt (schmidt@ics.uci.edu).
4024 - The GNU C Library is free software; you can redistribute it and/or
4025 - modify it under the terms of the GNU Lesser General Public
4026 - License as published by the Free Software Foundation; either
4027 - version 2.1 of the License, or (at your option) any later version.
4029 - The GNU C Library is distributed in the hope that it will be useful,
4030 - but WITHOUT ANY WARRANTY; without even the implied warranty of
4031 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4032 - Lesser General Public License for more details.
4034 - You should have received a copy of the GNU Lesser General Public
4035 - License along with the GNU C Library; if not, write to the Free
4036 - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4037 - 02111-1307 USA. */
4039 -/* If you consider tuning this algorithm, you should consult first:
4040 - Engineering a sort function; Jon Bentley and M. Douglas McIlroy;
4041 - Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993. */
4043 + * Copyright (c) 1992, 1993
4044 + * The Regents of the University of California. All rights reserved.
4046 + * Redistribution and use in source and binary forms, with or without
4047 + * modification, are permitted provided that the following conditions
4049 + * 1. Redistributions of source code must retain the above copyright
4050 + * notice, this list of conditions and the following disclaimer.
4051 + * 2. Redistributions in binary form must reproduce the above copyright
4052 + * notice, this list of conditions and the following disclaimer in the
4053 + * documentation and/or other materials provided with the distribution.
4054 + * 3. Neither the name of the University nor the names of its contributors
4055 + * may be used to endorse or promote products derived from this software
4056 + * without specific prior written permission.
4058 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4059 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4060 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4061 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
4062 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4063 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4064 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4065 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4066 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4067 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4071 #include <linux/kernel.h>
4072 #include <linux/string.h>
4074 -/* Byte-wise swap two items of size SIZE. */
4075 -#define SWAP(a, b, size) \
4078 - register size_t __size = (size); \
4079 - register char *__a = (a), *__b = (b); \
4082 - char __tmp = *__a; \
4085 - } while (--__size > 0); \
4088 -/* Discontinue quicksort algorithm when partition gets below this size.
4089 - This particular magic number was chosen to work best on a Sun 4/260. */
4090 -#define MAX_THRESH 4
4092 -/* Stack node declarations used to store unfulfilled partition obligations. */
4099 -/* The next 4 #defines implement a very fast in-line stack abstraction. */
4100 -/* The stack needs log (total_elements) entries (we could even subtract
4101 - log(MAX_THRESH)). Since total_elements has type size_t, we get as
4102 - upper bound for log (total_elements):
4103 - bits per byte (CHAR_BIT) * sizeof(size_t). */
4104 -#define STACK_SIZE (8 * sizeof(unsigned long int))
4105 -#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top))
4106 -#define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi)))
4107 -#define STACK_NOT_EMPTY (stack < top)
4110 -/* Order size using quicksort. This implementation incorporates
4111 - four optimizations discussed in Sedgewick:
4113 - 1. Non-recursive, using an explicit stack of pointer that store the
4114 - next array partition to sort. To save time, this maximum amount
4115 - of space required to store an array of SIZE_MAX is allocated on the
4116 - stack. Assuming a 32-bit (64 bit) integer for size_t, this needs
4117 - only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes).
4118 - Pretty cheap, actually.
4120 - 2. Chose the pivot element using a median-of-three decision tree.
4121 - This reduces the probability of selecting a bad pivot value and
4122 - eliminates certain extraneous comparisons.
4124 - 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving
4125 - insertion sort to order the MAX_THRESH items within each partition.
4126 - This is a big win, since insertion sort is faster for small, mostly
4127 - sorted array segments.
4129 - 4. The larger of the two sub-partitions is always pushed onto the
4130 - stack first, with the algorithm then concentrating on the
4131 - smaller partition. This *guarantees* no more than log (total_elems)
4132 - stack size is needed (actually O(1) in this case)! */
4134 + * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
4136 +#define swapcode(TYPE, parmi, parmj, n) { \
4137 + long i = (n) / sizeof (TYPE); \
4138 + register TYPE *pi = (TYPE *) (parmi); \
4139 + register TYPE *pj = (TYPE *) (parmj); \
4141 + register TYPE t = *pi; \
4144 + } while (--i > 0); \
4148 -qsort (void *const pbase, size_t total_elems, size_t size,
4149 - int (*cmp)(const void *, const void *))
4150 +#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
4151 + es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
4153 +static __inline void
4154 +swapfunc(char *a, char *b, int n, int swaptype)
4156 - register char *base_ptr = (char *) pbase;
4157 + if (swaptype <= 1)
4158 + swapcode(long, a, b, n)
4160 + swapcode(char, a, b, n)
4163 - const size_t max_thresh = MAX_THRESH * size;
4164 +#define swap(a, b) \
4165 + if (swaptype == 0) { \
4166 + long t = *(long *)(a); \
4167 + *(long *)(a) = *(long *)(b); \
4168 + *(long *)(b) = t; \
4170 + swapfunc(a, b, es, swaptype)
4172 - if (total_elems == 0)
4173 - /* Avoid lossage with unsigned arithmetic below. */
4176 - if (total_elems > MAX_THRESH)
4178 - char *lo = base_ptr;
4179 - char *hi = &lo[size * (total_elems - 1)];
4180 - stack_node stack[STACK_SIZE];
4181 - stack_node *top = stack + 1;
4183 - while (STACK_NOT_EMPTY)
4188 - /* Select median value from among LO, MID, and HI. Rearrange
4189 - LO and HI so the three values are sorted. This lowers the
4190 - probability of picking a pathological pivot value and
4191 - skips a comparison for both the LEFT_PTR and RIGHT_PTR in
4192 - the while loops. */
4194 - char *mid = lo + size * ((hi - lo) / size >> 1);
4196 - if ((*cmp) ((void *) mid, (void *) lo) < 0)
4197 - SWAP (mid, lo, size);
4198 - if ((*cmp) ((void *) hi, (void *) mid) < 0)
4199 - SWAP (mid, hi, size);
4202 - if ((*cmp) ((void *) mid, (void *) lo) < 0)
4203 - SWAP (mid, lo, size);
4206 - left_ptr = lo + size;
4207 - right_ptr = hi - size;
4209 - /* Here's the famous ``collapse the walls'' section of quicksort.
4210 - Gotta like those tight inner loops! They are the main reason
4211 - that this algorithm runs much faster than others. */
4214 - while ((*cmp) ((void *) left_ptr, (void *) mid) < 0)
4217 - while ((*cmp) ((void *) mid, (void *) right_ptr) < 0)
4218 - right_ptr -= size;
4220 - if (left_ptr < right_ptr)
4222 - SWAP (left_ptr, right_ptr, size);
4223 - if (mid == left_ptr)
4225 - else if (mid == right_ptr)
4228 - right_ptr -= size;
4230 - else if (left_ptr == right_ptr)
4233 - right_ptr -= size;
4235 +#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
4237 +static __inline char *
4238 +med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
4240 + return cmp(a, b) < 0 ?
4241 + (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
4242 + :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c ));
4246 +qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
4248 + char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
4249 + int d, r, swaptype, swap_cnt;
4250 + register char *a = aa;
4252 +loop: SWAPINIT(a, es);
4255 + for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es)
4256 + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
4258 + swap(pl, pl - es);
4261 + pm = (char *)a + (n / 2) * es;
4264 + pn = (char *)a + (n - 1) * es;
4267 + pl = med3(pl, pl + d, pl + 2 * d, cmp);
4268 + pm = med3(pm - d, pm, pm + d, cmp);
4269 + pn = med3(pn - 2 * d, pn - d, pn, cmp);
4272 - while (left_ptr <= right_ptr);
4273 + pm = med3(pl, pm, pn, cmp);
4276 + pa = pb = (char *)a + es;
4278 - /* Set up pointers for next iteration. First determine whether
4279 - left and right partitions are below the threshold size. If so,
4280 - ignore one or both. Otherwise, push the larger partition's
4281 - bounds on the stack and continue sorting the smaller one. */
4283 - if ((size_t) (right_ptr - lo) <= max_thresh)
4285 - if ((size_t) (hi - left_ptr) <= max_thresh)
4286 - /* Ignore both small partitions. */
4289 - /* Ignore small left partition. */
4292 - else if ((size_t) (hi - left_ptr) <= max_thresh)
4293 - /* Ignore small right partition. */
4295 - else if ((right_ptr - lo) > (hi - left_ptr))
4297 - /* Push larger left partition indices. */
4298 - PUSH (lo, right_ptr);
4303 - /* Push larger right partition indices. */
4304 - PUSH (left_ptr, hi);
4307 + pc = pd = (char *)a + (n - 1) * es;
4309 + while (pb <= pc && (r = cmp(pb, a)) <= 0) {
4317 + while (pb <= pc && (r = cmp(pc, a)) >= 0) {
4332 + if (swap_cnt == 0) { /* Switch to insertion sort */
4333 + for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
4334 + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
4336 + swap(pl, pl - es);
4341 - /* Once the BASE_PTR array is partially sorted by quicksort the rest
4342 - is completely sorted using insertion sort, since this is efficient
4343 - for partitions below MAX_THRESH size. BASE_PTR points to the beginning
4344 - of the array to sort, and END_PTR points at the very last element in
4345 - the array (*not* one beyond it!). */
4347 - char *const end_ptr = &base_ptr[size * (total_elems - 1)];
4348 - char *tmp_ptr = base_ptr;
4349 - char *const thresh = min_t(char *const, end_ptr, base_ptr + max_thresh);
4350 - register char *run_ptr;
4352 - /* Find smallest element in first threshold and place it at the
4353 - array's beginning. This is the smallest array element,
4354 - and the operation speeds up insertion sort's inner loop. */
4356 - for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size)
4357 - if ((*cmp) ((void *) run_ptr, (void *) tmp_ptr) < 0)
4358 - tmp_ptr = run_ptr;
4360 - if (tmp_ptr != base_ptr)
4361 - SWAP (tmp_ptr, base_ptr, size);
4363 - /* Insertion sort, running from left-hand-side up to right-hand-side. */
4365 - run_ptr = base_ptr + size;
4366 - while ((run_ptr += size) <= end_ptr)
4368 - tmp_ptr = run_ptr - size;
4369 - while ((*cmp) ((void *) run_ptr, (void *) tmp_ptr) < 0)
4373 - if (tmp_ptr != run_ptr)
4377 - trav = run_ptr + size;
4378 - while (--trav >= run_ptr)
4383 - for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo)
4390 + pn = (char *)a + n * es;
4391 + r = min(pa - (char *)a, pb - pa);
4392 + vecswap(a, pb - r, r);
4393 + r = min((long)(pd - pc), (long)(pn - pd - es));
4394 + vecswap(pb, pn - r, r);
4395 + if ((r = pb - pa) > es)
4396 + qsort(a, r / es, es, cmp);
4397 + if ((r = pd - pc) > es) {
4398 + /* Iterate rather than recurse to save stack space */
4403 +/* qsort(pn - r, r / es, es, cmp);*/
4405 diff -urN linux.org/fs/xfs/xfs_acl.h linux/fs/xfs/xfs_acl.h
4406 --- linux.org/fs/xfs/xfs_acl.h 2003-12-31 05:47:08.000000000 +0100
4407 +++ linux/fs/xfs/xfs_acl.h 2004-01-02 04:21:42.000000000 +0100
4410 - * Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
4411 + * Copyright (c) 2001-2003 Silicon Graphics, Inc. All Rights Reserved.
4413 * This program is free software; you can redistribute it and/or modify it
4414 * under the terms of version 2 of the GNU General Public License as
4416 #define xfs_acl_vset(v,p,sz,t) (-EOPNOTSUPP)
4417 #define xfs_acl_vget(v,p,sz,t) (-EOPNOTSUPP)
4418 #define xfs_acl_vremove(v,t) (-EOPNOTSUPP)
4419 +#define xfs_acl_vhasacl_access(v) (0)
4420 +#define xfs_acl_vhasacl_default(v) (0)
4421 #define _ACL_DECL(a) ((void)0)
4422 #define _ACL_ALLOC(a) (1) /* successfully allocate nothing */
4423 #define _ACL_FREE(a) ((void)0)
4424 diff -urN linux.org/fs/xfs/xfs_alloc.c linux/fs/xfs/xfs_alloc.c
4425 --- linux.org/fs/xfs/xfs_alloc.c 2003-12-31 05:46:44.000000000 +0100
4426 +++ linux/fs/xfs/xfs_alloc.c 2004-01-02 04:21:42.000000000 +0100
4428 #include "xfs_error.h"
4433 - * Allocation tracing.
4435 -ktrace_t *xfs_alloc_trace_buf;
4438 #define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b)))
4440 #define XFSA_FIXUP_BNO_OK 1
4444 #if defined(XFS_ALLOC_TRACE)
4445 +ktrace_t *xfs_alloc_trace_buf;
4447 #define TRACE_ALLOC(s,a) \
4448 xfs_alloc_trace_alloc(fname, s, a, __LINE__)
4449 #define TRACE_FREE(s,a,b,x,f) \
4451 xfs_alloc_trace_busy(fname, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__)
4452 #define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) \
4453 xfs_alloc_trace_busy(fname, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__)
4457 #define TRACE_ALLOC(s,a)
4458 #define TRACE_FREE(s,a,b,x,f)
4459 diff -urN linux.org/fs/xfs/xfs_alloc.h linux/fs/xfs/xfs_alloc.h
4460 --- linux.org/fs/xfs/xfs_alloc.h 2003-12-31 05:46:56.000000000 +0100
4461 +++ linux/fs/xfs/xfs_alloc.h 2004-01-02 04:21:42.000000000 +0100
4466 +#if defined(XFS_ALLOC_TRACE)
4468 + * Allocation tracing buffer size.
4470 +#define XFS_ALLOC_TRACE_SIZE 4096
4471 +extern ktrace_t *xfs_alloc_trace_buf;
4474 * Types for alloc tracing.
4476 @@ -104,26 +111,9 @@
4477 #define XFS_ALLOC_KTRACE_BUSY 4
4478 #define XFS_ALLOC_KTRACE_UNBUSY 5
4479 #define XFS_ALLOC_KTRACE_BUSYSEARCH 6
4483 - * Allocation tracing buffer size.
4485 -#define XFS_ALLOC_TRACE_SIZE 4096
4487 -#ifdef XFS_ALL_TRACE
4488 -#define XFS_ALLOC_TRACE
4491 -#if !defined(DEBUG)
4492 -#undef XFS_ALLOC_TRACE
4496 - * Prototypes for visible xfs_alloc.c routines
4500 * Compute and fill in value of m_ag_maxlevels.
4503 diff -urN linux.org/fs/xfs/xfs_arch.h linux/fs/xfs/xfs_arch.h
4504 --- linux.org/fs/xfs/xfs_arch.h 2003-12-31 05:48:14.000000000 +0100
4505 +++ linux/fs/xfs/xfs_arch.h 2004-01-02 04:21:42.000000000 +0100
4508 #define ARCH_NOCONVERT 1
4509 #if __BYTE_ORDER == __LITTLE_ENDIAN
4510 -#define ARCH_CONVERT 0
4511 +# define ARCH_CONVERT 0
4513 -#define ARCH_CONVERT ARCH_NOCONVERT
4514 +# define ARCH_CONVERT ARCH_NOCONVERT
4517 /* generic swapping macros */
4519 +#ifndef HAVE_SWABMACROS
4520 #define INT_SWAP16(type,var) ((typeof(type))(__swab16((__u16)(var))))
4521 #define INT_SWAP32(type,var) ((typeof(type))(__swab32((__u32)(var))))
4522 #define INT_SWAP64(type,var) ((typeof(type))(__swab64((__u64)(var))))
4525 #define INT_SWAP(type, var) \
4526 ((sizeof(type) == 8) ? INT_SWAP64(type,var) : \
4527 diff -urN linux.org/fs/xfs/xfs_attr.c linux/fs/xfs/xfs_attr.c
4528 --- linux.org/fs/xfs/xfs_attr.c 2003-12-31 05:47:38.000000000 +0100
4529 +++ linux/fs/xfs/xfs_attr.c 2004-01-02 04:21:42.000000000 +0100
4532 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4533 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4535 * This program is free software; you can redistribute it and/or modify it
4536 * under the terms of version 2 of the GNU General Public License as
4538 #include "xfs_quota.h"
4540 #include "xfs_trans_space.h"
4541 +#include "xfs_acl.h"
4545 @@ -2234,7 +2235,8 @@
4546 (__psunsigned_t)context->count,
4547 (__psunsigned_t)context->firstu,
4549 - (context->count > 0)
4550 + ((context->count > 0) &&
4551 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4552 ? (ATTR_ENTRY(context->alist,
4553 context->count-1)->a_valuelen)
4555 @@ -2262,7 +2264,8 @@
4556 (__psunsigned_t)context->count,
4557 (__psunsigned_t)context->firstu,
4559 - (context->count > 0)
4560 + ((context->count > 0) &&
4561 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4562 ? (ATTR_ENTRY(context->alist,
4563 context->count-1)->a_valuelen)
4565 @@ -2290,7 +2293,8 @@
4566 (__psunsigned_t)context->count,
4567 (__psunsigned_t)context->firstu,
4569 - (context->count > 0)
4570 + ((context->count > 0) &&
4571 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4572 ? (ATTR_ENTRY(context->alist,
4573 context->count-1)->a_valuelen)
4575 @@ -2318,7 +2322,8 @@
4576 (__psunsigned_t)context->count,
4577 (__psunsigned_t)context->firstu,
4579 - (context->count > 0)
4580 + ((context->count > 0) &&
4581 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4582 ? (ATTR_ENTRY(context->alist,
4583 context->count-1)->a_valuelen)
4585 @@ -2353,3 +2358,307 @@
4586 (void *)a14, (void *)a15);
4588 #endif /* XFS_ATTR_TRACE */
4591 +/*========================================================================
4592 + * System (pseudo) namespace attribute interface routines.
4593 + *========================================================================*/
4596 +posix_acl_access_set(
4597 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4599 + return xfs_acl_vset(vp, data, size, _ACL_TYPE_ACCESS);
4603 +posix_acl_access_remove(
4604 + struct vnode *vp, char *name, int xflags)
4606 + return xfs_acl_vremove(vp, _ACL_TYPE_ACCESS);
4610 +posix_acl_access_get(
4611 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4613 + return xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS);
4617 +posix_acl_access_exists(
4620 + return xfs_acl_vhasacl_access(vp);
4624 +posix_acl_default_set(
4625 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4627 + return xfs_acl_vset(vp, data, size, _ACL_TYPE_DEFAULT);
4631 +posix_acl_default_get(
4632 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4634 + return xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT);
4638 +posix_acl_default_remove(
4639 + struct vnode *vp, char *name, int xflags)
4641 + return xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT);
4645 +posix_acl_default_exists(
4648 + return xfs_acl_vhasacl_default(vp);
4651 +struct attrnames posix_acl_access = {
4652 + .attr_name = "posix_acl_access",
4653 + .attr_namelen = sizeof("posix_acl_access") - 1,
4654 + .attr_get = posix_acl_access_get,
4655 + .attr_set = posix_acl_access_set,
4656 + .attr_remove = posix_acl_access_remove,
4657 + .attr_exists = posix_acl_access_exists,
4660 +struct attrnames posix_acl_default = {
4661 + .attr_name = "posix_acl_default",
4662 + .attr_namelen = sizeof("posix_acl_default") - 1,
4663 + .attr_get = posix_acl_default_get,
4664 + .attr_set = posix_acl_default_set,
4665 + .attr_remove = posix_acl_default_remove,
4666 + .attr_exists = posix_acl_default_exists,
4669 +struct attrnames *attr_system_names[] =
4670 + { &posix_acl_access, &posix_acl_default };
4673 +/*========================================================================
4674 + * Namespace-prefix-style attribute name interface routines.
4675 + *========================================================================*/
4679 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4683 + VOP_ATTR_SET(vp, name, data, size, xflags, NULL, error);
4689 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4691 + int error, asize = size;
4693 + VOP_ATTR_GET(vp, name, data, &asize, xflags, NULL, error);
4700 +attr_generic_remove(
4701 + struct vnode *vp, char *name, int xflags)
4705 + VOP_ATTR_REMOVE(vp, name, xflags, NULL, error);
4710 +attr_generic_listadd(
4711 + attrnames_t *prefix,
4712 + attrnames_t *namesp,
4717 + char *p = data + *result;
4719 + *result += prefix->attr_namelen;
4720 + *result += namesp->attr_namelen + 1;
4723 + if (*result > size)
4725 + strcpy(p, prefix->attr_name);
4726 + p += prefix->attr_namelen;
4727 + strcpy(p, namesp->attr_name);
4728 + p += namesp->attr_namelen + 1;
4739 + attrnames_t *namesp;
4742 + for (i = 0; i < ATTR_SYSCOUNT; i++) {
4743 + namesp = attr_system_names[i];
4744 + if (!namesp->attr_exists || !namesp->attr_exists(vp))
4746 + error = attr_generic_listadd(&attr_system, namesp,
4747 + data, size, result);
4756 + struct vnode *vp, void *data, size_t size, int xflags, ssize_t *result)
4758 + attrlist_cursor_kern_t cursor = { 0 };
4761 + VOP_ATTR_LIST(vp, data, size, xflags, &cursor, NULL, error);
4765 + return attr_system_list(vp, data, size, result);
4769 +attr_lookup_namespace(
4771 + struct attrnames **names,
4776 + for (i = 0; i < nnames; i++)
4777 + if (!strncmp(name, names[i]->attr_name, names[i]->attr_namelen))
4783 + * Some checks to prevent people abusing EAs to get over quota:
4784 + * - Don't allow modifying user EAs on devices/symlinks;
4785 + * - Don't allow modifying user EAs if sticky bit set;
4792 + struct inode *inode = LINVFS_GET_IP(vp);
4794 + if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
4796 + if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) &&
4797 + !capable(CAP_SYS_ADMIN))
4799 + if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
4800 + (current_fsuid(cred) != inode->i_uid) && !capable(CAP_FOWNER))
4806 +attr_trusted_capable(
4810 + struct inode *inode = LINVFS_GET_IP(vp);
4812 + if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
4814 + if (!capable(CAP_SYS_ADMIN))
4821 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4823 + attrnames_t *namesp;
4826 + if (xflags & ATTR_CREATE)
4829 + namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
4831 + return -EOPNOTSUPP;
4832 + error = namesp->attr_set(vp, name, data, size, xflags);
4834 + error = vn_revalidate(vp);
4840 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4842 + attrnames_t *namesp;
4844 + namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
4846 + return -EOPNOTSUPP;
4847 + return namesp->attr_get(vp, name, data, size, xflags);
4851 +attr_system_remove(
4852 + struct vnode *vp, char *name, int xflags)
4854 + attrnames_t *namesp;
4856 + namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
4858 + return -EOPNOTSUPP;
4859 + return namesp->attr_remove(vp, name, xflags);
4862 +struct attrnames attr_system = {
4863 + .attr_name = "system.",
4864 + .attr_namelen = sizeof("system.") - 1,
4865 + .attr_flag = ATTR_SYSTEM,
4866 + .attr_get = attr_system_get,
4867 + .attr_set = attr_system_set,
4868 + .attr_remove = attr_system_remove,
4869 + .attr_capable = (attrcapable_t)fs_noerr,
4872 +struct attrnames attr_trusted = {
4873 + .attr_name = "trusted.",
4874 + .attr_namelen = sizeof("trusted.") - 1,
4875 + .attr_flag = ATTR_ROOT,
4876 + .attr_get = attr_generic_get,
4877 + .attr_set = attr_generic_set,
4878 + .attr_remove = attr_generic_remove,
4879 + .attr_capable = attr_trusted_capable,
4882 +struct attrnames attr_user = {
4883 + .attr_name = "user.",
4884 + .attr_namelen = sizeof("user.") - 1,
4885 + .attr_get = attr_generic_get,
4886 + .attr_set = attr_generic_set,
4887 + .attr_remove = attr_generic_remove,
4888 + .attr_capable = attr_user_capable,
4891 +struct attrnames *attr_namespaces[] =
4892 + { &attr_system, &attr_trusted, &attr_user };
4893 diff -urN linux.org/fs/xfs/xfs_attr.h linux/fs/xfs/xfs_attr.h
4894 --- linux.org/fs/xfs/xfs_attr.h 2003-12-31 05:46:42.000000000 +0100
4895 +++ linux/fs/xfs/xfs_attr.h 2004-01-02 04:21:42.000000000 +0100
4898 - * Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved.
4899 + * Copyright (c) 2000, 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
4901 * This program is free software; you can redistribute it and/or modify it
4902 * under the terms of version 2 of the GNU General Public License as
4904 * as possible so as to fit into the literal area of the inode.
4907 -#ifdef XFS_ALL_TRACE
4908 -#define XFS_ATTR_TRACE
4911 -#if !defined(DEBUG)
4912 -#undef XFS_ATTR_TRACE
4916 /*========================================================================
4917 * External interfaces
4918 *========================================================================*/
4920 -#define ATTR_ROOT 0x0002 /* use attrs in root namespace, not user */
4924 +typedef int (*attrset_t)(struct vnode *, char *, void *, size_t, int);
4925 +typedef int (*attrget_t)(struct vnode *, char *, void *, size_t, int);
4926 +typedef int (*attrremove_t)(struct vnode *, char *, int);
4927 +typedef int (*attrexists_t)(struct vnode *);
4928 +typedef int (*attrcapable_t)(struct vnode *, struct cred *);
4930 +typedef struct attrnames {
4932 + unsigned int attr_namelen;
4933 + unsigned int attr_flag;
4934 + attrget_t attr_get;
4935 + attrset_t attr_set;
4936 + attrremove_t attr_remove;
4937 + attrexists_t attr_exists;
4938 + attrcapable_t attr_capable;
4941 +#define ATTR_NAMECOUNT 3
4942 +extern struct attrnames attr_user;
4943 +extern struct attrnames attr_system;
4944 +extern struct attrnames attr_trusted;
4945 +extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT];
4947 +#define ATTR_SYSCOUNT 2
4948 +extern struct attrnames posix_acl_access;
4949 +extern struct attrnames posix_acl_default;
4950 +extern struct attrnames *attr_system_names[ATTR_SYSCOUNT];
4952 +extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int);
4953 +extern int attr_generic_list(struct vnode *, void *, size_t, int, ssize_t *);
4955 +#define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */
4956 +#define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */
4957 +#define ATTR_TRUST 0x0004 /* -- unused, from IRIX -- */
4958 #define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */
4959 #define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */
4960 +#define ATTR_SYSTEM 0x0100 /* use attrs in system (pseudo) namespace */
4961 #define ATTR_KERNOTIME 0x1000 /* [kernel] don't update inode timestamps */
4962 #define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */
4963 #define ATTR_KERNAMELS 0x4000 /* [kernel] list attr names (simple list) */
4964 @@ -135,11 +163,8 @@
4965 * Function prototypes for the kernel.
4966 *========================================================================*/
4971 struct attrlist_cursor_kern;
4972 -struct xfs_ext_attr;
4976 diff -urN linux.org/fs/xfs/xfs_attr_leaf.c linux/fs/xfs/xfs_attr_leaf.c
4977 --- linux.org/fs/xfs/xfs_attr_leaf.c 2003-12-31 05:47:15.000000000 +0100
4978 +++ linux/fs/xfs/xfs_attr_leaf.c 2004-01-02 04:21:42.000000000 +0100
4981 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4982 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4984 * This program is free software; you can redistribute it and/or modify it
4985 * under the terms of version 2 of the GNU General Public License as
4986 @@ -444,8 +444,10 @@
4987 < context->bufsize) {
4988 for (i = 0, sfe = &sf->list[0];
4989 i < INT_GET(sf->hdr.count, ARCH_CONVERT); i++) {
4990 - int ns = (sfe->flags & XFS_ATTR_ROOT)?
4991 - ROOT_NAMES : USER_NAMES;
4992 + attrnames_t *namesp;
4994 + namesp = (sfe->flags & XFS_ATTR_ROOT) ? &attr_trusted :
4996 if (((context->flags & ATTR_ROOT) != 0) !=
4997 ((sfe->flags & XFS_ATTR_ROOT) != 0) &&
4998 !(context->flags & ATTR_KERNFULLS)) {
4999 @@ -454,11 +456,11 @@
5001 if (context->flags & ATTR_KERNOVAL) {
5002 ASSERT(context->flags & ATTR_KERNAMELS);
5003 - context->count += xfs_namespaces[ns].namelen +
5004 + context->count += namesp->attr_namelen +
5005 INT_GET(sfe->namelen, ARCH_CONVERT) + 1;
5008 - if (xfs_attr_put_listent(context, ns,
5009 + if (xfs_attr_put_listent(context, namesp,
5010 (char *)sfe->nameval,
5012 (int)INT_GET(sfe->valuelen,
5013 @@ -544,18 +546,22 @@
5014 * Loop putting entries into the user buffer.
5016 for ( ; i < nsbuf; i++, sbp++) {
5017 - int ns = (sbp->flags & XFS_ATTR_ROOT)? ROOT_NAMES:USER_NAMES;
5018 + attrnames_t *namesp;
5020 + namesp = (sfe->flags & XFS_ATTR_ROOT) ? &attr_trusted :
5023 if (cursor->hashval != INT_GET(sbp->hash, ARCH_CONVERT)) {
5024 cursor->hashval = INT_GET(sbp->hash, ARCH_CONVERT);
5027 if (context->flags & ATTR_KERNOVAL) {
5028 ASSERT(context->flags & ATTR_KERNAMELS);
5029 - context->count += xfs_namespaces[ns].namelen
5030 - + sbp->namelen + 1;
5031 + context->count += namesp->attr_namelen +
5035 - if (xfs_attr_put_listent(context, ns,
5036 + if (xfs_attr_put_listent(context, namesp,
5037 sbp->name, sbp->namelen,
5038 INT_GET(sbp->valuelen, ARCH_CONVERT)))
5040 @@ -2270,7 +2276,7 @@
5042 for ( ; (i < INT_GET(leaf->hdr.count, ARCH_CONVERT))
5043 && (retval == 0); entry++, i++) {
5044 - int ns = (entry->flags & XFS_ATTR_ROOT)? ROOT_NAMES:USER_NAMES;
5045 + attrnames_t *namesp;
5047 if (INT_GET(entry->hashval, ARCH_CONVERT) != cursor->hashval) {
5048 cursor->hashval = INT_GET(entry->hashval, ARCH_CONVERT);
5049 @@ -2284,14 +2290,17 @@
5050 !(context->flags & ATTR_KERNFULLS))
5051 continue; /* skip non-matching entries */
5053 + namesp = (entry->flags & XFS_ATTR_ROOT) ? &attr_trusted :
5056 if (entry->flags & XFS_ATTR_LOCAL) {
5057 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i);
5058 if (context->flags & ATTR_KERNOVAL) {
5059 ASSERT(context->flags & ATTR_KERNAMELS);
5060 - context->count += xfs_namespaces[ns].namelen
5061 - + (int)name_loc->namelen + 1;
5062 + context->count += namesp->attr_namelen +
5063 + (int)name_loc->namelen + 1;
5065 - retval = xfs_attr_put_listent(context, ns,
5066 + retval = xfs_attr_put_listent(context, namesp,
5067 (char *)name_loc->nameval,
5068 (int)name_loc->namelen,
5069 (int)INT_GET(name_loc->valuelen,
5070 @@ -2301,10 +2310,10 @@
5071 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i);
5072 if (context->flags & ATTR_KERNOVAL) {
5073 ASSERT(context->flags & ATTR_KERNAMELS);
5074 - context->count += xfs_namespaces[ns].namelen
5075 - + (int)name_rmt->namelen + 1;
5076 + context->count += namesp->attr_namelen +
5077 + (int)name_rmt->namelen + 1;
5079 - retval = xfs_attr_put_listent(context, ns,
5080 + retval = xfs_attr_put_listent(context, namesp,
5081 (char *)name_rmt->name,
5082 (int)name_rmt->namelen,
5083 (int)INT_GET(name_rmt->valuelen,
5084 @@ -2333,7 +2342,7 @@
5087 xfs_attr_put_listent(xfs_attr_list_context_t *context,
5088 - int ns, char *name, int namelen, int valuelen)
5089 + attrnames_t *namesp, char *name, int namelen, int valuelen)
5091 attrlist_ent_t *aep;
5093 @@ -2341,23 +2350,21 @@
5094 ASSERT(!(context->flags & ATTR_KERNOVAL));
5095 if (context->flags & ATTR_KERNAMELS) {
5097 - xattr_namespace_t *nsp;
5099 ASSERT(context->count >= 0);
5101 - nsp = &xfs_namespaces[ns];
5102 - arraytop = context->count + nsp->namelen + namelen+1;
5103 + arraytop = context->count + namesp->attr_namelen + namelen + 1;
5104 if (arraytop > context->firstu) {
5105 context->count = -1; /* insufficient space */
5108 offset = (char *)context->alist + context->count;
5109 - strncpy(offset, nsp->name, nsp->namelen); /* namespace */
5110 - offset += nsp->namelen;
5111 + strncpy(offset, namesp->attr_name, namesp->attr_namelen);
5112 + offset += namesp->attr_namelen;
5113 strncpy(offset, name, namelen); /* real name */
5116 - context->count += nsp->namelen + namelen + 1;
5117 + context->count += namesp->attr_namelen + namelen + 1;
5121 diff -urN linux.org/fs/xfs/xfs_attr_leaf.h linux/fs/xfs/xfs_attr_leaf.h
5122 --- linux.org/fs/xfs/xfs_attr_leaf.h 2003-12-31 05:46:18.000000000 +0100
5123 +++ linux/fs/xfs/xfs_attr_leaf.h 2004-01-02 04:21:42.000000000 +0100
5126 - * Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved.
5127 + * Copyright (c) 2000, 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
5129 * This program is free software; you can redistribute it and/or modify it
5130 * under the terms of version 2 of the GNU General Public License as
5134 struct attrlist_cursor_kern;
5138 struct xfs_da_state;
5140 * on the system call, they are "or"ed together for various operations.
5142 #define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */
5143 -#define XFS_ATTR_ROOT_BIT 1 /* limit access to attr to userid 0 */
5144 +#define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */
5145 #define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
5146 #define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT)
5147 #define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT)
5150 int xfs_attr_leaf_entsize(struct xfs_attr_leafblock *leaf, int index);
5151 int xfs_attr_put_listent(struct xfs_attr_list_context *context,
5152 - int ns, char *name, int namelen, int valuelen);
5153 + struct attrnames *, char *name, int namelen,
5155 int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp);
5157 #endif /* __XFS_ATTR_LEAF_H__ */
5158 diff -urN linux.org/fs/xfs/xfs_attr_sf.h linux/fs/xfs/xfs_attr_sf.h
5159 --- linux.org/fs/xfs/xfs_attr_sf.h 2003-12-31 05:46:54.000000000 +0100
5160 +++ linux/fs/xfs/xfs_attr_sf.h 2004-01-02 04:21:42.000000000 +0100
5161 @@ -104,14 +104,7 @@
5162 (INT_GET(((xfs_attr_shortform_t *)((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT))
5165 -#ifdef XFS_ALL_TRACE
5166 -#define XFS_ATTR_TRACE
5169 -#if !defined(DEBUG)
5170 -#undef XFS_ATTR_TRACE
5173 +#if defined(XFS_ATTR_TRACE)
5175 * Kernel tracing support for attribute lists
5178 struct xfs_attr_leafblock;
5180 #define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */
5181 +extern ktrace_t *xfs_attr_trace_buf;
5184 * Trace record types.
5186 #define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */
5187 #define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */
5189 -#if defined(XFS_ATTR_TRACE)
5191 void xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context);
5192 void xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context,
5193 struct xfs_da_intnode *node);
5194 diff -urN linux.org/fs/xfs/xfs_bmap_btree.c linux/fs/xfs/xfs_bmap_btree.c
5195 --- linux.org/fs/xfs/xfs_bmap_btree.c 2003-12-31 05:47:31.000000000 +0100
5196 +++ linux/fs/xfs/xfs_bmap_btree.c 2004-01-02 04:21:42.000000000 +0100
5200 #if defined(XFS_BMBT_TRACE)
5202 +static char ARGS[] = "args";
5203 +static char ENTRY[] = "entry";
5204 +static char ERROR[] = "error";
5206 +static char EXIT[] = "exit";
5209 * Add a trace buffer entry for the arguments given to the routine,
5211 @@ -305,11 +312,6 @@
5212 xfs_bmbt_trace_argik(fname, c, i, k, __LINE__)
5213 #define XFS_BMBT_TRACE_CURSOR(c,s) \
5214 xfs_bmbt_trace_cursor(fname, c, s, __LINE__)
5215 -static char ARGS[] = "args";
5216 -static char ENTRY[] = "entry";
5217 -static char ERROR[] = "error";
5219 -static char EXIT[] = "exit";
5221 #define XFS_BMBT_TRACE_ARGBI(c,b,i)
5222 #define XFS_BMBT_TRACE_ARGBII(c,b,i,j)
5223 diff -urN linux.org/fs/xfs/xfs_bmap_btree.h linux/fs/xfs/xfs_bmap_btree.h
5224 --- linux.org/fs/xfs/xfs_bmap_btree.h 2003-12-31 05:47:25.000000000 +0100
5225 +++ linux/fs/xfs/xfs_bmap_btree.h 2004-01-02 04:21:43.000000000 +0100
5226 @@ -435,6 +435,10 @@
5227 INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0])
5233 +#if defined(XFS_BMBT_TRACE)
5235 * Trace buffer entry types.
5237 @@ -449,18 +453,9 @@
5239 #define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */
5240 #define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */
5242 -#if defined(XFS_ALL_TRACE)
5243 -#define XFS_BMBT_TRACE
5244 +extern ktrace_t *xfs_bmbt_trace_buf;
5247 -#if !defined(DEBUG)
5248 -#undef XFS_BMBT_TRACE
5255 * Prototypes for xfs_bmap.c to call.
5257 diff -urN linux.org/fs/xfs/xfs_bmap.c linux/fs/xfs/xfs_bmap.c
5258 --- linux.org/fs/xfs/xfs_bmap.c 2003-12-31 05:48:24.000000000 +0100
5259 +++ linux/fs/xfs/xfs_bmap.c 2004-01-02 04:21:42.000000000 +0100
5261 #include "xfs_trans_space.h"
5262 #include "xfs_buf_item.h"
5265 -ktrace_t *xfs_bmap_trace_buf;
5271 #define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
5274 -#if defined(DEBUG) && defined(XFS_RW_TRACE)
5275 +#if defined(XFS_RW_TRACE)
5282 #define xfs_bunmap_trace(ip, bno, len, flags, ra)
5283 -#endif /* DEBUG && XFS_RW_TRACE */
5284 +#endif /* XFS_RW_TRACE */
5287 xfs_bmap_count_tree(
5288 @@ -3543,6 +3540,8 @@
5291 #ifdef XFS_BMAP_TRACE
5292 +ktrace_t *xfs_bmap_trace_buf;
5295 * Add a bmap trace buffer entry. Base routine for the others.
5297 @@ -3575,14 +3574,14 @@
5298 (void *)(__psint_t)cnt,
5299 (void *)(__psunsigned_t)(ip->i_ino >> 32),
5300 (void *)(__psunsigned_t)(unsigned)ip->i_ino,
5301 - (void *)(__psunsigned_t)(INT_GET(r1->l0, ARCH_CONVERT) >> 32),
5302 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l0, ARCH_CONVERT)),
5303 - (void *)(__psunsigned_t)(INT_GET(r1->l1, ARCH_CONVERT) >> 32),
5304 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l1, ARCH_CONVERT)),
5305 - (void *)(__psunsigned_t)(INT_GET(r2->l0, ARCH_CONVERT) >> 32),
5306 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l0, ARCH_CONVERT)),
5307 - (void *)(__psunsigned_t)(INT_GET(r2->l1, ARCH_CONVERT) >> 32),
5308 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l1, ARCH_CONVERT))
5309 + (void *)(__psunsigned_t)(r1->l0 >> 32),
5310 + (void *)(__psunsigned_t)(unsigned)(r1->l0),
5311 + (void *)(__psunsigned_t)(r1->l1 >> 32),
5312 + (void *)(__psunsigned_t)(unsigned)(r1->l1),
5313 + (void *)(__psunsigned_t)(r2->l0 >> 32),
5314 + (void *)(__psunsigned_t)(unsigned)(r2->l0),
5315 + (void *)(__psunsigned_t)(r2->l1 >> 32),
5316 + (void *)(__psunsigned_t)(unsigned)(r2->l1)
5318 ASSERT(ip->i_xtrace);
5319 ktrace_enter(ip->i_xtrace,
5320 @@ -3592,14 +3591,14 @@
5321 (void *)(__psint_t)cnt,
5322 (void *)(__psunsigned_t)(ip->i_ino >> 32),
5323 (void *)(__psunsigned_t)(unsigned)ip->i_ino,
5324 - (void *)(__psunsigned_t)(INT_GET(r1->l0, ARCH_CONVERT) >> 32),
5325 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l0, ARCH_CONVERT)),
5326 - (void *)(__psunsigned_t)(INT_GET(r1->l1, ARCH_CONVERT) >> 32),
5327 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l1, ARCH_CONVERT)),
5328 - (void *)(__psunsigned_t)(INT_GET(r2->l0, ARCH_CONVERT) >> 32),
5329 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l0, ARCH_CONVERT)),
5330 - (void *)(__psunsigned_t)(INT_GET(r2->l1, ARCH_CONVERT) >> 32),
5331 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l1, ARCH_CONVERT))
5332 + (void *)(__psunsigned_t)(r1->l0 >> 32),
5333 + (void *)(__psunsigned_t)(unsigned)(r1->l0),
5334 + (void *)(__psunsigned_t)(r1->l1 >> 32),
5335 + (void *)(__psunsigned_t)(unsigned)(r1->l1),
5336 + (void *)(__psunsigned_t)(r2->l0 >> 32),
5337 + (void *)(__psunsigned_t)(unsigned)(r2->l0),
5338 + (void *)(__psunsigned_t)(r2->l1 >> 32),
5339 + (void *)(__psunsigned_t)(unsigned)(r2->l1)
5343 @@ -3722,7 +3721,7 @@
5347 -#if defined(DEBUG) && defined(XFS_RW_TRACE)
5348 +#if defined(XFS_RW_TRACE)
5352 @@ -3742,7 +3741,7 @@
5353 (void *)(__psint_t)((xfs_dfiloff_t)bno & 0xffffffff),
5354 (void *)(__psint_t)len,
5355 (void *)(__psint_t)flags,
5356 - (void *)(__psint_t)private.p_cpuid,
5357 + (void *)(unsigned long)current_cpu(),
5361 diff -urN linux.org/fs/xfs/xfs_bmap.h linux/fs/xfs/xfs_bmap.h
5362 --- linux.org/fs/xfs/xfs_bmap.h 2003-12-31 05:46:44.000000000 +0100
5363 +++ linux/fs/xfs/xfs_bmap.h 2004-01-02 04:21:42.000000000 +0100
5365 #define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
5366 #define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
5369 - * Trace operations for bmap extent tracing
5371 -#define XFS_BMAP_KTRACE_DELETE 1
5372 -#define XFS_BMAP_KTRACE_INSERT 2
5373 -#define XFS_BMAP_KTRACE_PRE_UP 3
5374 -#define XFS_BMAP_KTRACE_POST_UP 4
5376 -#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
5377 -#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
5379 -#if defined(XFS_ALL_TRACE)
5380 -#define XFS_BMAP_TRACE
5383 -#if !defined(DEBUG)
5384 -#undef XFS_BMAP_TRACE
5388 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_INIT)
5389 void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp);
5390 #define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
5391 @@ -142,6 +122,33 @@
5396 +#if defined(XFS_BMAP_TRACE)
5398 + * Trace operations for bmap extent tracing
5400 +#define XFS_BMAP_KTRACE_DELETE 1
5401 +#define XFS_BMAP_KTRACE_INSERT 2
5402 +#define XFS_BMAP_KTRACE_PRE_UP 3
5403 +#define XFS_BMAP_KTRACE_POST_UP 4
5405 +#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
5406 +#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
5407 +extern ktrace_t *xfs_bmap_trace_buf;
5410 + * Add bmap trace insert entries for all the contents of the extent list.
5413 +xfs_bmap_trace_exlist(
5414 + char *fname, /* function name */
5415 + struct xfs_inode *ip, /* incore inode pointer */
5416 + xfs_extnum_t cnt, /* count of entries in list */
5417 + int whichfork); /* data or attr fork */
5419 +#define xfs_bmap_trace_exlist(f,ip,c,w)
5423 * Convert inode from non-attributed to attributed.
5424 * Must not be in a transaction, ip must not be locked.
5425 @@ -260,20 +267,6 @@
5426 struct xfs_inode *ip, /* incore inode */
5427 int whichfork); /* data or attr fork */
5429 -#if defined(XFS_BMAP_TRACE)
5431 - * Add bmap trace insert entries for all the contents of the extent list.
5434 -xfs_bmap_trace_exlist(
5435 - char *fname, /* function name */
5436 - struct xfs_inode *ip, /* incore inode pointer */
5437 - xfs_extnum_t cnt, /* count of entries in list */
5438 - int whichfork); /* data or attr fork */
5440 -#define xfs_bmap_trace_exlist(f,ip,c,w)
5444 * Map file blocks to filesystem blocks.
5445 * File range is given by the bno/len pair.
5448 xfs_bmap_count_blocks(
5451 + struct xfs_inode *ip,
5455 diff -urN linux.org/fs/xfs/xfs_buf.h linux/fs/xfs/xfs_buf.h
5456 --- linux.org/fs/xfs/xfs_buf.h 2003-12-31 05:48:37.000000000 +0100
5457 +++ linux/fs/xfs/xfs_buf.h 2004-01-02 04:21:43.000000000 +0100
5459 #define XFS_BUF_SET_VTYPE(bp, type)
5460 #define XFS_BUF_SET_REF(bp, ref)
5462 -#define XFS_BUF_ISPINNED(bp) pagebuf_ispin(bp)
5463 +#define XFS_BUF_ISPINNED(bp) pagebuf_ispin(bp)
5465 #define XFS_BUF_VALUSEMA(bp) pagebuf_lock_value(bp)
5466 #define XFS_BUF_CPSEMA(bp) (pagebuf_cond_lock(bp) == 0)
5467 @@ -191,13 +191,11 @@
5469 /* setup the buffer target from a buftarg structure */
5470 #define XFS_BUF_SET_TARGET(bp, target) \
5471 - (bp)->pb_target = (target)
5473 + (bp)->pb_target = (target)
5474 #define XFS_BUF_TARGET(bp) ((bp)->pb_target)
5475 +#define XFS_BUFTARG_NAME(target) \
5476 + pagebuf_target_name(target)
5478 -#define XFS_BUFTARG_NAME(target) \
5479 - ({ char __b[BDEVNAME_SIZE]; bdevname((target->pbr_bdev), __b); __b; })
5481 #define XFS_BUF_SET_VTYPE_REF(bp, type, ref)
5482 #define XFS_BUF_SET_VTYPE(bp, type)
5483 #define XFS_BUF_SET_REF(bp, ref)
5484 @@ -231,18 +229,11 @@
5489 #define xfs_bpin(bp) pagebuf_pin(bp)
5490 #define xfs_bunpin(bp) pagebuf_unpin(bp)
5492 -#ifdef PAGEBUF_TRACE
5493 -# define PB_DEFINE_TRACES
5494 -# include <pagebuf/page_buf_trace.h>
5495 -# define xfs_buftrace(id, bp) PB_TRACE(bp, PB_TRACE_REC(external), (void *)id)
5497 -# define xfs_buftrace(id, bp) do { } while (0)
5500 +#define xfs_buftrace(id, bp) \
5501 + pagebuf_trace(bp, id, NULL, (void *)__builtin_return_address(0))
5503 #define xfs_biodone(pb) \
5504 pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), 0)
5505 diff -urN linux.org/fs/xfs/xfs_buf_item.c linux/fs/xfs/xfs_buf_item.c
5506 --- linux.org/fs/xfs/xfs_buf_item.c 2003-12-31 05:46:23.000000000 +0100
5507 +++ linux/fs/xfs/xfs_buf_item.c 2004-01-02 04:21:43.000000000 +0100
5508 @@ -1207,13 +1207,14 @@
5509 (void *)((unsigned long)bip->bli_flags),
5510 (void *)((unsigned long)bip->bli_recur),
5511 (void *)((unsigned long)atomic_read(&bip->bli_refcount)),
5512 - (void *)XFS_BUF_ADDR(bp),
5513 + (void *)((unsigned long)
5514 + (0xFFFFFFFF & XFS_BUF_ADDR(bp) >> 32)),
5515 + (void *)((unsigned long)(0xFFFFFFFF & XFS_BUF_ADDR(bp))),
5516 (void *)((unsigned long)XFS_BUF_COUNT(bp)),
5517 - (void *)((unsigned long)(0xFFFFFFFF & (XFS_BFLAGS(bp) >> 32))),
5518 - (void *)((unsigned long)(0xFFFFFFFF & XFS_BFLAGS(bp))),
5519 + (void *)((unsigned long)XFS_BUF_BFLAGS(bp)),
5520 XFS_BUF_FSPRIVATE(bp, void *),
5521 XFS_BUF_FSPRIVATE2(bp, void *),
5522 - (void *)((unsigned long)bp->b_pincount),
5523 + (void *)(unsigned long)XFS_BUF_ISPINNED(bp),
5524 (void *)XFS_BUF_IODONE_FUNC(bp),
5525 (void *)((unsigned long)(XFS_BUF_VALUSEMA(bp))),
5526 (void *)bip->bli_item.li_desc,
5527 diff -urN linux.org/fs/xfs/xfs_buf_item.h linux/fs/xfs/xfs_buf_item.h
5528 --- linux.org/fs/xfs/xfs_buf_item.h 2003-12-31 05:48:00.000000000 +0100
5529 +++ linux/fs/xfs/xfs_buf_item.h 2004-01-02 04:21:43.000000000 +0100
5530 @@ -104,6 +104,15 @@
5534 +struct xfs_buf_log_item;
5536 +#if defined(XFS_BLI_TRACE)
5537 +#define XFS_BLI_TRACE_SIZE 32
5539 +void xfs_buf_item_trace(char *, struct xfs_buf_log_item *);
5541 +#define xfs_buf_item_trace(id, bip)
5545 * This is the in core log item structure used to track information
5547 unsigned int bli_flags; /* misc flags */
5548 unsigned int bli_recur; /* lock recursion count */
5549 atomic_t bli_refcount; /* cnt of tp refs */
5551 +#ifdef XFS_BLI_TRACE
5552 struct ktrace *bli_trace; /* event trace buf */
5554 #ifdef XFS_TRANS_DEBUG
5555 @@ -137,23 +146,6 @@
5556 struct xfs_buf_cancel *bc_next;
5559 -#define XFS_BLI_TRACE_SIZE 32
5562 -#if defined(XFS_ALL_TRACE)
5563 -#define XFS_BLI_TRACE
5566 -#if !defined(DEBUG)
5567 -#undef XFS_BLI_TRACE
5570 -#if defined(XFS_BLI_TRACE)
5571 -void xfs_buf_item_trace(char *, xfs_buf_log_item_t *);
5573 -#define xfs_buf_item_trace(id, bip)
5576 void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
5577 void xfs_buf_item_relse(struct xfs_buf *);
5578 void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint);
5579 diff -urN linux.org/fs/xfs/xfs_da_btree.c linux/fs/xfs/xfs_da_btree.c
5580 --- linux.org/fs/xfs/xfs_da_btree.c 2003-12-31 05:48:06.000000000 +0100
5581 +++ linux/fs/xfs/xfs_da_btree.c 2004-01-02 04:21:43.000000000 +0100
5583 #include "xfs_error.h"
5584 #include "xfs_bit.h"
5586 -#if defined(XFSDEBUG) && defined(CONFIG_KDB)
5587 -#undef xfs_buftrace
5588 -#define xfs_buftrace(A,B) \
5589 - printk(" xfs_buftrace : %s (0x%p)\n", A, B); \
5596 diff -urN linux.org/fs/xfs/xfs_dfrag.c linux/fs/xfs/xfs_dfrag.c
5597 --- linux.org/fs/xfs/xfs_dfrag.c 2003-12-31 05:46:28.000000000 +0100
5598 +++ linux/fs/xfs/xfs_dfrag.c 2004-01-02 04:21:43.000000000 +0100
5599 @@ -153,12 +153,12 @@
5600 if ((error = _MAC_XFS_IACCESS(tip, MACWRITE, NULL))) {
5603 - if ((current->fsuid != ip->i_d.di_uid) &&
5604 + if ((current_fsuid(cred) != ip->i_d.di_uid) &&
5605 (error = xfs_iaccess(ip, S_IWUSR, NULL)) &&
5606 !capable_cred(NULL, CAP_FOWNER)) {
5609 - if ((current->fsuid != tip->i_d.di_uid) &&
5610 + if ((current_fsuid(cred) != tip->i_d.di_uid) &&
5611 (error = xfs_iaccess(tip, S_IWUSR, NULL)) &&
5612 !capable_cred(NULL, CAP_FOWNER)) {
5614 diff -urN linux.org/fs/xfs/xfs_dir2_trace.c linux/fs/xfs/xfs_dir2_trace.c
5615 --- linux.org/fs/xfs/xfs_dir2_trace.c 2003-12-31 05:48:09.000000000 +0100
5616 +++ linux/fs/xfs/xfs_dir2_trace.c 2004-01-02 04:21:44.000000000 +0100
5619 - * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5620 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
5622 * This program is free software; you can redistribute it and/or modify it
5623 * under the terms of version 2 of the GNU General Public License as
5628 - __psunsigned_t a0,
5629 - __psunsigned_t a1,
5630 - __psunsigned_t a2,
5631 - __psunsigned_t a3,
5632 - __psunsigned_t a4,
5633 - __psunsigned_t a5,
5634 - __psunsigned_t a6)
5644 - __psunsigned_t n[6];
5647 ASSERT(xfs_dir2_trace_buf);
5648 ASSERT(dp->i_dir_trace);
5650 - memcpy(n, name, min(sizeof(n), namelen));
5651 + memcpy(n, name, min((int)sizeof(n), namelen));
5653 memset((char *)n, 0, sizeof(n));
5654 ktrace_enter(xfs_dir2_trace_buf,
5655 - (void *)(__psunsigned_t)type, (void *)where,
5656 + (void *)(long)type, (void *)where,
5657 (void *)a0, (void *)a1, (void *)a2, (void *)a3,
5658 - (void *)a4, (void *)a5, (void *)a6,
5659 - (void *)(__psunsigned_t)namelen,
5660 + (void *)a4, (void *)a5, (void *)a6, (void *)a7,
5661 + (void *)(long)namelen,
5662 (void *)n[0], (void *)n[1], (void *)n[2],
5663 - (void *)n[3], (void *)n[4], (void *)n[5]);
5664 + (void *)n[3], (void *)n[4]);
5665 ktrace_enter(dp->i_dir_trace,
5666 - (void *)(__psunsigned_t)type, (void *)where,
5667 + (void *)(long)type, (void *)where,
5668 (void *)a0, (void *)a1, (void *)a2, (void *)a3,
5669 - (void *)a4, (void *)a5, (void *)a6,
5670 - (void *)(__psunsigned_t)namelen,
5671 + (void *)a4, (void *)a5, (void *)a6, (void *)a7,
5672 + (void *)(long)namelen,
5673 (void *)n[0], (void *)n[1], (void *)n[2],
5674 - (void *)n[3], (void *)n[4], (void *)n[5]);
5675 + (void *)n[3], (void *)n[4]);
5679 @@ -103,9 +104,11 @@
5681 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS, where,
5682 (char *)args->name, (int)args->namelen,
5683 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5684 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5685 - (__psunsigned_t)args->justcheck, 0, 0);
5686 + (void *)(unsigned long)args->hashval,
5687 + (void *)((unsigned long)(args->inumber >> 32)),
5688 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5689 + (void *)args->dp, (void *)args->trans,
5690 + (void *)(unsigned long)args->justcheck, NULL, NULL);
5694 @@ -116,10 +119,12 @@
5696 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_B, where,
5697 (char *)args->name, (int)args->namelen,
5698 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5699 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5700 - (__psunsigned_t)args->justcheck,
5701 - (__psunsigned_t)(bp ? bp->bps[0] : NULL), 0);
5702 + (void *)(unsigned long)args->hashval,
5703 + (void *)((unsigned long)(args->inumber >> 32)),
5704 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5705 + (void *)args->dp, (void *)args->trans,
5706 + (void *)(unsigned long)args->justcheck,
5707 + (void *)(bp ? bp->bps[0] : NULL), NULL);
5711 @@ -131,11 +136,13 @@
5713 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BB, where,
5714 (char *)args->name, (int)args->namelen,
5715 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5716 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5717 - (__psunsigned_t)args->justcheck,
5718 - (__psunsigned_t)(lbp ? lbp->bps[0] : NULL),
5719 - (__psunsigned_t)(dbp ? dbp->bps[0] : NULL));
5720 + (void *)(unsigned long)args->hashval,
5721 + (void *)((unsigned long)(args->inumber >> 32)),
5722 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5723 + (void *)args->dp, (void *)args->trans,
5724 + (void *)(unsigned long)args->justcheck,
5725 + (void *)(lbp ? lbp->bps[0] : NULL),
5726 + (void *)(dbp ? dbp->bps[0] : NULL));
5730 @@ -148,12 +155,14 @@
5734 + xfs_buf_t *bpbs = bs ? bs->bps[0] : NULL;
5735 + xfs_buf_t *bpbd = bd ? bd->bps[0] : NULL;
5737 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BIBII, where,
5738 (char *)args->name, (int)args->namelen,
5739 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5740 - (__psunsigned_t)(bs ? bs->bps[0] : NULL), (__psunsigned_t)ss,
5741 - (__psunsigned_t)(bd ? bd->bps[0] : NULL), (__psunsigned_t)sd,
5742 - (__psunsigned_t)c);
5743 + (void *)args->dp, (void *)args->trans,
5744 + (void *)bpbs, (void *)(long)ss, (void *)bpbd, (void *)(long)sd,
5745 + (void *)(long)c, NULL);
5749 @@ -163,12 +172,16 @@
5753 + xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
5755 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_DB, where,
5756 (char *)args->name, (int)args->namelen,
5757 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5758 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5759 - (__psunsigned_t)args->justcheck, (__psunsigned_t)db,
5760 - (__psunsigned_t)(bp ? bp->bps[0] : NULL));
5761 + (void *)(unsigned long)args->hashval,
5762 + (void *)((unsigned long)(args->inumber >> 32)),
5763 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5764 + (void *)args->dp, (void *)args->trans,
5765 + (void *)(unsigned long)args->justcheck, (void *)(long)db,
5770 @@ -179,9 +192,13 @@
5772 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_I, where,
5773 (char *)args->name, (int)args->namelen,
5774 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5775 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5776 - (__psunsigned_t)args->justcheck, (__psunsigned_t)i, 0);
5777 + (void *)(unsigned long)args->hashval,
5778 + (void *)((unsigned long)(args->inumber >> 32)),
5779 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5780 + (void *)args->dp, (void *)args->trans,
5781 + (void *)(unsigned long)args->justcheck,
5782 + (void *)((unsigned long)(i >> 32)),
5783 + (void *)((unsigned long)(i & 0xFFFFFFFF)));
5787 @@ -192,9 +209,11 @@
5789 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_S, where,
5790 (char *)args->name, (int)args->namelen,
5791 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5792 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5793 - (__psunsigned_t)args->justcheck, (__psunsigned_t)s, 0);
5794 + (void *)(unsigned long)args->hashval,
5795 + (void *)((unsigned long)(args->inumber >> 32)),
5796 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5797 + (void *)args->dp, (void *)args->trans,
5798 + (void *)(unsigned long)args->justcheck, (void *)(long)s, 0);
5802 @@ -204,11 +223,15 @@
5806 + xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
5808 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_SB, where,
5809 (char *)args->name, (int)args->namelen,
5810 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5811 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5812 - (__psunsigned_t)args->justcheck, (__psunsigned_t)s,
5813 - (__psunsigned_t)(bp ? bp->bps[0] : NULL));
5814 + (void *)(unsigned long)args->hashval,
5815 + (void *)((unsigned long)(args->inumber >> 32)),
5816 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5817 + (void *)args->dp, (void *)args->trans,
5818 + (void *)(unsigned long)args->justcheck, (void *)(long)s,
5821 #endif /* XFS_DIR2_TRACE */
5822 diff -urN linux.org/fs/xfs/xfs_dir2_trace.h linux/fs/xfs/xfs_dir2_trace.h
5823 --- linux.org/fs/xfs/xfs_dir2_trace.h 2003-12-31 05:46:56.000000000 +0100
5824 +++ linux/fs/xfs/xfs_dir2_trace.h 2004-01-02 04:21:44.000000000 +0100
5826 * Tracing for xfs v2 directories.
5829 +#if defined(XFS_DIR2_TRACE)
5835 -#ifdef XFS_ALL_TRACE
5836 -#define XFS_DIR2_TRACE
5837 -#endif /* XFS_ALL_TRACE */
5839 -#if !defined(DEBUG)
5840 -#undef XFS_DIR2_TRACE
5841 -#endif /* !DEBUG */
5843 #define XFS_DIR2_GTRACE_SIZE 4096 /* global buffer */
5844 #define XFS_DIR2_KTRACE_SIZE 32 /* per-inode buffer */
5845 +extern struct ktrace *xfs_dir2_trace_buf;
5847 #define XFS_DIR2_KTRACE_ARGS 1 /* args only */
5848 #define XFS_DIR2_KTRACE_ARGS_B 2 /* args + buffer */
5850 #define XFS_DIR2_KTRACE_ARGS_SB 7 /* args, int, buffer */
5851 #define XFS_DIR2_KTRACE_ARGS_BIBII 8 /* args, buf/int/buf/int/int */
5853 -#ifdef XFS_DIR2_TRACE
5855 void xfs_dir2_trace_args(char *where, struct xfs_da_args *args);
5856 void xfs_dir2_trace_args_b(char *where, struct xfs_da_args *args,
5857 struct xfs_dabuf *bp);
5860 #endif /* XFS_DIR2_TRACE */
5862 -extern struct ktrace *xfs_dir2_trace_buf;
5864 #endif /* __XFS_DIR2_TRACE_H__ */
5865 diff -urN linux.org/fs/xfs/xfs_dir.c linux/fs/xfs/xfs_dir.c
5866 --- linux.org/fs/xfs/xfs_dir.c 2003-12-31 05:46:43.000000000 +0100
5867 +++ linux/fs/xfs/xfs_dir.c 2004-01-02 04:21:43.000000000 +0100
5868 @@ -1093,10 +1093,10 @@
5869 xfs_dir_trace_g_du(char *where, xfs_inode_t *dp, uio_t *uio)
5871 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DU, where,
5872 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5873 - (__psunsigned_t)(uio->uio_offset >> 32),
5874 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5875 - (__psunsigned_t)uio->uio_resid,
5876 + (void *)dp, (void *)dp->i_mount,
5877 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5878 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5879 + (void *)(unsigned long)uio->uio_resid,
5880 NULL, NULL, NULL, NULL, NULL, NULL, NULL);
5883 @@ -1107,11 +1107,11 @@
5884 xfs_dir_trace_g_dub(char *where, xfs_inode_t *dp, uio_t *uio, xfs_dablk_t bno)
5886 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUB, where,
5887 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5888 - (__psunsigned_t)(uio->uio_offset >> 32),
5889 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5890 - (__psunsigned_t)uio->uio_resid,
5891 - (__psunsigned_t)bno,
5892 + (void *)dp, (void *)dp->i_mount,
5893 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5894 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5895 + (void *)(unsigned long)uio->uio_resid,
5896 + (void *)(unsigned long)bno,
5897 NULL, NULL, NULL, NULL, NULL, NULL);
5900 @@ -1122,15 +1122,21 @@
5901 xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio,
5902 xfs_da_intnode_t *node)
5904 + int last = INT_GET(node->hdr.count, ARCH_CONVERT) - 1;
5906 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUN, where,
5907 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5908 - (__psunsigned_t)(uio->uio_offset >> 32),
5909 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5910 - (__psunsigned_t)uio->uio_resid,
5911 - (__psunsigned_t)INT_GET(node->hdr.info.forw, ARCH_CONVERT),
5912 - (__psunsigned_t)INT_GET(node->hdr.count, ARCH_CONVERT),
5913 - (__psunsigned_t)INT_GET(node->btree[0].hashval, ARCH_CONVERT),
5914 - (__psunsigned_t)INT_GET(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval, ARCH_CONVERT),
5915 + (void *)dp, (void *)dp->i_mount,
5916 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5917 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5918 + (void *)(unsigned long)uio->uio_resid,
5919 + (void *)(unsigned long)
5920 + INT_GET(node->hdr.info.forw, ARCH_CONVERT),
5921 + (void *)(unsigned long)
5922 + INT_GET(node->hdr.count, ARCH_CONVERT),
5923 + (void *)(unsigned long)
5924 + INT_GET(node->btree[0].hashval, ARCH_CONVERT),
5925 + (void *)(unsigned long)
5926 + INT_GET(node->btree[last].hashval, ARCH_CONVERT),
5930 @@ -1141,15 +1147,21 @@
5931 xfs_dir_trace_g_dul(char *where, xfs_inode_t *dp, uio_t *uio,
5932 xfs_dir_leafblock_t *leaf)
5934 + int last = INT_GET(leaf->hdr.count, ARCH_CONVERT) - 1;
5936 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUL, where,
5937 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5938 - (__psunsigned_t)(uio->uio_offset >> 32),
5939 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5940 - (__psunsigned_t)uio->uio_resid,
5941 - (__psunsigned_t)INT_GET(leaf->hdr.info.forw, ARCH_CONVERT),
5942 - (__psunsigned_t)INT_GET(leaf->hdr.count, ARCH_CONVERT),
5943 - (__psunsigned_t)INT_GET(leaf->entries[0].hashval, ARCH_CONVERT),
5944 - (__psunsigned_t)INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT),
5945 + (void *)dp, (void *)dp->i_mount,
5946 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5947 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5948 + (void *)(unsigned long)uio->uio_resid,
5949 + (void *)(unsigned long)
5950 + INT_GET(leaf->hdr.info.forw, ARCH_CONVERT),
5951 + (void *)(unsigned long)
5952 + INT_GET(leaf->hdr.count, ARCH_CONVERT),
5953 + (void *)(unsigned long)
5954 + INT_GET(leaf->entries[0].hashval, ARCH_CONVERT),
5955 + (void *)(unsigned long)
5956 + INT_GET(leaf->entries[last].hashval, ARCH_CONVERT),
5960 @@ -1161,11 +1173,12 @@
5961 xfs_dir_leaf_entry_t *entry)
5963 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUE, where,
5964 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5965 - (__psunsigned_t)(uio->uio_offset >> 32),
5966 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5967 - (__psunsigned_t)uio->uio_resid,
5968 - (__psunsigned_t)INT_GET(entry->hashval, ARCH_CONVERT),
5969 + (void *)dp, (void *)dp->i_mount,
5970 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5971 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5972 + (void *)(unsigned long)uio->uio_resid,
5973 + (void *)(unsigned long)
5974 + INT_GET(entry->hashval, ARCH_CONVERT),
5975 NULL, NULL, NULL, NULL, NULL, NULL);
5978 @@ -1176,12 +1189,12 @@
5979 xfs_dir_trace_g_duc(char *where, xfs_inode_t *dp, uio_t *uio, xfs_off_t cookie)
5981 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUC, where,
5982 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5983 - (__psunsigned_t)(uio->uio_offset >> 32),
5984 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5985 - (__psunsigned_t)uio->uio_resid,
5986 - (__psunsigned_t)(cookie >> 32),
5987 - (__psunsigned_t)(cookie & 0xFFFFFFFF),
5988 + (void *)dp, (void *)dp->i_mount,
5989 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5990 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5991 + (void *)(unsigned long)uio->uio_resid,
5992 + (void *)((unsigned long)(cookie >> 32)),
5993 + (void *)((unsigned long)(cookie & 0xFFFFFFFF)),
5994 NULL, NULL, NULL, NULL, NULL);
5997 @@ -1191,15 +1204,15 @@
6000 xfs_dir_trace_enter(int type, char *where,
6001 - __psunsigned_t a0, __psunsigned_t a1,
6002 - __psunsigned_t a2, __psunsigned_t a3,
6003 - __psunsigned_t a4, __psunsigned_t a5,
6004 - __psunsigned_t a6, __psunsigned_t a7,
6005 - __psunsigned_t a8, __psunsigned_t a9,
6006 - __psunsigned_t a10, __psunsigned_t a11)
6007 + void * a0, void * a1,
6008 + void * a2, void * a3,
6009 + void * a4, void * a5,
6010 + void * a6, void * a7,
6011 + void * a8, void * a9,
6012 + void * a10, void * a11)
6014 ASSERT(xfs_dir_trace_buf);
6015 - ktrace_enter(xfs_dir_trace_buf, (void *)((__psunsigned_t)type),
6016 + ktrace_enter(xfs_dir_trace_buf, (void *)(unsigned long)type,
6018 (void *)a0, (void *)a1, (void *)a2,
6019 (void *)a3, (void *)a4, (void *)a5,
6020 diff -urN linux.org/fs/xfs/xfs_dir.h linux/fs/xfs/xfs_dir.h
6021 --- linux.org/fs/xfs/xfs_dir.h 2003-12-31 05:46:52.000000000 +0100
6022 +++ linux/fs/xfs/xfs_dir.h 2004-01-02 04:21:43.000000000 +0100
6024 * as possible so as to fit into the literal area of the inode.
6027 -#ifdef XFS_ALL_TRACE
6028 -#define XFS_DIR_TRACE
6031 -#if !defined(DEBUG)
6032 -#undef XFS_DIR_TRACE
6035 /*========================================================================
6036 * Function prototypes for the kernel.
6037 *========================================================================*/
6038 diff -urN linux.org/fs/xfs/xfs_dir_sf.h linux/fs/xfs/xfs_dir_sf.h
6039 --- linux.org/fs/xfs/xfs_dir_sf.h 2003-12-31 05:47:55.000000000 +0100
6040 +++ linux/fs/xfs/xfs_dir_sf.h 2004-01-02 04:21:44.000000000 +0100
6041 @@ -126,13 +126,7 @@
6042 ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen))
6045 -#ifdef XFS_ALL_TRACE
6046 -#define XFS_DIR_TRACE
6049 -#if !defined(DEBUG)
6050 -#undef XFS_DIR_TRACE
6052 +#if defined(XFS_DIR_TRACE)
6055 * Kernel tracing support for directories.
6057 struct xfs_dir_leaf_entry;
6059 #define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */
6060 +extern ktrace_t *xfs_dir_trace_buf;
6063 * Trace record types.
6065 #define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */
6066 #define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */
6068 -#if defined(XFS_DIR_TRACE)
6070 void xfs_dir_trace_g_du(char *where, struct xfs_inode *dp, struct uio *uio);
6071 void xfs_dir_trace_g_dub(char *where, struct xfs_inode *dp, struct uio *uio,
6073 @@ -170,12 +163,9 @@
6074 void xfs_dir_trace_g_duc(char *where, struct xfs_inode *dp, struct uio *uio,
6076 void xfs_dir_trace_enter(int type, char *where,
6077 - __psunsigned_t a0, __psunsigned_t a1,
6078 - __psunsigned_t a2, __psunsigned_t a3,
6079 - __psunsigned_t a4, __psunsigned_t a5,
6080 - __psunsigned_t a6, __psunsigned_t a7,
6081 - __psunsigned_t a8, __psunsigned_t a9,
6082 - __psunsigned_t a10, __psunsigned_t a11);
6083 + void *a0, void *a1, void *a2, void *a3,
6084 + void *a4, void *a5, void *a6, void *a7,
6085 + void *a8, void *a9, void *a10, void *a11);
6087 #define xfs_dir_trace_g_du(w,d,u)
6088 #define xfs_dir_trace_g_dub(w,d,u,b)
6089 diff -urN linux.org/fs/xfs/xfs_dmapi.h linux/fs/xfs/xfs_dmapi.h
6090 --- linux.org/fs/xfs/xfs_dmapi.h 2003-12-31 05:48:36.000000000 +0100
6091 +++ linux/fs/xfs/xfs_dmapi.h 2004-01-02 04:21:44.000000000 +0100
6092 @@ -175,14 +175,6 @@
6093 DM_FLAGS_NDELAY : 0)
6094 #define AT_DELAY_FLAG(f) ((f&ATTR_NONBLOCK) ? DM_FLAGS_NDELAY : 0)
6097 - * Macros to turn caller specified delay/block flags into
6098 - * dm_send_xxxx_event flag DM_FLAGS_NDELAY.
6101 -#define FILP_DELAY_FLAG(filp) ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) ? \
6102 - DM_FLAGS_NDELAY : 0)
6105 extern struct bhv_vfsops xfs_dmops;
6107 diff -urN linux.org/fs/xfs/xfs_dmops.c linux/fs/xfs/xfs_dmops.c
6108 --- linux.org/fs/xfs/xfs_dmops.c 2003-12-31 05:48:36.000000000 +0100
6109 +++ linux/fs/xfs/xfs_dmops.c 2004-01-02 04:21:44.000000000 +0100
6111 #include "xfs_dmapi.h"
6112 #include "xfs_mount.h"
6115 -#ifndef CONFIG_XFS_DMAPI
6116 xfs_dmops_t xfs_dmcore_xfs = {
6117 .xfs_send_data = (xfs_send_data_t)fs_nosys,
6118 .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr,
6120 .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys,
6121 .xfs_send_unmount = (xfs_send_unmount_t)fs_noval,
6123 -#endif /* CONFIG_XFS_DMAPI */
6124 diff -urN linux.org/fs/xfs/xfs_error.c linux/fs/xfs/xfs_error.c
6125 --- linux.org/fs/xfs/xfs_error.c 2003-12-31 05:48:26.000000000 +0100
6126 +++ linux/fs/xfs/xfs_error.c 2004-01-02 04:21:44.000000000 +0100
6128 if (random() % randfactor)
6131 - memcpy(&fsid, fsidp, sizeof(fsid_t));
6132 + memcpy(&fsid, fsidp, sizeof(xfs_fsid_t));
6134 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
6135 if (xfs_etest[i] == error_tag && xfs_etest_fsid[i] == fsid) {
6140 - memcpy(&fsid, mp->m_fixedfsid, sizeof(fsid_t));
6141 + memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
6143 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
6144 if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {
6149 - memcpy(&fsid, mp->m_fixedfsid, sizeof(fsid_t));
6150 + memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
6152 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
6153 if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {
6158 - memcpy(&fsid, mp->m_fixedfsid, sizeof(fsid_t));
6159 + memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
6161 return xfs_errortag_clearall_umount(fsid, mp->m_fsname, 1);
6163 @@ -258,12 +258,6 @@
6167 -xfs_stack_trace(void)
6176 diff -urN linux.org/fs/xfs/xfs_fsops.c linux/fs/xfs/xfs_fsops.c
6177 --- linux.org/fs/xfs/xfs_fsops.c 2003-12-31 05:48:18.000000000 +0100
6178 +++ linux/fs/xfs/xfs_fsops.c 2004-01-02 04:21:42.000000000 +0100
6180 #include "xfs_fsops.h"
6181 #include "xfs_itable.h"
6183 +#include "xfs_refcache.h"
6184 #include "xfs_trans_space.h"
6185 #include "xfs_rtalloc.h"
6186 #include "xfs_dir2.h"
6188 /* Stop new writers */
6189 xfs_start_freeze(mp, XFS_FREEZE_WRITE);
6191 + /* Flush the refcache */
6192 + xfs_refcache_purge_mp(mp);
6194 /* Flush delalloc and delwri data */
6195 VFS_SYNC(vfsp, SYNC_DELWRI|SYNC_WAIT, NULL, error);
6197 diff -urN linux.org/fs/xfs/xfsidbg.c linux/fs/xfs/xfsidbg.c
6198 --- linux.org/fs/xfs/xfsidbg.c 2003-12-31 05:48:07.000000000 +0100
6199 +++ linux/fs/xfs/xfsidbg.c 2004-01-02 04:21:43.000000000 +0100
6204 -#include "pagebuf/page_buf_internal.h"
6206 #include <linux/ctype.h>
6207 #include <linux/kdb.h>
6209 #include "xfs_attr_sf.h"
6210 #include "xfs_dir_sf.h"
6211 #include "xfs_dir2_sf.h"
6212 +#include "xfs_dir2_trace.h"
6213 #include "xfs_dinode.h"
6214 -#include "xfs_inode.h"
6215 +#include "xfs_rw.h"
6216 #include "xfs_bmap.h"
6217 +#include "xfs_inode.h"
6218 #include "xfs_da_btree.h"
6219 #include "xfs_attr.h"
6220 #include "xfs_attr_leaf.h"
6222 #include "xfs_dir2_leaf.h"
6223 #include "xfs_dir2_block.h"
6224 #include "xfs_dir2_node.h"
6225 -#include "xfs_dir2_trace.h"
6226 #include "xfs_log_priv.h"
6227 #include "xfs_log_recover.h"
6228 -#include "xfs_rw.h"
6229 #include "xfs_bit.h"
6230 #include "xfs_quota.h"
6231 #include "quota/xfs_qm.h"
6232 +#include "xfs_iomap.h"
6234 MODULE_AUTHOR("Silicon Graphics, Inc.");
6235 MODULE_DESCRIPTION("Additional kdb commands for debugging XFS");
6236 MODULE_LICENSE("GPL");
6238 +#define qprintf kdb_printf
6241 + * Command table functions. (tracing)
6243 +#ifdef XFS_ALLOC_TRACE
6244 +static void xfsidbg_xalatrace(int);
6245 +static void xfsidbg_xalbtrace(xfs_agblock_t);
6246 +static void xfsidbg_xalgtrace(xfs_agnumber_t);
6247 +static void xfsidbg_xalmtrace(xfs_mount_t *);
6248 +static void xfsidbg_xalttrace(int);
6250 +#ifdef XFS_ATTR_TRACE
6251 +static void xfsidbg_xattrtrace(int);
6253 +#ifdef XFS_BLI_TRACE
6254 +static void xfsidbg_xblitrace(xfs_buf_log_item_t *);
6256 +#ifdef XFS_BMAP_TRACE
6257 +static void xfsidbg_xbmatrace(int);
6258 +static void xfsidbg_xbmitrace(xfs_inode_t *);
6259 +static void xfsidbg_xbmstrace(xfs_inode_t *);
6260 +static void xfsidbg_xbxatrace(int);
6261 +static void xfsidbg_xbxitrace(xfs_inode_t *);
6262 +static void xfsidbg_xbxstrace(xfs_inode_t *);
6264 +#ifdef XFS_ILOCK_TRACE
6265 +static void xfsidbg_xilock_trace(xfs_inode_t *);
6266 +static void xfsidbg_xailock_trace(int);
6268 +#ifdef XFS_DIR_TRACE
6269 +static void xfsidbg_xdirtrace(int);
6271 +#ifdef XFS_DIR2_TRACE
6272 +static void xfsidbg_xdir2atrace(int);
6273 +static void xfsidbg_xdir2itrace(xfs_inode_t *);
6275 +#ifdef XFS_LOG_TRACE
6276 +static void xfsidbg_xiclogtrace(xlog_in_core_t *);
6277 +static void xfsidbg_xlog_granttrace(xlog_t *);
6279 +#ifdef XFS_DQUOT_TRACE
6280 +static void xfsidbg_xqm_dqtrace(xfs_dquot_t *);
6282 +#ifdef XFS_RW_TRACE
6283 +static void xfsidbg_xrwtrace(xfs_inode_t *);
6288 * Command table functions.
6291 static void xfsidbg_xagi(xfs_agi_t *);
6292 static void xfsidbg_xaildump(xfs_mount_t *);
6293 static void xfsidbg_xalloc(xfs_alloc_arg_t *);
6295 -static void xfsidbg_xalmtrace(xfs_mount_t *);
6297 static void xfsidbg_xattrcontext(xfs_attr_list_context_t *);
6298 static void xfsidbg_xattrleaf(xfs_attr_leafblock_t *);
6299 static void xfsidbg_xattrsf(xfs_attr_shortform_t *);
6301 static void xfsidbg_xbtcur(xfs_btree_cur_t *);
6302 static void xfsidbg_xbuf(xfs_buf_t *);
6303 static void xfsidbg_xbuf_real(xfs_buf_t *, int);
6304 +static void xfsidbg_xarg(int);
6305 +static void xfsidbg_xchksum(uint *);
6306 static void xfsidbg_xchash(xfs_mount_t *mp);
6307 static void xfsidbg_xchashlist(xfs_chashlist_t *chl);
6308 static void xfsidbg_xdaargs(xfs_da_args_t *);
6309 @@ -144,13 +192,18 @@
6310 static void xfsidbg_xsb(xfs_sb_t *, int convert);
6311 static void xfsidbg_xtp(xfs_trans_t *);
6312 static void xfsidbg_xtrans_res(xfs_mount_t *);
6313 -#ifdef CONFIG_XFS_QUOTA
6314 +#ifdef CONFIG_XFS_QUOTA
6315 static void xfsidbg_xqm(void);
6316 static void xfsidbg_xqm_htab(void);
6317 static void xfsidbg_xqm_freelist_print(xfs_frlist_t *qlist, char *title);
6318 static void xfsidbg_xqm_freelist(void);
6321 +#ifdef XFS_BMAP_TRACE
6322 +static void xfs_convert_extent(xfs_bmbt_rec_32_t *, xfs_dfiloff_t *,
6323 + xfs_dfsbno_t *, xfs_dfilblks_t *, int *);
6328 static int kdbm_xfs_xagf(
6333 -static int kdbm_xfs_xalloc(
6334 +#ifdef XFS_ALLOC_TRACE
6335 +static int kdbm_xfs_xalatrace(
6339 @@ -226,19 +280,19 @@
6346 return KDB_ARGCOUNT;
6348 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6352 - xfsidbg_xalloc((xfs_alloc_arg_t *) addr);
6353 + xfsidbg_xalatrace((int) addr);
6358 -static int kdbm_xfs_xalmtrace(
6359 +static int kdbm_xfs_xalbtrace(
6363 @@ -251,16 +305,16 @@
6366 return KDB_ARGCOUNT;
6368 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6372 - xfsidbg_xalmtrace((xfs_mount_t *) addr);
6373 + xfsidbg_xalbtrace((xfs_agblock_t) addr);
6378 -static int kdbm_xfs_xattrcontext(
6379 +static int kdbm_xfs_xalgtrace(
6383 @@ -273,15 +327,18 @@
6386 return KDB_ARGCOUNT;
6388 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6392 - xfsidbg_xattrcontext((xfs_attr_list_context_t *) addr);
6393 + xfsidbg_xalgtrace((xfs_agnumber_t) addr);
6398 -static int kdbm_xfs_xattrleaf(
6399 +#ifdef XFS_ATTR_TRACE
6400 +static int kdbm_xfs_xattrtrace(
6404 @@ -294,15 +351,18 @@
6407 return KDB_ARGCOUNT;
6409 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6413 - xfsidbg_xattrleaf((xfs_attr_leafblock_t *) addr);
6414 + xfsidbg_xattrtrace((int) addr);
6419 -static int kdbm_xfs_xattrsf(
6420 +#ifdef XFS_BLI_TRACE
6421 +static int kdbm_xfs_xblitrace(
6425 @@ -315,15 +375,18 @@
6428 return KDB_ARGCOUNT;
6430 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6434 - xfsidbg_xattrsf((xfs_attr_shortform_t *) addr);
6435 + xfsidbg_xblitrace((xfs_buf_log_item_t *) addr);
6440 -static int kdbm_xfs_xbirec(
6441 +#ifdef XFS_BMAP_TRACE
6442 +static int kdbm_xfs_xbmatrace(
6446 @@ -336,15 +399,16 @@
6449 return KDB_ARGCOUNT;
6451 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6455 - xfsidbg_xbirec((xfs_bmbt_irec_t *) addr);
6456 + xfsidbg_xbmatrace((int) addr);
6460 -static int kdbm_xfs_xbmalla(
6461 +static int kdbm_xfs_xbmitrace(
6465 @@ -357,15 +421,16 @@
6468 return KDB_ARGCOUNT;
6470 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6474 - xfsidbg_xbmalla((xfs_bmalloca_t *)addr);
6475 + xfsidbg_xbmitrace((xfs_inode_t *) addr);
6479 -static int kdbm_xfs_xbrec(
6480 +static int kdbm_xfs_xbmstrace(
6484 @@ -378,15 +443,16 @@
6487 return KDB_ARGCOUNT;
6489 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6493 - xfsidbg_xbrec((xfs_bmbt_rec_64_t *) addr);
6494 + xfsidbg_xbmstrace((xfs_inode_t *) addr);
6498 -static int kdbm_xfs_xbroot(
6499 +static int kdbm_xfs_xbxatrace(
6503 @@ -399,15 +465,16 @@
6506 return KDB_ARGCOUNT;
6508 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6512 - xfsidbg_xbroot((xfs_inode_t *) addr);
6513 + xfsidbg_xbxatrace((int) addr);
6517 -static int kdbm_xfs_xbroota(
6518 +static int kdbm_xfs_xbxitrace(
6522 @@ -420,15 +487,16 @@
6525 return KDB_ARGCOUNT;
6527 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6531 - xfsidbg_xbroota((xfs_inode_t *) addr);
6532 + xfsidbg_xbxitrace((xfs_inode_t *) addr);
6536 -static int kdbm_xfs_xbtcur(
6537 +static int kdbm_xfs_xbxstrace(
6541 @@ -441,15 +509,18 @@
6544 return KDB_ARGCOUNT;
6546 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6550 - xfsidbg_xbtcur((xfs_btree_cur_t *) addr);
6551 + xfsidbg_xbxstrace((xfs_inode_t *) addr);
6556 -static int kdbm_xfs_xbuf(
6557 +#ifdef XFS_DIR2_TRACE
6558 +static int kdbm_xfs_xdir2atrace(
6562 @@ -462,16 +533,16 @@
6565 return KDB_ARGCOUNT;
6567 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6571 - xfsidbg_xbuf((xfs_buf_t *) addr);
6572 + xfsidbg_xdir2atrace((int) addr);
6577 -static int kdbm_xfs_xchash(
6578 +static int kdbm_xfs_xdir2itrace(
6582 @@ -484,15 +555,18 @@
6585 return KDB_ARGCOUNT;
6587 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6591 - xfsidbg_xchash((xfs_mount_t *) addr);
6592 + xfsidbg_xdir2itrace((xfs_inode_t *) addr);
6597 -static int kdbm_xfs_xchashlist(
6598 +#ifdef XFS_DIR_TRACE
6599 +static int kdbm_xfs_xdirtrace(
6603 @@ -505,16 +579,18 @@
6606 return KDB_ARGCOUNT;
6608 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6612 - xfsidbg_xchashlist((xfs_chashlist_t *) addr);
6613 + xfsidbg_xdirtrace((int) addr);
6619 -static int kdbm_xfs_xdaargs(
6620 +#ifdef XFS_LOG_TRACE
6621 +static int kdbm_xfs_xiclogtrace(
6625 @@ -527,15 +603,18 @@
6628 return KDB_ARGCOUNT;
6630 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6634 - xfsidbg_xdaargs((xfs_da_args_t *) addr);
6635 + xfsidbg_xiclogtrace((xlog_in_core_t *) addr);
6640 -static int kdbm_xfs_xdabuf(
6641 +#ifdef XFS_ILOCK_TRACE
6642 +static int kdbm_xfs_xilock_trace(
6646 @@ -548,15 +627,16 @@
6649 return KDB_ARGCOUNT;
6651 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6655 - xfsidbg_xdabuf((xfs_dabuf_t *) addr);
6656 + xfsidbg_xilock_trace((xfs_inode_t *) addr);
6660 -static int kdbm_xfs_xdanode(
6661 +static int kdbm_xfs_xailock_trace(
6665 @@ -569,15 +649,18 @@
6668 return KDB_ARGCOUNT;
6670 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6674 - xfsidbg_xdanode((xfs_da_intnode_t *) addr);
6675 + xfsidbg_xailock_trace((int) addr);
6680 -static int kdbm_xfs_xdastate(
6681 +#ifdef XFS_LOG_TRACE
6682 +static int kdbm_xfs_xlog_granttrace(
6686 @@ -590,15 +673,18 @@
6689 return KDB_ARGCOUNT;
6691 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6695 - xfsidbg_xdastate((xfs_da_state_t *) addr);
6696 + xfsidbg_xlog_granttrace((xlog_t *) addr);
6701 -static int kdbm_xfs_xdirleaf(
6702 +#ifdef XFS_DQUOT_TRACE
6703 +static int kdbm_xfs_xqm_dqtrace(
6707 @@ -611,15 +697,18 @@
6710 return KDB_ARGCOUNT;
6712 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6716 - xfsidbg_xdirleaf((xfs_dir_leafblock_t *) addr);
6717 + xfsidbg_xqm_dqtrace((xfs_dquot_t *) addr);
6722 -static int kdbm_xfs_xdirsf(
6723 +#ifdef XFS_RW_TRACE
6724 +static int kdbm_xfs_xrwtrace(
6728 @@ -632,15 +721,17 @@
6731 return KDB_ARGCOUNT;
6733 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6737 - xfsidbg_xdirsf((xfs_dir_shortform_t *) addr);
6738 + xfsidbg_xrwtrace((xfs_inode_t *) addr);
6743 -static int kdbm_xfs_xdir2free(
6744 +static int kdbm_xfs_xalloc(
6748 @@ -657,11 +748,12 @@
6752 - xfsidbg_xdir2free((xfs_dir2_free_t *) addr);
6753 + xfsidbg_xalloc((xfs_alloc_arg_t *) addr);
6757 -static int kdbm_xfs_xdir2sf(
6758 +#ifdef XFS_ALLOC_TRACE
6759 +static int kdbm_xfs_xalmtrace(
6763 @@ -678,11 +770,11 @@
6767 - xfsidbg_xdir2sf((xfs_dir2_sf_t *) addr);
6768 + xfsidbg_xalmtrace((xfs_mount_t *) addr);
6772 -static int kdbm_xfs_xexlist(
6773 +static int kdbm_xfs_xalttrace(
6777 @@ -699,11 +791,12 @@
6781 - xfsidbg_xexlist((xfs_inode_t *) addr);
6782 + xfsidbg_xalttrace((int) addr);
6785 +#endif /* XFS_ALLOC_TRACE */
6787 -static int kdbm_xfs_xflist(
6788 +static int kdbm_xfs_xattrcontext(
6792 @@ -720,24 +813,32 @@
6796 - xfsidbg_xflist((xfs_bmap_free_t *) addr);
6797 + xfsidbg_xattrcontext((xfs_attr_list_context_t *) addr);
6801 -static int kdbm_xfs_xhelp(
6802 +static int kdbm_xfs_xattrleaf(
6806 struct pt_regs *regs)
6809 + unsigned long addr;
6815 return KDB_ARGCOUNT;
6816 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6821 + xfsidbg_xattrleaf((xfs_attr_leafblock_t *) addr);
6825 -static int kdbm_xfs_xiclog(
6826 +static int kdbm_xfs_xattrsf(
6830 @@ -754,11 +855,11 @@
6834 - xfsidbg_xiclog((xlog_in_core_t *) addr);
6835 + xfsidbg_xattrsf((xfs_attr_shortform_t *) addr);
6839 -static int kdbm_xfs_xiclogall(
6840 +static int kdbm_xfs_xbirec(
6844 @@ -775,11 +876,11 @@
6848 - xfsidbg_xiclogall((xlog_in_core_t *) addr);
6849 + xfsidbg_xbirec((xfs_bmbt_irec_t *) addr);
6853 -static int kdbm_xfs_xiclogcb(
6854 +static int kdbm_xfs_xbmalla(
6858 @@ -796,11 +897,11 @@
6862 - xfsidbg_xiclogcb((xlog_in_core_t *) addr);
6863 + xfsidbg_xbmalla((xfs_bmalloca_t *)addr);
6867 -static int kdbm_xfs_xihash(
6868 +static int kdbm_xfs_xbrec(
6872 @@ -817,11 +918,11 @@
6876 - xfsidbg_xihash((xfs_mount_t *) addr);
6877 + xfsidbg_xbrec((xfs_bmbt_rec_64_t *) addr);
6881 -static int kdbm_xfs_xinodes(
6882 +static int kdbm_xfs_xbroot(
6886 @@ -838,11 +939,11 @@
6890 - xfsidbg_xinodes((xfs_mount_t *) addr);
6891 + xfsidbg_xbroot((xfs_inode_t *) addr);
6895 -static int kdbm_xfs_delayed_blocks(
6896 +static int kdbm_xfs_xbroota(
6900 @@ -859,12 +960,11 @@
6904 - xfsidbg_delayed_blocks((xfs_mount_t *) addr);
6905 + xfsidbg_xbroota((xfs_inode_t *) addr);
6910 -static int kdbm_xfs_xinodes_quiesce(
6911 +static int kdbm_xfs_xbtcur(
6915 @@ -881,11 +981,11 @@
6919 - xfsidbg_xinodes_quiesce((xfs_mount_t *) addr);
6920 + xfsidbg_xbtcur((xfs_btree_cur_t *) addr);
6924 -static int kdbm_xfs_xlog(
6925 +static int kdbm_xfs_xbuf(
6929 @@ -902,11 +1002,12 @@
6933 - xfsidbg_xlog((xlog_t *) addr);
6934 + xfsidbg_xbuf((xfs_buf_t *) addr);
6938 -static int kdbm_xfs_xlog_ritem(
6940 +static int kdbm_xfs_xarg(
6944 @@ -923,11 +1024,11 @@
6948 - xfsidbg_xlog_ritem((xlog_recover_item_t *) addr);
6949 + xfsidbg_xarg((int) addr);
6953 -static int kdbm_xfs_xlog_rtrans(
6954 +static int kdbm_xfs_xchksum(
6958 @@ -944,11 +1045,12 @@
6962 - xfsidbg_xlog_rtrans((xlog_recover_t *) addr);
6963 + xfsidbg_xchksum((uint *) addr);
6967 -static int kdbm_xfs_xlog_rtrans_entire(
6969 +static int kdbm_xfs_xchash(
6973 @@ -965,11 +1067,11 @@
6977 - xfsidbg_xlog_rtrans_entire((xlog_recover_t *) addr);
6978 + xfsidbg_xchash((xfs_mount_t *) addr);
6982 -static int kdbm_xfs_xlog_tic(
6983 +static int kdbm_xfs_xchashlist(
6987 @@ -986,11 +1088,12 @@
6991 - xfsidbg_xlog_tic((xlog_ticket_t *) addr);
6992 + xfsidbg_xchashlist((xfs_chashlist_t *) addr);
6996 -static int kdbm_xfs_xlogitem(
6998 +static int kdbm_xfs_xdaargs(
7002 @@ -1007,11 +1110,11 @@
7006 - xfsidbg_xlogitem((xfs_log_item_t *) addr);
7007 + xfsidbg_xdaargs((xfs_da_args_t *) addr);
7011 -static int kdbm_xfs_xmount(
7012 +static int kdbm_xfs_xdabuf(
7016 @@ -1028,11 +1131,11 @@
7020 - xfsidbg_xmount((xfs_mount_t *) addr);
7021 + xfsidbg_xdabuf((xfs_dabuf_t *) addr);
7025 -static int kdbm_xfs_xnode(
7026 +static int kdbm_xfs_xdanode(
7030 @@ -1049,11 +1152,11 @@
7034 - xfsidbg_xnode((xfs_inode_t *) addr);
7035 + xfsidbg_xdanode((xfs_da_intnode_t *) addr);
7039 -static int kdbm_xfs_xcore(
7040 +static int kdbm_xfs_xdastate(
7044 @@ -1070,11 +1173,11 @@
7048 - xfsidbg_xcore((xfs_iocore_t *) addr);
7049 + xfsidbg_xdastate((xfs_da_state_t *) addr);
7053 -static int kdbm_xfs_xperag(
7054 +static int kdbm_xfs_xdirleaf(
7058 @@ -1091,11 +1194,11 @@
7062 - xfsidbg_xperag((xfs_mount_t *) addr);
7063 + xfsidbg_xdirleaf((xfs_dir_leafblock_t *) addr);
7067 -static int kdbm_xfs_xqm_diskdq(
7068 +static int kdbm_xfs_xdirsf(
7072 @@ -1112,11 +1215,11 @@
7076 - xfsidbg_xqm_diskdq((xfs_disk_dquot_t *) addr);
7077 + xfsidbg_xdirsf((xfs_dir_shortform_t *) addr);
7081 -static int kdbm_xfs_xqm_dqattached_inos(
7082 +static int kdbm_xfs_xdir2free(
7086 @@ -1133,11 +1236,11 @@
7090 - xfsidbg_xqm_dqattached_inos((xfs_mount_t *) addr);
7091 + xfsidbg_xdir2free((xfs_dir2_free_t *) addr);
7095 -static int kdbm_xfs_xqm_dquot(
7096 +static int kdbm_xfs_xdir2sf(
7100 @@ -1154,38 +1257,53 @@
7104 - xfsidbg_xqm_dquot((xfs_dquot_t *) addr);
7105 + xfsidbg_xdir2sf((xfs_dir2_sf_t *) addr);
7109 -#ifdef CONFIG_XFS_QUOTA
7110 -static int kdbm_xfs_xqm(
7111 +static int kdbm_xfs_xexlist(
7115 struct pt_regs *regs)
7118 + unsigned long addr;
7124 return KDB_ARGCOUNT;
7125 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7130 + xfsidbg_xexlist((xfs_inode_t *) addr);
7134 -static int kdbm_xfs_xqm_freelist(
7135 +static int kdbm_xfs_xflist(
7139 struct pt_regs *regs)
7142 + unsigned long addr;
7148 return KDB_ARGCOUNT;
7149 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7153 - xfsidbg_xqm_freelist();
7154 + xfsidbg_xflist((xfs_bmap_free_t *) addr);
7158 -static int kdbm_xfs_xqm_htab(
7159 +static int kdbm_xfs_xhelp(
7163 @@ -1194,12 +1312,11 @@
7165 return KDB_ARGCOUNT;
7167 - xfsidbg_xqm_htab();
7173 -static int kdbm_xfs_xqm_mplist(
7174 +static int kdbm_xfs_xiclog(
7178 @@ -1216,11 +1333,11 @@
7182 - xfsidbg_xqm_mplist((xfs_mount_t *) addr);
7183 + xfsidbg_xiclog((xlog_in_core_t *) addr);
7187 -static int kdbm_xfs_xqm_qinfo(
7188 +static int kdbm_xfs_xiclogall(
7192 @@ -1237,11 +1354,473 @@
7196 - xfsidbg_xqm_qinfo((xfs_mount_t *) addr);
7197 + xfsidbg_xiclogall((xlog_in_core_t *) addr);
7201 -static int kdbm_xfs_xqm_tpdqinfo(
7202 +static int kdbm_xfs_xiclogcb(
7204 + const char **argv,
7205 + const char **envp,
7206 + struct pt_regs *regs)
7208 + unsigned long addr;
7214 + return KDB_ARGCOUNT;
7215 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7219 + xfsidbg_xiclogcb((xlog_in_core_t *) addr);
7223 +static int kdbm_xfs_xihash(
7225 + const char **argv,
7226 + const char **envp,
7227 + struct pt_regs *regs)
7229 + unsigned long addr;
7235 + return KDB_ARGCOUNT;
7236 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7240 + xfsidbg_xihash((xfs_mount_t *) addr);
7244 +static int kdbm_xfs_xinodes(
7246 + const char **argv,
7247 + const char **envp,
7248 + struct pt_regs *regs)
7250 + unsigned long addr;
7256 + return KDB_ARGCOUNT;
7257 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7261 + xfsidbg_xinodes((xfs_mount_t *) addr);
7265 +static int kdbm_xfs_delayed_blocks(
7267 + const char **argv,
7268 + const char **envp,
7269 + struct pt_regs *regs)
7271 + unsigned long addr;
7277 + return KDB_ARGCOUNT;
7278 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7282 + xfsidbg_delayed_blocks((xfs_mount_t *) addr);
7287 +static int kdbm_xfs_xinodes_quiesce(
7289 + const char **argv,
7290 + const char **envp,
7291 + struct pt_regs *regs)
7293 + unsigned long addr;
7299 + return KDB_ARGCOUNT;
7300 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7304 + xfsidbg_xinodes_quiesce((xfs_mount_t *) addr);
7308 +static int kdbm_xfs_xlog(
7310 + const char **argv,
7311 + const char **envp,
7312 + struct pt_regs *regs)
7314 + unsigned long addr;
7320 + return KDB_ARGCOUNT;
7321 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7325 + xfsidbg_xlog((xlog_t *) addr);
7329 +static int kdbm_xfs_xlog_ritem(
7331 + const char **argv,
7332 + const char **envp,
7333 + struct pt_regs *regs)
7335 + unsigned long addr;
7341 + return KDB_ARGCOUNT;
7342 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7346 + xfsidbg_xlog_ritem((xlog_recover_item_t *) addr);
7350 +static int kdbm_xfs_xlog_rtrans(
7352 + const char **argv,
7353 + const char **envp,
7354 + struct pt_regs *regs)
7356 + unsigned long addr;
7362 + return KDB_ARGCOUNT;
7363 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7367 + xfsidbg_xlog_rtrans((xlog_recover_t *) addr);
7371 +static int kdbm_xfs_xlog_rtrans_entire(
7373 + const char **argv,
7374 + const char **envp,
7375 + struct pt_regs *regs)
7377 + unsigned long addr;
7383 + return KDB_ARGCOUNT;
7384 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7388 + xfsidbg_xlog_rtrans_entire((xlog_recover_t *) addr);
7392 +static int kdbm_xfs_xlog_tic(
7394 + const char **argv,
7395 + const char **envp,
7396 + struct pt_regs *regs)
7398 + unsigned long addr;
7404 + return KDB_ARGCOUNT;
7405 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7409 + xfsidbg_xlog_tic((xlog_ticket_t *) addr);
7413 +static int kdbm_xfs_xlogitem(
7415 + const char **argv,
7416 + const char **envp,
7417 + struct pt_regs *regs)
7419 + unsigned long addr;
7425 + return KDB_ARGCOUNT;
7426 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7430 + xfsidbg_xlogitem((xfs_log_item_t *) addr);
7434 +static int kdbm_xfs_xmount(
7436 + const char **argv,
7437 + const char **envp,
7438 + struct pt_regs *regs)
7440 + unsigned long addr;
7446 + return KDB_ARGCOUNT;
7447 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7451 + xfsidbg_xmount((xfs_mount_t *) addr);
7455 +static int kdbm_xfs_xnode(
7457 + const char **argv,
7458 + const char **envp,
7459 + struct pt_regs *regs)
7461 + unsigned long addr;
7467 + return KDB_ARGCOUNT;
7468 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7472 + xfsidbg_xnode((xfs_inode_t *) addr);
7476 +static int kdbm_xfs_xcore(
7478 + const char **argv,
7479 + const char **envp,
7480 + struct pt_regs *regs)
7482 + unsigned long addr;
7488 + return KDB_ARGCOUNT;
7489 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7493 + xfsidbg_xcore((xfs_iocore_t *) addr);
7497 +static int kdbm_xfs_xperag(
7499 + const char **argv,
7500 + const char **envp,
7501 + struct pt_regs *regs)
7503 + unsigned long addr;
7509 + return KDB_ARGCOUNT;
7510 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7514 + xfsidbg_xperag((xfs_mount_t *) addr);
7518 +static int kdbm_xfs_xqm_diskdq(
7520 + const char **argv,
7521 + const char **envp,
7522 + struct pt_regs *regs)
7524 + unsigned long addr;
7530 + return KDB_ARGCOUNT;
7531 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7535 + xfsidbg_xqm_diskdq((xfs_disk_dquot_t *) addr);
7539 +static int kdbm_xfs_xqm_dqattached_inos(
7541 + const char **argv,
7542 + const char **envp,
7543 + struct pt_regs *regs)
7545 + unsigned long addr;
7551 + return KDB_ARGCOUNT;
7552 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7556 + xfsidbg_xqm_dqattached_inos((xfs_mount_t *) addr);
7560 +static int kdbm_xfs_xqm_dquot(
7562 + const char **argv,
7563 + const char **envp,
7564 + struct pt_regs *regs)
7566 + unsigned long addr;
7572 + return KDB_ARGCOUNT;
7573 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7577 + xfsidbg_xqm_dquot((xfs_dquot_t *) addr);
7581 +#ifdef CONFIG_XFS_QUOTA
7582 +static int kdbm_xfs_xqm(
7584 + const char **argv,
7585 + const char **envp,
7586 + struct pt_regs *regs)
7589 + return KDB_ARGCOUNT;
7595 +static int kdbm_xfs_xqm_freelist(
7597 + const char **argv,
7598 + const char **envp,
7599 + struct pt_regs *regs)
7602 + return KDB_ARGCOUNT;
7604 + xfsidbg_xqm_freelist();
7608 +static int kdbm_xfs_xqm_htab(
7610 + const char **argv,
7611 + const char **envp,
7612 + struct pt_regs *regs)
7615 + return KDB_ARGCOUNT;
7617 + xfsidbg_xqm_htab();
7622 +static int kdbm_xfs_xqm_mplist(
7624 + const char **argv,
7625 + const char **envp,
7626 + struct pt_regs *regs)
7628 + unsigned long addr;
7634 + return KDB_ARGCOUNT;
7635 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7639 + xfsidbg_xqm_mplist((xfs_mount_t *) addr);
7643 +static int kdbm_xfs_xqm_qinfo(
7645 + const char **argv,
7646 + const char **envp,
7647 + struct pt_regs *regs)
7649 + unsigned long addr;
7655 + return KDB_ARGCOUNT;
7656 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7660 + xfsidbg_xqm_qinfo((xfs_mount_t *) addr);
7664 +static int kdbm_xfs_xqm_tpdqinfo(
7668 @@ -1404,45 +1983,52 @@
7672 -static void printvnode(vnode_t *vp)
7673 +static void printbhv(bhv_desc_t *bdp)
7676 kdb_symtab_t symtab;
7678 + if (bdp == NULL) {
7679 + kdb_printf("NULL bhv\n");
7683 + kdb_printf("bhv at 0x%p\n", bdp);
7685 + if (kdbnearsym((unsigned long)bdp->bd_ops, &symtab))
7686 + kdb_printf(" ops %s", symtab.sym_name);
7688 + kdb_printf(" ops %s/0x%p", "???", (void *)bdp->bd_ops);
7690 + kdb_printf(" vobj 0x%p pdata 0x%p next 0x%p\n",
7691 + bdp->bd_vobj, bdp->bd_pdata, bdp->bd_next);
7693 + bdp = bdp->bd_next;
7697 - kdb_printf("vnode: 0x%p type ", vp);
7699 +static void printvnode(vnode_t *vp, unsigned long addr)
7701 + kdb_printf("vnode: 0x%lx type ", addr);
7702 if ((size_t)vp->v_type >= sizeof(vnode_type)/sizeof(vnode_type[0]))
7703 kdb_printf("out of range 0x%x", vp->v_type);
7705 kdb_printf("%s", vnode_type[vp->v_type]);
7706 - kdb_printf(" v_bh %p\n", &vp->v_bh);
7707 + kdb_printf(" v_bh 0x%p\n", &vp->v_bh);
7709 - if ((bh = vp->v_bh.bh_first)) {
7710 - kdb_printf(" v_inode 0x%p v_bh->bh_first 0x%p pobj 0x%p\n",
7711 - LINVFS_GET_IP(vp), bh, bh->bd_pdata);
7713 - if (kdbnearsym((unsigned long)bh->bd_ops, &symtab))
7714 - kdb_printf(" ops %s ", symtab.sym_name);
7716 - kdb_printf(" ops %s/0x%p ",
7717 - "???", (void *)bh->bd_ops);
7719 - kdb_printf(" v_inode 0x%p v_bh->bh_first = NULLBHV ",
7720 - LINVFS_GET_IP(vp));
7722 + printbhv(vp->v_fbhv);
7724 printflags((__psunsigned_t)vp->v_flag, tab_vflags, "flag =");
7727 -#ifdef CONFIG_XFS_VNODE_TRACING
7728 +#ifdef XFS_VNODE_TRACE
7729 kdb_printf(" v_trace 0x%p\n", vp->v_trace);
7730 -#endif /* CONFIG_XFS_VNODE_TRACING */
7731 +#endif /* XFS_VNODE_TRACE */
7733 - kdb_printf(" v_vfsp 0x%p v_number %Lx\n",
7734 - vp->v_vfsp, vp->v_number);
7735 + kdb_printf(" v_vfsp 0x%p v_number 0x%llx\n",
7736 + vp->v_vfsp, (unsigned long long)vp->v_number);
7740 static int kdbm_vnode(
7743 @@ -1453,9 +2039,7 @@
7748 -/* bhv_desc_t *bh; */
7749 -/* kdb_symtab_t symtab;*/
7753 return KDB_ARGCOUNT;
7754 @@ -1465,14 +2049,82 @@
7758 - vp = (vnode_t *)addr;
7759 + if ((diag = kdb_getarea(vp, addr)))
7762 + printvnode(&vp, addr);
7768 +print_vfs(vfs_t *vfs, unsigned long addr)
7770 + kdb_printf("vfsp at 0x%lx", addr);
7771 + kdb_printf(" vfs_flag 0x%x\n", vfs->vfs_flag);
7772 + kdb_printf(" vfs_super 0x%p", vfs->vfs_super);
7773 + kdb_printf(" vfs_bh 0x%p\n", &vfs->vfs_bh);
7775 + printbhv(vfs->vfs_fbhv);
7778 +static int kdbm_bhv(
7780 + const char **argv,
7781 + const char **envp,
7782 + struct pt_regs *regs)
7784 + unsigned long addr;
7791 + return KDB_ARGCOUNT;
7793 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7798 + bh = (bhv_desc_t *)addr;
7805 +static int kdbm_vfs(
7807 + const char **argv,
7808 + const char **envp,
7809 + struct pt_regs *regs)
7811 + unsigned long addr;
7818 + return KDB_ARGCOUNT;
7820 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7825 + if ((diag = kdb_getarea(vfs, addr)))
7829 + print_vfs(&vfs, addr);
7834 -#ifdef CONFIG_XFS_VNODE_TRACING
7836 +#ifdef XFS_VNODE_TRACE
7838 * Print a vnode trace entry.
7840 @@ -1668,7 +2320,7 @@
7844 -#endif /* CONFIG_XFS_VNODE_TRACING */
7845 +#endif /* XFS_VNODE_TRACE */
7848 static void printinode(struct inode *ip)
7849 @@ -1682,16 +2334,21 @@
7850 kdb_printf(" i_ino = %lu i_count = %u i_size %Ld\n",
7851 ip->i_ino, atomic_read(&ip->i_count),
7854 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
7856 - " i_mode = 0x%x i_nlink = %d i_rdev = %u:%u i_state = 0x%lx\n",
7857 + " i_mode = 0x%x i_nlink = %d i_rdev = 0x%x i_state = 0x%lx\n",
7858 ip->i_mode, ip->i_nlink,
7859 - MAJOR(ip->i_rdev),
7860 - MINOR(ip->i_rdev),
7863 - kdb_printf(" i_hash.nxt = 0x%p i_hash.prv = 0x%p\n",
7864 - ip->i_hash.next, ip->i_hash.prev);
7865 + kdev_t_to_nr(ip->i_rdev), ip->i_state);
7866 + kdb_printf(" i_hash.nxt = 0x%p i_hash.pprv = 0x%p\n",
7867 + ip->i_hash.next, ip->i_hash.prev);
7870 + " i_mode = 0x%x i_nlink = %d i_rdev = 0x%x i_state = 0x%lx\n",
7871 + ip->i_mode, ip->i_nlink,
7872 + ip->i_rdev, ip->i_state);
7873 + kdb_printf(" i_hash.nxt = 0x%p i_hash.pprv = 0x%p\n",
7874 + ip->i_hash.next, ip->i_hash.pprev);
7876 kdb_printf(" i_list.nxt = 0x%p i_list.prv = 0x%p\n",
7877 ip->i_list.next, ip->i_list.prev);
7878 kdb_printf(" i_dentry.nxt = 0x%p i_dentry.prv = 0x%p\n",
7879 @@ -1717,52 +2374,44 @@
7883 -/* char *symname; */
7887 -/* bhv_desc_t *bh; */
7888 -#ifdef CONFIG_XFS_VNODE_TRACING
7890 +#ifdef XFS_VNODE_TRACE
7891 ktrace_entry_t *ktep;
7897 return KDB_ARGCOUNT;
7899 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7904 - vp = (vnode_t *)addr;
7906 - ip = LINVFS_GET_IP(vp);
7907 + if ((diag = kdb_getarea(vp, addr)))
7910 + ip = LINVFS_GET_IP((vnode_t *)addr);
7911 kdb_printf("--> Inode @ 0x%p\n", ip);
7914 - kdb_printf("--> Vnode @ 0x%p\n", vp);
7917 -#ifdef CONFIG_XFS_VNODE_TRACING
7918 + kdb_printf("--> Vnode @ 0x%lx\n", addr);
7919 + printvnode(&vp, addr);
7921 - kdb_printf("--> Vntrace @ 0x%p/0x%p\n", vp, vp->v_trace);
7923 - if (vp->v_trace == NULL)
7924 +#ifdef XFS_VNODE_TRACE
7925 + kdb_printf("--> Vntrace @ 0x%lx/0x%p\n", addr, vp.v_trace);
7926 + if (vp.v_trace == NULL)
7929 - ktep = ktrace_first(vp->v_trace, &kts);
7931 + ktep = ktrace_first(vp.v_trace, &kts);
7932 while (ktep != NULL) {
7933 if (vn_trace_pr_entry(ktep))
7936 - ktep = ktrace_next(vp->v_trace, &kts);
7937 + ktep = ktrace_next(vp.v_trace, &kts);
7939 -#endif /* CONFIG_XFS_VNODE_TRACING */
7941 +#endif /* XFS_VNODE_TRACE */
7945 @@ -1772,15 +2421,15 @@
7946 static char *pb_flag_vals[] = {
7947 /* 0 */ "READ", "WRITE", "MAPPED", "PARTIAL", "ASYNC",
7948 /* 5 */ "NONE", "DELWRI", "FREED", "SYNC", "MAPPABLE",
7949 -/* 10 */ "STALE", "FS_MANAGED", "INVALID12", "LOCK", "TRYLOCK",
7950 +/* 10 */ "STALE", "FS_MANAGED", "FS_DATAIOD", "LOCK", "TRYLOCK",
7951 /* 15 */ "DONT_BLOCK", "LOCKABLE", "PRIVATE_BH", "ALL_PAGES_MAPPED",
7953 /* 20 */ "MEM_ALLOCATED", "FORCEIO", "FLUSH", "READ_AHEAD",
7956 -static char *pbm_flag_vals[] = {
7957 +static char *iomap_flag_vals[] = {
7958 "EOF", "HOLE", "DELAY", "INVALID0x08",
7959 - "INVALID0x10", "UNWRITTEN", "INVALID0x40", "INVALID0x80",
7960 + "INVALID0x10", "UNWRITTEN", "NEW", "INVALID0x80",
7964 @@ -1795,7 +2444,7 @@
7965 for (index = 0; flags && mapping[index]; flags >>= 1, index++) {
7967 if ((offset + strlen(mapping[index]) + 1) >= 80) {
7968 - strcat(buffer, "\n ");
7969 + strcat(buffer, "\n ");
7971 } else if (offset > 12) {
7972 strcat(buffer, " ");
7973 @@ -1832,6 +2481,48 @@
7980 + unsigned long addr)
7982 + kdb_printf("page_buf_t at 0x%lx\n", addr);
7983 + kdb_printf(" pb_flags %s\n", pb_flags(pb->pb_flags));
7984 + kdb_printf(" pb_target 0x%p pb_hold %d pb_next 0x%p pb_prev 0x%p\n",
7985 + pb->pb_target, pb->pb_hold.counter,
7986 + list_entry(pb->pb_list.next, page_buf_t, pb_list),
7987 + list_entry(pb->pb_list.prev, page_buf_t, pb_list));
7988 + kdb_printf(" pb_hash_index %d pb_hash_next 0x%p pb_hash_prev 0x%p\n",
7989 + pb->pb_hash_index,
7990 + list_entry(pb->pb_hash_list.next, page_buf_t, pb_hash_list),
7991 + list_entry(pb->pb_hash_list.prev, page_buf_t, pb_hash_list));
7992 + kdb_printf(" pb_file_offset 0x%llx pb_buffer_length 0x%llx pb_addr 0x%p\n",
7993 + (unsigned long long) pb->pb_file_offset,
7994 + (unsigned long long) pb->pb_buffer_length,
7996 + kdb_printf(" pb_bn 0x%Lx pb_count_desired 0x%lx pb_locked %d\n",
7998 + (unsigned long) pb->pb_count_desired, (int)pb->pb_locked);
7999 + kdb_printf(" pb_flushtime %ld (%ld) pb_io_remaining %d pb_error %u\n",
8000 + pb->pb_flushtime, pb->pb_flushtime - jiffies,
8001 + pb->pb_io_remaining.counter, pb->pb_error);
8002 + kdb_printf(" pb_page_count %u pb_offset 0x%x pb_pages 0x%p\n",
8003 + pb->pb_page_count, pb->pb_offset,
8005 + kdb_printf(" pb_iodonesema (%d,%d) pb_sema (%d,%d) pincount (%d)\n",
8006 + pb->pb_iodonesema.count.counter,
8007 + pb->pb_iodonesema.sleepers,
8008 + pb->pb_sema.count.counter, pb->pb_sema.sleepers,
8009 + pb->pb_pin_count.counter);
8010 +#ifdef PAGEBUF_LOCK_TRACKING
8011 + kdb_printf(" last holder %d\n", pb->pb_last_holder);
8013 + if (pb->pb_fspriv || pb->pb_fspriv2) {
8014 + kdb_printf( " pb_fspriv 0x%p pb_fspriv2 0x%p\n",
8015 + pb->pb_fspriv, pb->pb_fspriv2);
8020 kdbm_pb(int argc, const char **argv, const char **envp, struct pt_regs *regs)
8022 @@ -1849,109 +2540,64 @@
8023 (diag = kdb_getarea(bp, addr)))
8026 - kdb_printf("page_buf_t at 0x%lx\n", addr);
8027 - kdb_printf(" pb_flags %s\n", pb_flags(bp.pb_flags));
8028 - kdb_printf(" pb_target 0x%p pb_hold %d pb_next 0x%p pb_prev 0x%p\n",
8029 - bp.pb_target, bp.pb_hold.counter,
8030 - bp.pb_list.next, bp.pb_list.prev);
8031 - kdb_printf(" pb_hash_index %d pb_hash_next 0x%p pb_hash_prev 0x%p\n",
8033 - bp.pb_hash_list.next,
8034 - bp.pb_hash_list.prev);
8035 - kdb_printf(" pb_file_offset 0x%llx pb_buffer_length 0x%llx pb_addr 0x%p\n",
8036 - (unsigned long long) bp.pb_file_offset,
8037 - (unsigned long long) bp.pb_buffer_length,
8039 - kdb_printf(" pb_bn 0x%Lx pb_count_desired 0x%lx\n",
8041 - (unsigned long) bp.pb_count_desired);
8042 - kdb_printf(" pb_io_remaining %d pb_error %u\n",
8043 - bp.pb_io_remaining.counter,
8045 - kdb_printf(" pb_page_count %u pb_offset 0x%x pb_pages 0x%p\n",
8046 - bp.pb_page_count, bp.pb_offset,
8048 -#ifdef PAGEBUF_LOCK_TRACKING
8049 - kdb_printf(" pb_iodonesema (%d,%d) pb_sema (%d,%d) pincount (%d) last holder %d\n",
8050 - bp.pb_iodonesema.count.counter,
8051 - bp.pb_iodonesema.sleepers,
8052 - bp.pb_sema.count.counter, bp.pb_sema.sleepers,
8053 - bp.pb_pin_count.counter, bp.pb_last_holder);
8055 - kdb_printf(" pb_iodonesema (%d,%d) pb_sema (%d,%d) pincount (%d)\n",
8056 - bp.pb_iodonesema.count.counter,
8057 - bp.pb_iodonesema.sleepers,
8058 - bp.pb_sema.count.counter, bp.pb_sema.sleepers,
8059 - bp.pb_pin_count.counter);
8061 - if (bp.pb_fspriv || bp.pb_fspriv2) {
8062 - kdb_printf( "pb_fspriv 0x%p pb_fspriv2 0x%p\n",
8063 - bp.pb_fspriv, bp.pb_fspriv2);
8065 + print_pagebuf(&bp, addr);
8070 -/* XXXXXXXXXXXXXXXXXXXXXX */
8071 -/* The start of this deliberately looks like a read_descriptor_t in layout */
8073 - read_descriptor_t io_rdesc;
8076 - page_buf_rw_t io_dir; /* read or write */
8077 - loff_t io_offset; /* Starting offset of I/O */
8078 - int io_iovec_nr; /* Number of entries in iovec */
8081 - struct iovec **io_iovec; /* iovec list indexed by iovec_index */
8082 - loff_t io_iovec_offset; /* offset into current iovec. */
8083 - int io_iovec_index; /* current iovec being processed */
8084 - unsigned int io_sshift; /* sector bit shift */
8085 - loff_t io_i_size; /* size of the file */
8089 -kdbm_pbiodesc(int argc, const char **argv, const char **envp,
8090 +kdbm_pbdelay(int argc, const char **argv, const char **envp,
8091 struct pt_regs *regs)
8093 - pb_io_desc_t pbio;
8095 + unsigned long verbose = 0;
8097 + struct list_head *curr, *next;
8103 + extern struct list_head pbd_delwrite_queue;
8107 return KDB_ARGCOUNT;
8110 - if ((diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs)) ||
8111 - (diag = kdb_getarea(pbio, addr)))
8113 - kdb_printf("pb_io_desc_t at 0x%lx\n", addr);
8114 - kdb_printf(" io_rdesc [ written 0x%lx count 0x%lx buf 0x%p error %d ]\n",
8115 - (unsigned long) pbio.io_rdesc.written,
8116 - (unsigned long) pbio.io_rdesc.count,
8117 - pbio.io_rdesc.buf, pbio.io_rdesc.error);
8119 - kdb_printf(" io_dir %d io_offset 0x%Lx io_iovec_nr 0x%d\n",
8120 - pbio.io_dir, pbio.io_offset, pbio.io_iovec_nr);
8122 + if ((diag = kdbgetularg(argv[1], &verbose))) {
8127 - kdb_printf(" io_iovec 0x%p io_iovec_offset 0x%Lx io_iovec_index 0x%d\n",
8128 - pbio.io_iovec, pbio.io_iovec_offset, pbio.io_iovec_index);
8130 + kdb_printf("index pb pin flushtime\n");
8133 - kdb_printf(" io_sshift 0x%d io_i_size 0x%Lx\n",
8134 - pbio.io_sshift, pbio.io_i_size);
8135 + list_for_each_safe(curr, next, &pbd_delwrite_queue) {
8136 + addr = (unsigned long)list_entry(curr, page_buf_t, pb_list);
8137 + if ((diag = kdb_getarea(bp, addr)))
8141 + print_pagebuf(&bp, addr);
8143 + kdb_printf("%4d 0x%lx %d %ld\n",
8145 + bp.pb_pin_count.counter,
8146 + bp.pb_flushtime - jiffies);
8150 + kdb_printf("pbd_delwrite_queue inaccessible (non-debug)\n");
8156 -kdbm_pbmap(int argc, const char **argv, const char **envp,
8157 +kdbm_iomap(int argc, const char **argv, const char **envp,
8158 struct pt_regs *regs)
8160 - page_buf_bmap_t pbm;
8161 + xfs_iomap_t iomap;
8168 @@ -1960,113 +2606,49 @@
8171 if ((diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs)) ||
8172 - (diag = kdb_getarea(pbm, addr)))
8173 + (diag = kdb_getarea(iomap, addr)))
8175 - kdb_printf("page_buf_bmap_t at 0x%lx\n", addr);
8176 - kdb_printf(" pbm_bn 0x%llx pbm_offset 0x%Lx pbm_delta 0x%lx pbm_bsize 0x%lx\n",
8177 - (long long) pbm.pbm_bn, pbm.pbm_offset,
8178 - (unsigned long) pbm.pbm_delta, (unsigned long) pbm.pbm_bsize);
8179 + kdb_printf("iomap_t at 0x%lx\n", addr);
8180 + kdb_printf(" iomap_bn 0x%llx iomap_offset 0x%Lx iomap_delta 0x%lx iomap_bsize 0x%lx\n",
8181 + (long long) iomap.iomap_bn, iomap.iomap_offset,
8182 + (unsigned long) iomap.iomap_delta, (unsigned long) iomap.iomap_bsize);
8184 - kdb_printf(" pbm_flags %s\n", map_flags(pbm.pbm_flags, pbm_flag_vals));
8185 + kdb_printf(" iomap_flags %s\n", map_flags(iomap.iomap_flags, iomap_flag_vals));
8190 #ifdef PAGEBUF_TRACE
8191 -# ifdef __PAGEBUF_TRACE__
8192 -# undef __PAGEBUF_TRACE__
8193 -# undef PB_DEFINE_TRACES
8194 -# undef PB_TRACE_START
8195 -# undef PB_TRACE_REC
8196 -# undef PB_TRACE_END
8198 -#include "pagebuf/page_buf_trace.h"
8200 -#define EV_SIZE (sizeof(event_names)/sizeof(char *))
8204 - unsigned long match,
8205 - char *event_match,
8206 - unsigned long long offset,
8209 - extern struct pagebuf_trace_buf pb_trace;
8210 - int i, total, end;
8211 - pagebuf_trace_t *trace;
8215 - end = pb_trace.start - 1;
8217 - end = PB_TRACE_BUFSIZE - 1;
8219 - if (match && (match < PB_TRACE_BUFSIZE)) {
8220 - for (i = pb_trace.start, total = 0; i != end; i = CIRC_INC(i)) {
8221 - trace = &pb_trace.buf[i];
8222 - if (trace->pb == 0)
8226 - total = total - match;
8227 - for (i = pb_trace.start; i != end && total; i = CIRC_INC(i)) {
8228 - trace = &pb_trace.buf[i];
8229 - if (trace->pb == 0)
8235 - i = pb_trace.start;
8236 - for ( ; i != end; i = CIRC_INC(i)) {
8237 - trace = &pb_trace.buf[i];
8240 - if ((trace->offset & ~mask) != offset)
8244 - if (trace->pb == 0)
8247 - if ((match != 0) && (trace->pb != match))
8250 - if ((trace->event < EV_SIZE-1) && event_names[trace->event]) {
8251 - event = event_names[trace->event];
8252 - } else if (trace->event == EV_SIZE-1) {
8253 - event = (char *)trace->misc;
8256 - sprintf(value, "%8d", trace->event);
8259 - if (event_match && strcmp(event, event_match)) {
8262 +static int pagebuf_trace_entry(ktrace_entry_t *ktep)
8264 + unsigned long long daddr;
8266 + daddr = ((unsigned long long)(unsigned long)ktep->val[8] << 32)
8267 + | ((unsigned long long)(unsigned long)ktep->val[9]);
8269 - kdb_printf("pb 0x%lx [%s] (hold %u lock %d) misc 0x%p",
8271 - trace->hold, trace->lock_value,
8273 - kdb_symbol_print((unsigned int)trace->ra, NULL,
8274 - KDB_SP_SPACEB|KDB_SP_PAREN|KDB_SP_NEWLINE);
8275 - kdb_printf(" offset 0x%Lx size 0x%x task 0x%p\n",
8276 - trace->offset, trace->size, trace->task);
8277 - kdb_printf(" flags: %s\n",
8278 - pb_flags(trace->flags));
8280 + kdb_printf("pb 0x%p [%s] (hold %lu lock %ld) data 0x%p",
8282 + (char *)ktep->val[1],
8283 + (unsigned long)ktep->val[3],
8284 + (long)ktep->val[4],
8286 + kdb_symbol_print((unsigned long)ktep->val[7], NULL,
8287 + KDB_SP_SPACEB|KDB_SP_PAREN|KDB_SP_NEWLINE);
8288 + kdb_printf(" offset 0x%llx size 0x%lx task 0x%p\n",
8289 + daddr, (long)ktep->val[10], ktep->val[5]);
8290 + kdb_printf(" flags: %s\n", pb_flags((int)(long)ktep->val[2]));
8296 kdbm_pbtrace_offset(int argc, const char **argv, const char **envp,
8297 struct pt_regs *regs)
8300 - unsigned long offset = 0;
8303 + unsigned long offset = 0;
8305 + ktrace_entry_t *ktep;
8306 + ktrace_snap_t kts;
8309 return KDB_ARGCOUNT;
8310 @@ -2078,13 +2660,23 @@
8314 - diag = kdbgetularg(argv[1], &mask);
8315 + diag = kdbgetularg(argv[1], &mask); /* sign extent mask */
8320 - pb_trace_core(0, NULL, (unsigned long long)offset,
8321 - (long long)mask); /* sign extent mask */
8322 + ktep = ktrace_first(pagebuf_trace_buf, &kts);
8323 + while (ktep != NULL) {
8324 + unsigned long long daddr;
8326 + daddr = ((unsigned long long)(unsigned long)ktep->val[8] << 32)
8327 + | ((unsigned long long)(unsigned long)ktep->val[9]);
8328 + if (offset && ((daddr & ~mask) != offset))
8330 + if (pagebuf_trace_entry(ktep))
8332 + ktep = ktrace_next(pagebuf_trace_buf, &kts);
8337 @@ -2092,10 +2684,12 @@
8338 kdbm_pbtrace(int argc, const char **argv, const char **envp,
8339 struct pt_regs *regs)
8341 - unsigned long addr = 0;
8342 - int diag, nextarg;
8344 - char *event_match = NULL;
8345 + unsigned long addr = 0;
8346 + int diag, nextarg;
8348 + char *event_match = NULL;
8349 + ktrace_entry_t *ktep;
8350 + ktrace_snap_t kts;
8353 return KDB_ARGCOUNT;
8354 @@ -2103,69 +2697,102 @@
8356 if (isupper(argv[1][0]) || islower(argv[1][0])) {
8357 event_match = (char *)argv[1];
8358 - printk("event match on \"%s\"\n", event_match);
8359 + kdb_printf("event match on \"%s\"\n", event_match);
8363 - diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
8364 + diag = kdbgetaddrarg(argc, argv,
8365 + &nextarg, &addr, &offset, NULL, regs);
8367 - printk("failed to parse %s as a number\n",
8369 + kdb_printf("non-numeric arg: %s\n", argv[1]);
8375 - pb_trace_core(addr, event_match, 0LL, 0LL);
8379 -#else /* PAGEBUF_TRACE */
8381 -kdbm_pbtrace(int argc, const char **argv, const char **envp,
8382 - struct pt_regs *regs)
8384 - kdb_printf("pagebuf tracing not compiled in\n");
8386 + ktep = ktrace_first(pagebuf_trace_buf, &kts);
8387 + while (ktep != NULL) {
8388 + if (addr && (ktep->val[0] != (void *)addr))
8390 + if (event_match && strcmp((char *)ktep->val[1], event_match))
8392 + if (pagebuf_trace_entry(ktep))
8394 + ktep = ktrace_next(pagebuf_trace_buf, &kts);
8398 -#endif /* PAGEBUF_TRACE */
8401 -static struct xif {
8404 int (*func)(int, const char **, const char **, struct pt_regs *);
8407 -} xfsidbg_funcs[] = {
8410 +static struct xif xfsidbg_funcs[] = {
8411 + { "bhv", kdbm_bhv, "<bhv>", "Dump bhv chain"},
8412 { "vn", kdbm_vn, "<vnode>", "Dump inode/vnode/trace"},
8413 { "vnode", kdbm_vnode, "<vnode>", "Dump vnode"},
8414 -#ifdef CONFIG_XFS_VNODE_TRACING
8415 + { "vfs", kdbm_vfs, "<vfs>", "Dump vfs"},
8416 +#ifdef XFS_VNODE_TRACE
8417 { "vntrace", kdbm_vntrace, "<vntrace>", "Dump vnode Trace"},
8418 - { "vntraceaddr", kdbm_vntraceaddr, "<vntrace>", "Dump vnode Trace by Address"},
8419 -#endif /* CONFIG_XFS_VNODE_TRACING */
8420 + { "vntraceaddr", kdbm_vntraceaddr, "<vntrace>",
8421 + "Dump vnode Trace by Address"},
8423 { "xagf", kdbm_xfs_xagf, "<agf>",
8424 "Dump XFS allocation group freespace" },
8425 { "xagi", kdbm_xfs_xagi, "<agi>",
8426 "Dump XFS allocation group inode" },
8427 { "xail", kdbm_xfs_xaildump, "<xfs_mount_t>",
8428 "Dump XFS AIL for a mountpoint" },
8429 +#ifdef XFS_ALLOC_TRACE
8430 + { "xalatrc", kdbm_xfs_xalatrace, "<count>",
8431 + "Dump XFS alloc count trace" },
8432 + { "xalbtrc", kdbm_xfs_xalbtrace, "<xfs_agblock_t>",
8433 + "Dump XFS alloc block trace" },
8434 + { "xalgtrc", kdbm_xfs_xalgtrace, "<xfs_agnumber_t>",
8435 + "Dump XFS alloc alloc-group trace" },
8438 { "xalloc", kdbm_xfs_xalloc, "<xfs_alloc_arg_t>",
8439 "Dump XFS allocation args structure" },
8441 +#ifdef XFS_ALLOC_TRACE
8442 { "xalmtrc", kdbm_xfs_xalmtrace, "<xfs_mount_t>",
8443 "Dump XFS alloc mount-point trace" },
8444 + { "xalttrc", kdbm_xfs_xalttrace, "<tag>",
8445 + "Dump XFS alloc trace by tag number" },
8447 + { "xarg", kdbm_xfs_xarg, "<value>",
8448 + "Input XFS argument for next function" },
8449 { "xattrcx", kdbm_xfs_xattrcontext, "<xfs_attr_list_context_t>",
8450 "Dump XFS attr_list context struct"},
8451 { "xattrlf", kdbm_xfs_xattrleaf, "<xfs_attr_leafblock_t>",
8452 "Dump XFS attribute leaf block"},
8453 { "xattrsf", kdbm_xfs_xattrsf, "<xfs_attr_shortform_t>",
8454 "Dump XFS attribute shortform"},
8455 +#ifdef XFS_ATTR_TRACE
8456 + { "xattrtr", kdbm_xfs_xattrtrace, "<count>",
8457 + "Dump XFS attribute attr_list() trace" },
8459 { "xbirec", kdbm_xfs_xbirec, "<xfs_bmbt_irec_t",
8460 "Dump XFS bmap incore record"},
8461 +#ifdef XFS_BLI_TRACE
8462 + { "xblitrc", kdbm_xfs_xblitrace, "<xfs_buf_log_item_t>",
8463 + "Dump XFS buf log item trace" },
8465 { "xbmalla", kdbm_xfs_xbmalla, "<xfs_bmalloca_t>",
8466 "Dump XFS bmalloc args structure"},
8467 - { "xbrec", kdbm_xfs_xbrec, "<xfs_bmbt_rec_64_t",
8468 +#ifdef XFS_BMAP_TRACE
8469 + { "xbmatrc", kdbm_xfs_xbmatrace, "<count>",
8470 + "Dump XFS bmap btree count trace" },
8471 + { "xbmitrc", kdbm_xfs_xbmitrace, "<xfs_inode_t>",
8472 + "Dump XFS bmap btree per-inode trace" },
8473 + { "xbmstrc", kdbm_xfs_xbmstrace, "<xfs_inode_t>",
8474 + "Dump XFS bmap btree inode trace" },
8476 + { "xbrec", kdbm_xfs_xbrec, "<xfs_bmbt_rec_64_t>",
8477 "Dump XFS bmap record"},
8478 { "xbroot", kdbm_xfs_xbroot, "<xfs_inode_t>",
8479 "Dump XFS bmap btree root (data)"},
8480 @@ -2175,12 +2802,29 @@
8481 "Dump XFS btree cursor"},
8482 { "xbuf", kdbm_xfs_xbuf, "<xfs_buf_t>",
8483 "Dump XFS data from a buffer"},
8484 +#ifdef XFS_BMAP_TRACE
8485 + { "xbxatrc", kdbm_xfs_xbxatrace, "<count>",
8486 + "Dump XFS bmap extent count trace" },
8487 + { "xbxitrc", kdbm_xfs_xbxitrace, "<xfs_inode_t>",
8488 + "Dump XFS bmap extent per-inode trace" },
8489 + { "xbxstrc", kdbm_xfs_xbxstrace, "<xfs_inode_t>",
8490 + "Dump XFS bmap extent inode trace" },
8492 { "xchash", kdbm_xfs_xchash, "<xfs_mount_t>",
8493 "Dump XFS cluster hash"},
8494 { "xchlist", kdbm_xfs_xchashlist, "<xfs_chashlist_t>",
8495 "Dump XFS cluster hash list"},
8496 + { "xchksum", kdbm_xfs_xchksum, "<addr>", "Dump chksum" },
8497 +#ifdef XFS_DIR2_TRACE
8498 + { "xd2atrc", kdbm_xfs_xdir2atrace, "<count>",
8499 + "Dump XFS directory v2 count trace" },
8501 { "xd2free", kdbm_xfs_xdir2free, "<xfs_dir2_free_t>",
8502 "Dump XFS directory v2 freemap"},
8503 +#ifdef XFS_DIR2_TRACE
8504 + { "xd2itrc", kdbm_xfs_xdir2itrace, "<xfs_inode_t>",
8505 + "Dump XFS directory v2 per-inode trace" },
8507 { "xdaargs", kdbm_xfs_xdaargs, "<xfs_da_args_t>",
8508 "Dump XFS dir/attr args structure"},
8509 { "xdabuf", kdbm_xfs_xdabuf, "<xfs_dabuf_t>",
8510 @@ -2197,12 +2841,20 @@
8511 "Dump XFS directory shortform"},
8512 { "xdir2sf", kdbm_xfs_xdir2sf, "<xfs_dir2_sf_t>",
8513 "Dump XFS directory v2 shortform"},
8514 +#ifdef XFS_DIR_TRACE
8515 + { "xdirtrc", kdbm_xfs_xdirtrace, "<count>",
8516 + "Dump XFS directory getdents() trace" },
8518 { "xdiskdq", kdbm_xfs_xqm_diskdq, "<xfs_disk_dquot_t>",
8519 "Dump XFS ondisk dquot (quota) struct"},
8520 { "xdqatt", kdbm_xfs_xqm_dqattached_inos, "<xfs_mount_t>",
8521 "All incore inodes with dquots"},
8522 { "xdqinfo", kdbm_xfs_xqm_tpdqinfo, "<xfs_trans_t>",
8523 "Dump dqinfo structure of a trans"},
8524 +#ifdef XFS_DQUOT_TRACE
8525 + { "xdqtrace",kdbm_xfs_xqm_dqtrace, "<xfs_dquot_t>",
8526 + "Dump trace of a given dquot" },
8528 { "xdquot", kdbm_xfs_xqm_dquot, "<xfs_dquot_t>",
8529 "Dump XFS dquot (quota) structure"},
8530 { "xexlist", kdbm_xfs_xexlist, "<xfs_inode_t>",
8531 @@ -2215,12 +2867,26 @@
8532 "Dump All XFS in-core logs"},
8533 { "xiclog", kdbm_xfs_xiclog, "<xlog_in_core_t>",
8534 "Dump XFS in-core log"},
8535 +#ifdef XFS_LOG_TRACE
8536 + { "xictrc", kdbm_xfs_xiclogtrace, "<xlog_in_core_t>",
8537 + "Dump XFS in-core log trace" },
8539 { "xihash", kdbm_xfs_xihash, "<xfs_mount_t>",
8540 "Dump XFS inode hash statistics"},
8541 +#ifdef XFS_ILOCK_TRACE
8542 + { "xilocktrc",kdbm_xfs_xilock_trace, "<xfs_inode_t>",
8543 + "Dump XFS ilock trace" },
8544 + { "xailcktrc",kdbm_xfs_xailock_trace,"<count>",
8545 + "Dump XFS global ilock trace" },
8547 { "xinodes", kdbm_xfs_xinodes, "<xfs_mount_t>",
8548 "Dump XFS inodes per mount"},
8549 { "xquiesce",kdbm_xfs_xinodes_quiesce, "<xfs_mount_t>",
8550 "Dump non-quiesced XFS inodes per mount"},
8551 +#ifdef XFS_LOG_TRACE
8552 + { "xl_grtr", kdbm_xfs_xlog_granttrace, "<xlog_t>",
8553 + "Dump XFS log grant trace" },
8555 { "xl_rcit", kdbm_xfs_xlog_ritem, "<xlog_recover_item_t>",
8556 "Dump XFS recovery item"},
8557 { "xl_rctr", kdbm_xfs_xlog_rtrans, "<xlog_recover_t>",
8558 @@ -2255,6 +2921,10 @@
8559 #endif /* CONFIG_XFS_QUOTA */
8560 { "xqmplist",kdbm_xfs_xqm_mplist, "<xfs_mount_t>",
8561 "Dump XFS all dquots of a f/s"},
8562 +#ifdef XFS_RW_TRACE
8563 + { "xrwtrc", kdbm_xfs_xrwtrace, "<xfs_inode_t>",
8564 + "Dump XFS inode read/write trace" },
8566 { "xsb", kdbm_xfs_xsb, "<xfs_sb_t> <cnv>",
8567 "Dump XFS superblock"},
8568 { "xtp", kdbm_xfs_xtp, "<xfs_trans_t>",
8569 @@ -2264,6 +2934,18 @@
8573 +static struct xif pb_funcs[] = {
8574 + { "pb", kdbm_pb, "<vaddr>", "Display page_buf_t" },
8575 + { "pbflags", kdbm_pb_flags, "<flags>", "Display page_buf flags" },
8576 + { "iomapap", kdbm_iomap, "<iomap_t *>", "Display IOmap" },
8577 + { "pbdelay", kdbm_pbdelay, "0|1", "Display delwri pagebufs" },
8578 +#ifdef PAGEBUF_TRACE
8579 + { "pbtrace", kdbm_pbtrace, "<vaddr>|<count>", "page_buf_t trace" },
8580 + { "pboffset",kdbm_pbtrace_offset, "<daddr> [<mask>]","page_buf_t trace" },
8586 __init xfsidbg_init(void)
8588 @@ -2271,20 +2953,8 @@
8590 for (p = xfsidbg_funcs; p->name; p++)
8591 kdb_register(p->name, p->func, p->args, p->help, 0);
8593 - kdb_register("pb", kdbm_pb, "<vaddr>", "Display page_buf_t", 0);
8594 - kdb_register("pbflags", kdbm_pb_flags, "<flags>",
8595 - "Display page buf flags", 0);
8596 - kdb_register("pbiodesc", kdbm_pbiodesc, "<pb_io_desc_t *>",
8597 - "Display I/O Descriptor", 0);
8598 - kdb_register("pbmap", kdbm_pbmap, "<page_buf_bmap_t *>",
8599 - "Display Bmap", 0);
8600 - kdb_register("pbtrace", kdbm_pbtrace, "<vaddr>|<count>",
8601 - "page_buf_t trace", 0);
8602 -#ifdef PAGEBUF_TRACE
8603 - kdb_register("pboffset", kdbm_pbtrace_offset, "<addr> [<mask>]",
8604 - "page_buf_t trace", 0);
8606 + for (p = pb_funcs; p->name; p++)
8607 + kdb_register(p->name, p->func, p->args, p->help, 0);
8611 @@ -2295,16 +2965,8 @@
8613 for (p = xfsidbg_funcs; p->name; p++)
8614 kdb_unregister(p->name);
8616 - kdb_unregister("pb");
8617 - kdb_unregister("pbflags");
8618 - kdb_unregister("pbmap");
8619 - kdb_unregister("pbiodesc");
8620 - kdb_unregister("pbtrace");
8621 -#ifdef PAGEBUF_TRACE
8622 - kdb_unregister("pboffset");
8625 + for (p = pb_funcs; p->name; p++)
8626 + kdb_unregister(p->name);
8630 @@ -2315,19 +2977,35 @@
8631 "start_bno", "near_bno", "this_bno"
8634 +static int xargument = 0;
8637 * Prototypes for static functions.
8640 +#ifdef XFS_ALLOC_TRACE
8641 static int xfs_alloc_trace_entry(ktrace_entry_t *ktep);
8643 +#ifdef XFS_ATTR_TRACE
8644 +static int xfs_attr_trace_entry(ktrace_entry_t *ktep);
8646 +#ifdef XFS_BMAP_TRACE
8647 +static int xfs_bmap_trace_entry(ktrace_entry_t *ktep);
8649 +#ifdef XFS_BMAP_TRACE
8650 +static int xfs_bmbt_trace_entry(ktrace_entry_t *ktep);
8652 static void xfs_broot(xfs_inode_t *ip, xfs_ifork_t *f);
8653 static void xfs_btalloc(xfs_alloc_block_t *bt, int bsz);
8654 static void xfs_btbmap(xfs_bmbt_block_t *bt, int bsz);
8655 static void xfs_btino(xfs_inobt_block_t *bt, int bsz);
8656 static void xfs_buf_item_print(xfs_buf_log_item_t *blip, int summary);
8657 static void xfs_dastate_path(xfs_da_state_path_t *p);
8658 +#ifdef XFS_DIR_TRACE
8659 +static int xfs_dir_trace_entry(ktrace_entry_t *ktep);
8661 +#ifdef XFS_DIR2_TRACE
8662 +static int xfs_dir2_trace_entry(ktrace_entry_t *ktep);
8664 static void xfs_dir2data(void *addr, int size);
8665 static void xfs_dir2leaf(xfs_dir2_leaf_t *leaf, int size);
8666 static void xfs_dquot_item_print(xfs_dq_logitem_t *lip, int summary);
8667 @@ -2345,6 +3023,10 @@
8668 static void xfs_prdinode(xfs_dinode_t *di, int coreonly, int convert);
8669 static void xfs_prdinode_core(xfs_dinode_core_t *dip, int convert);
8670 static void xfs_qoff_item_print(xfs_qoff_logitem_t *lip, int summary);
8671 +#ifdef XFS_RW_TRACE
8672 +static void xfs_rw_enter_trace_entry(ktrace_entry_t *ktep);
8673 +static int xfs_rw_trace_entry(ktrace_entry_t *ktep);
8675 static void xfs_xexlist_fork(xfs_inode_t *ip, int whichfork);
8676 static void xfs_xnode_fork(char *name, xfs_ifork_t *f);
8678 @@ -2352,7 +3034,7 @@
8683 +#ifdef XFS_ALLOC_TRACE
8685 * Print xfs alloc trace buffer entry.
8687 @@ -2378,24 +3060,24 @@
8689 switch ((long)ktep->val[0] & 0xffffL) {
8690 case XFS_ALLOC_KTRACE_ALLOC:
8691 - kdb_printf("alloc %s[%s %d] mp 0x%p\n",
8692 + kdb_printf("alloc %s[%s %ld] mp 0x%p\n",
8693 (char *)ktep->val[1],
8694 ktep->val[2] ? (char *)ktep->val[2] : "",
8695 - (__psint_t)ktep->val[0] >> 16,
8696 + (long)ktep->val[0] >> 16,
8697 (xfs_mount_t *)ktep->val[3]);
8699 - "agno %d agbno %d minlen %d maxlen %d mod %d prod %d minleft %d\n",
8700 - (__psunsigned_t)ktep->val[4],
8701 - (__psunsigned_t)ktep->val[5],
8702 - (__psunsigned_t)ktep->val[6],
8703 - (__psunsigned_t)ktep->val[7],
8704 - (__psunsigned_t)ktep->val[8],
8705 - (__psunsigned_t)ktep->val[9],
8706 - (__psunsigned_t)ktep->val[10]);
8707 - kdb_printf("total %d alignment %d len %d type %s otype %s\n",
8708 - (__psunsigned_t)ktep->val[11],
8709 - (__psunsigned_t)ktep->val[12],
8710 - (__psunsigned_t)ktep->val[13],
8711 + "agno %ld agbno %ld minlen %ld maxlen %ld mod %ld prod %ld minleft %ld\n",
8712 + (long)ktep->val[4],
8713 + (long)ktep->val[5],
8714 + (long)ktep->val[6],
8715 + (long)ktep->val[7],
8716 + (long)ktep->val[8],
8717 + (long)ktep->val[9],
8718 + (long)ktep->val[10]);
8719 + kdb_printf("total %ld alignment %ld len %ld type %s otype %s\n",
8720 + (long)ktep->val[11],
8721 + (long)ktep->val[12],
8722 + (long)ktep->val[13],
8723 xfs_alloctype[((__psint_t)ktep->val[14]) >> 16],
8724 xfs_alloctype[((__psint_t)ktep->val[14]) & 0xffff]);
8725 kdb_printf("wasdel %d wasfromfl %d isfl %d userdata %d\n",
8726 @@ -2405,76 +3087,76 @@
8727 ((__psint_t)ktep->val[15] & (1 << 0)) != 0);
8729 case XFS_ALLOC_KTRACE_FREE:
8730 - kdb_printf("free %s[%s %d] mp 0x%p\n",
8731 + kdb_printf("free %s[%s %ld] mp 0x%p\n",
8732 (char *)ktep->val[1],
8733 ktep->val[2] ? (char *)ktep->val[2] : "",
8734 - (__psint_t)ktep->val[0] >> 16,
8735 + (long)ktep->val[0] >> 16,
8736 (xfs_mount_t *)ktep->val[3]);
8737 - kdb_printf("agno %d agbno %d len %d isfl %d\n",
8738 - (__psunsigned_t)ktep->val[4],
8739 - (__psunsigned_t)ktep->val[5],
8740 - (__psunsigned_t)ktep->val[6],
8741 - (__psint_t)ktep->val[7]);
8742 + kdb_printf("agno %ld agbno %ld len %ld isfl %d\n",
8743 + (long)ktep->val[4],
8744 + (long)ktep->val[5],
8745 + (long)ktep->val[6],
8746 + (__psint_t)ktep->val[7] != 0);
8748 case XFS_ALLOC_KTRACE_MODAGF:
8749 - kdb_printf("modagf %s[%s %d] mp 0x%p\n",
8750 + kdb_printf("modagf %s[%s %ld] mp 0x%p\n",
8751 (char *)ktep->val[1],
8752 ktep->val[2] ? (char *)ktep->val[2] : "",
8753 - (__psint_t)ktep->val[0] >> 16,
8754 + (long)ktep->val[0] >> 16,
8755 (xfs_mount_t *)ktep->val[3]);
8756 printflags((__psint_t)ktep->val[4], modagf_flags, "modified");
8757 - kdb_printf("seqno %d length %d roots b %d c %d\n",
8758 - (__psunsigned_t)ktep->val[5],
8759 - (__psunsigned_t)ktep->val[6],
8760 - (__psunsigned_t)ktep->val[7],
8761 - (__psunsigned_t)ktep->val[8]);
8762 - kdb_printf("levels b %d c %d flfirst %d fllast %d flcount %d\n",
8763 - (__psunsigned_t)ktep->val[9],
8764 - (__psunsigned_t)ktep->val[10],
8765 - (__psunsigned_t)ktep->val[11],
8766 - (__psunsigned_t)ktep->val[12],
8767 - (__psunsigned_t)ktep->val[13]);
8768 - kdb_printf("freeblks %d longest %d\n",
8769 - (__psunsigned_t)ktep->val[14],
8770 - (__psunsigned_t)ktep->val[15]);
8771 + kdb_printf("seqno %lu length %lu roots b %lu c %lu\n",
8772 + (unsigned long)ktep->val[5],
8773 + (unsigned long)ktep->val[6],
8774 + (unsigned long)ktep->val[7],
8775 + (unsigned long)ktep->val[8]);
8776 + kdb_printf("levels b %lu c %lu flfirst %lu fllast %lu flcount %lu\n",
8777 + (unsigned long)ktep->val[9],
8778 + (unsigned long)ktep->val[10],
8779 + (unsigned long)ktep->val[11],
8780 + (unsigned long)ktep->val[12],
8781 + (unsigned long)ktep->val[13]);
8782 + kdb_printf("freeblks %lu longest %lu\n",
8783 + (unsigned long)ktep->val[14],
8784 + (unsigned long)ktep->val[15]);
8787 case XFS_ALLOC_KTRACE_UNBUSY:
8788 - kdb_printf("unbusy %s [%s %d] mp 0x%p\n",
8789 + kdb_printf("unbusy %s [%s %ld] mp 0x%p\n",
8790 (char *)ktep->val[1],
8791 ktep->val[2] ? (char *)ktep->val[2] : "",
8792 - (__psint_t)ktep->val[0] >> 16,
8793 + (long)ktep->val[0] >> 16,
8794 (xfs_mount_t *)ktep->val[3]);
8795 - kdb_printf(" agno %d slot %d tp 0x%x\n",
8796 - (__psunsigned_t)ktep->val[4],
8797 - (__psunsigned_t)ktep->val[7],
8798 - (__psunsigned_t)ktep->val[8]);
8799 + kdb_printf(" agno %lu slot %lu tp 0x%p\n",
8800 + (unsigned long)ktep->val[4],
8801 + (unsigned long)ktep->val[7],
8802 + (xfs_trans_t *)ktep->val[8]);
8804 case XFS_ALLOC_KTRACE_BUSY:
8805 - kdb_printf("busy %s [%s %d] mp 0x%p\n",
8806 + kdb_printf("busy %s [%s %ld] mp 0x%p\n",
8807 (char *)ktep->val[1],
8808 ktep->val[2] ? (char *)ktep->val[2] : "",
8809 - (__psint_t)ktep->val[0] >> 16,
8810 + (long)ktep->val[0] >> 16,
8811 (xfs_mount_t *)ktep->val[3]);
8812 - kdb_printf(" agno %d agbno %d len %d slot %d tp 0x%x\n",
8813 - (__psunsigned_t)ktep->val[4],
8814 - (__psunsigned_t)ktep->val[5],
8815 - (__psunsigned_t)ktep->val[6],
8816 - (__psunsigned_t)ktep->val[7],
8817 - (__psunsigned_t)ktep->val[8]);
8818 + kdb_printf(" agno %lu agbno %lu len %lu slot %lu tp 0x%p\n",
8819 + (unsigned long)ktep->val[4],
8820 + (unsigned long)ktep->val[5],
8821 + (unsigned long)ktep->val[6],
8822 + (unsigned long)ktep->val[7],
8823 + (xfs_trans_t *)ktep->val[8]);
8825 case XFS_ALLOC_KTRACE_BUSYSEARCH:
8826 - kdb_printf("busy-search %s [%s %d] mp 0x%p\n",
8827 + kdb_printf("busy-search %s [%s %ld] mp 0x%p\n",
8828 (char *)ktep->val[1],
8829 ktep->val[2] ? (char *)ktep->val[2] : "",
8830 - (__psint_t)ktep->val[0] >> 16,
8831 + (long)ktep->val[0] >> 16,
8832 (xfs_mount_t *)ktep->val[3]);
8833 - kdb_printf(" agno %d agbno %d len %d slot %d tp 0x%x\n",
8834 - (__psunsigned_t)ktep->val[4],
8835 - (__psunsigned_t)ktep->val[5],
8836 - (__psunsigned_t)ktep->val[6],
8837 - (__psunsigned_t)ktep->val[7],
8838 - (__psunsigned_t)ktep->val[8]);
8839 + kdb_printf(" agno %ld agbno %ld len %ld slot %ld tp 0x%p\n",
8840 + (unsigned long)ktep->val[4],
8841 + (unsigned long)ktep->val[5],
8842 + (unsigned long)ktep->val[6],
8843 + (unsigned long)ktep->val[7],
8844 + (xfs_trans_t *)ktep->val[8]);
8847 kdb_printf("unknown alloc trace record\n");
8848 @@ -2482,7 +3164,242 @@
8853 +#endif /* XFS_ALLOC_TRACE */
8855 +#ifdef XFS_ATTR_TRACE
8857 + * Print an attribute trace buffer entry.
8860 +xfs_attr_trace_entry(ktrace_entry_t *ktep)
8862 + static char *attr_arg_flags[] = {
8863 + "DONTFOLLOW", /* 0x0001 */
8864 + "ROOT", /* 0x0002 */
8865 + "TRUSTED", /* 0x0004 */
8867 + "CREATE", /* 0x0010 */
8868 + "REPLACE", /* 0x0020 */
8871 + "SYSTEM", /* 0x0100 */
8875 + "KERNOTIME", /* 0x1000 */
8876 + "KERNOVAL", /* 0x2000 */
8877 + "KERNAMELS", /* 0x4000 */
8878 + "KERNFULLS", /* 0x8000 */
8882 + if (!ktep->val[0])
8885 + qprintf("-- %s: cursor h/b/o 0x%lx/0x%lx/%lu, dupcnt %lu, dp 0x%p\n",
8886 + (char *)ktep->val[1],
8887 + (unsigned long)ktep->val[3],
8888 + (unsigned long)ktep->val[4],
8889 + (unsigned long)ktep->val[5],
8890 + (unsigned long)ktep->val[11],
8891 + (xfs_inode_t *)ktep->val[2]);
8892 + qprintf(" alist 0x%p, size %lu, count %lu, firstu %lu, Llen %lu",
8893 + (attrlist_t *)ktep->val[6],
8894 + (unsigned long)ktep->val[7],
8895 + (unsigned long)ktep->val[8],
8896 + (unsigned long)ktep->val[9],
8897 + (unsigned long)ktep->val[10]);
8898 + printflags((__psunsigned_t)(ktep->val[12]), attr_arg_flags, ", flags");
8901 + switch ((__psint_t)ktep->val[0]) {
8902 + case XFS_ATTR_KTRACE_L_C:
8904 + case XFS_ATTR_KTRACE_L_CN:
8905 + qprintf(" node: count %lu, 1st hash 0x%lx, last hash 0x%lx\n",
8906 + (unsigned long)ktep->val[13],
8907 + (unsigned long)ktep->val[14],
8908 + (unsigned long)ktep->val[15]);
8910 + case XFS_ATTR_KTRACE_L_CB:
8911 + qprintf(" btree: hash 0x%lx, blkno 0x%lx\n",
8912 + (unsigned long)ktep->val[13],
8913 + (unsigned long)ktep->val[14]);
8915 + case XFS_ATTR_KTRACE_L_CL:
8916 + qprintf(" leaf: count %ld, 1st hash 0x%lx, last hash 0x%lx\n",
8917 + (unsigned long)ktep->val[13],
8918 + (unsigned long)ktep->val[14],
8919 + (unsigned long)ktep->val[15]);
8922 + qprintf(" unknown attr trace record format\n");
8927 +#endif /* XFS_ATTR_TRACE */
8929 +#ifdef XFS_BMAP_TRACE
8931 + * Print xfs bmap extent trace buffer entry.
8934 +xfs_bmap_trace_entry(ktrace_entry_t *ktep)
8943 + static char *ops[] = { "del", "ins", "pre", "post" };
8944 + xfs_bmbt_rec_32_t r;
8947 + opcode = ((__psint_t)ktep->val[0]) & 0xffff;
8950 + whichfork = ((__psint_t)ktep->val[0]) >> 16;
8951 + ip = (xfs_inode_t *)ktep->val[3];
8952 + ino = ((xfs_ino_t)(unsigned long)ktep->val[6] << 32) |
8953 + ((xfs_ino_t)(unsigned long)ktep->val[7]);
8954 + qprintf("%s %s:%s ip %p ino %s %cf\n",
8955 + ops[opcode - 1], (char *)ktep->val[1],
8956 + (char *)ktep->val[2], ip, xfs_fmtino(ino, ip->i_mount),
8958 + r.l0 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[8];
8959 + r.l1 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[9];
8960 + r.l2 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[10];
8961 + r.l3 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[11];
8962 + xfs_convert_extent(&r, &o, &b, &c, &flag);
8963 + qprintf(" idx %ld offset %lld block %s",
8964 + (long)ktep->val[4], o,
8965 + xfs_fmtfsblock((xfs_fsblock_t)b, ip->i_mount));
8966 + qprintf(" count %lld flag %d\n", c, flag);
8967 + if ((__psint_t)ktep->val[5] != 2)
8969 + r.l0 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[12];
8970 + r.l1 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[13];
8971 + r.l2 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[14];
8972 + r.l3 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[15];
8973 + xfs_convert_extent(&r, &o, &b, &c, &flag);
8974 + qprintf(" offset %lld block %s", o,
8975 + xfs_fmtfsblock((xfs_fsblock_t)b, ip->i_mount));
8976 + qprintf(" count %lld flag %d\n", c, flag);
8981 + * Print xfs bmap btree trace buffer entry.
8984 +xfs_bmbt_trace_entry(
8985 + ktrace_entry_t *ktep)
8988 + xfs_bmbt_rec_32_t r;
8989 + xfs_bmbt_irec_t s;
8993 + type = (__psint_t)ktep->val[0] & 0xff;
8996 + whichfork = ((__psint_t)ktep->val[0] >> 8) & 0xff;
8997 + line = ((__psint_t)ktep->val[0] >> 16) & 0xffff;
8998 + qprintf("%s[%s@%d] ip 0x%p %cf cur 0x%p\n",
8999 + (char *)ktep->val[1],
9000 + (char *)ktep->val[2],
9002 + (xfs_inode_t *)ktep->val[3],
9004 + (xfs_btree_cur_t *)ktep->val[4]);
9006 + case XFS_BMBT_KTRACE_ARGBI:
9007 + qprintf(" buf 0x%p i %ld\n",
9008 + (xfs_buf_t *)ktep->val[5],
9009 + (long)ktep->val[6]);
9011 + case XFS_BMBT_KTRACE_ARGBII:
9012 + qprintf(" buf 0x%p i0 %ld i1 %ld\n",
9013 + (xfs_buf_t *)ktep->val[5],
9014 + (long)ktep->val[6],
9015 + (long)ktep->val[7]);
9017 + case XFS_BMBT_KTRACE_ARGFFFI:
9018 + qprintf(" o 0x%x%08x b 0x%x%08x i 0x%x%08x j %ld\n",
9019 + (unsigned int)(long)ktep->val[5],
9020 + (unsigned int)(long)ktep->val[6],
9021 + (unsigned int)(long)ktep->val[7],
9022 + (unsigned int)(long)ktep->val[8],
9023 + (unsigned int)(long)ktep->val[9],
9024 + (unsigned int)(long)ktep->val[10],
9025 + (long)ktep->val[11]);
9027 + case XFS_BMBT_KTRACE_ARGI:
9028 + qprintf(" i 0x%lx\n",
9029 + (long)ktep->val[5]);
9031 + case XFS_BMBT_KTRACE_ARGIFK:
9032 + qprintf(" i 0x%lx f 0x%x%08x o 0x%x%08x\n",
9033 + (long)ktep->val[5],
9034 + (unsigned int)(long)ktep->val[6],
9035 + (unsigned int)(long)ktep->val[7],
9036 + (unsigned int)(long)ktep->val[8],
9037 + (unsigned int)(long)ktep->val[9]);
9039 + case XFS_BMBT_KTRACE_ARGIFR:
9040 + qprintf(" i 0x%lx f 0x%x%08x ",
9041 + (long)ktep->val[5],
9042 + (unsigned int)(long)ktep->val[6],
9043 + (unsigned int)(long)ktep->val[7]);
9044 + s.br_startoff = (xfs_fileoff_t)
9045 + (((xfs_dfiloff_t)(unsigned long)ktep->val[8] << 32) |
9046 + (xfs_dfiloff_t)(unsigned long)ktep->val[9]);
9047 + s.br_startblock = (xfs_fsblock_t)
9048 + (((xfs_dfsbno_t)(unsigned long)ktep->val[10] << 32) |
9049 + (xfs_dfsbno_t)(unsigned long)ktep->val[11]);
9050 + s.br_blockcount = (xfs_filblks_t)
9051 + (((xfs_dfilblks_t)(unsigned long)ktep->val[12] << 32) |
9052 + (xfs_dfilblks_t)(unsigned long)ktep->val[13]);
9053 + xfsidbg_xbirec(&s);
9055 + case XFS_BMBT_KTRACE_ARGIK:
9056 + qprintf(" i 0x%lx o 0x%x%08x\n",
9057 + (long)ktep->val[5],
9058 + (unsigned int)(long)ktep->val[6],
9059 + (unsigned int)(long)ktep->val[7]);
9061 + case XFS_BMBT_KTRACE_CUR:
9062 + qprintf(" nlevels %ld flags %ld allocated %ld ",
9063 + ((long)ktep->val[5] >> 24) & 0xff,
9064 + ((long)ktep->val[5] >> 16) & 0xff,
9065 + (long)ktep->val[5] & 0xffff);
9066 + r.l0 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[6];
9067 + r.l1 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[7];
9068 + r.l2 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[8];
9069 + r.l3 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[9];
9070 + xfsidbg_xbrec((xfs_bmbt_rec_64_t *)&r);
9071 + qprintf(" bufs 0x%p 0x%p 0x%p 0x%p ",
9072 + (xfs_buf_t *)ktep->val[10],
9073 + (xfs_buf_t *)ktep->val[11],
9074 + (xfs_buf_t *)ktep->val[12],
9075 + (xfs_buf_t *)ktep->val[13]);
9076 + qprintf("ptrs %ld %ld %ld %ld\n",
9077 + (long)ktep->val[14] >> 16,
9078 + (long)ktep->val[14] & 0xffff,
9079 + (long)ktep->val[15] >> 16,
9080 + (long)ktep->val[15] & 0xffff);
9083 + qprintf("unknown bmbt trace record\n");
9091 * Print an xfs in-inode bmap btree root.
9092 @@ -2603,8 +3520,11 @@
9095 kdb_printf("magic 0x%x level %d numrecs %d leftsib 0x%x rightsib 0x%x\n",
9096 - INT_GET(bt->bb_magic, ARCH_CONVERT), INT_GET(bt->bb_level, ARCH_CONVERT), INT_GET(bt->bb_numrecs, ARCH_CONVERT),
9097 - INT_GET(bt->bb_leftsib, ARCH_CONVERT), INT_GET(bt->bb_rightsib, ARCH_CONVERT));
9098 + INT_GET(bt->bb_magic, ARCH_CONVERT),
9099 + INT_GET(bt->bb_level, ARCH_CONVERT),
9100 + INT_GET(bt->bb_numrecs, ARCH_CONVERT),
9101 + INT_GET(bt->bb_leftsib, ARCH_CONVERT),
9102 + INT_GET(bt->bb_rightsib, ARCH_CONVERT));
9103 if (INT_ISZERO(bt->bb_level, ARCH_CONVERT)) {
9105 for (i = 1; i <= INT_GET(bt->bb_numrecs, ARCH_CONVERT); i++) {
9106 @@ -2612,7 +3532,8 @@
9108 r = XFS_BTREE_REC_ADDR(bsz, xfs_inobt, bt, i, 0);
9109 kdb_printf("rec %d startino 0x%x freecount %d, free %Lx\n",
9110 - i, INT_GET(r->ir_startino, ARCH_CONVERT), INT_GET(r->ir_freecount, ARCH_CONVERT),
9111 + i, INT_GET(r->ir_startino, ARCH_CONVERT),
9112 + INT_GET(r->ir_freecount, ARCH_CONVERT),
9113 INT_GET(r->ir_free, ARCH_CONVERT));
9116 @@ -2626,7 +3547,8 @@
9117 k = XFS_BTREE_KEY_ADDR(bsz, xfs_inobt, bt, i, mxr);
9118 p = XFS_BTREE_PTR_ADDR(bsz, xfs_inobt, bt, i, mxr);
9119 kdb_printf("key %d startino 0x%x ptr 0x%x\n",
9120 - i, INT_GET(k->ir_startino, ARCH_CONVERT), INT_GET(*p, ARCH_CONVERT));
9121 + i, INT_GET(k->ir_startino, ARCH_CONVERT),
9122 + INT_GET(*p, ARCH_CONVERT));
9126 @@ -2678,30 +3600,199 @@
9130 +#ifdef XFS_BMAP_TRACE
9132 + * Convert an external extent descriptor to internal form.
9135 +xfs_convert_extent(xfs_bmbt_rec_32_t *rp, xfs_dfiloff_t *op, xfs_dfsbno_t *sp,
9136 + xfs_dfilblks_t *cp, int *fp)
9143 + flag = (((xfs_dfiloff_t)rp->l0) >> 31) & 1;
9144 + o = ((((xfs_dfiloff_t)rp->l0) & 0x7fffffff) << 23) |
9145 + (((xfs_dfiloff_t)rp->l1) >> 9);
9146 + s = (((xfs_dfsbno_t)(rp->l1 & 0x000001ff)) << 43) |
9147 + (((xfs_dfsbno_t)rp->l2) << 11) |
9148 + (((xfs_dfsbno_t)rp->l3) >> 21);
9149 + c = (xfs_dfilblks_t)(rp->l3 & 0x001fffff);
9157 +#ifdef XFS_RW_TRACE
9159 + * Print itrunc entry trace.
9162 +xfs_ctrunc_trace_entry(ktrace_entry_t *ktep)
9164 + qprintf("ip 0x%p cpu %ld\n",
9165 + (xfs_inode_t *)(unsigned long)ktep->val[1], (long)ktep->val[2]);
9170 + * Print an xfs_da_state_path structure.
9173 +xfs_dastate_path(xfs_da_state_path_t *p)
9177 + kdb_printf("active %d\n", p->active);
9178 + for (i = 0; i < XFS_DA_NODE_MAXDEPTH; i++) {
9179 + kdb_printf(" blk %d bp 0x%p blkno 0x%x",
9180 + i, p->blk[i].bp, p->blk[i].blkno);
9181 + kdb_printf(" index %d hashval 0x%x ",
9182 + p->blk[i].index, (uint_t)p->blk[i].hashval);
9183 + switch(p->blk[i].magic) {
9184 + case XFS_DA_NODE_MAGIC: kdb_printf("NODE\n"); break;
9185 + case XFS_DIR_LEAF_MAGIC: kdb_printf("DIR\n"); break;
9186 + case XFS_ATTR_LEAF_MAGIC: kdb_printf("ATTR\n"); break;
9187 + case XFS_DIR2_LEAFN_MAGIC: kdb_printf("DIR2\n"); break;
9188 + default: kdb_printf("type ?\n"); break;
9193 +#ifdef XFS_DIR_TRACE
9195 + * Print a xfs directory trace buffer entry.
9198 +xfs_dir_trace_entry(ktrace_entry_t *ktep)
9204 + if (!ktep->val[0] || !ktep->val[1])
9207 + mp = (xfs_mount_t *)ktep->val[3];
9208 + cookie = (__psunsigned_t)ktep->val[4];
9210 + cookie |= (__psunsigned_t)ktep->val[5];
9211 + qprintf("%s -- dp=0x%p b/e/h=%ld/%ld/0x%08lx resid=0x%lx ",
9212 + (char *)ktep->val[1],
9213 + (xfs_inode_t *)ktep->val[2],
9214 + (long)XFS_DA_COOKIE_BNO(mp, cookie),
9215 + (long)XFS_DA_COOKIE_ENTRY(mp, cookie),
9216 + (unsigned long)XFS_DA_COOKIE_HASH(mp, cookie),
9217 + (long)ktep->val[6]);
9219 + switch ((__psint_t)ktep->val[0]) {
9220 + case XFS_DIR_KTRACE_G_DU:
9222 + case XFS_DIR_KTRACE_G_DUB:
9223 + qprintf("bno=%ld", (long)ktep->val[7]);
9225 + case XFS_DIR_KTRACE_G_DUN:
9226 + qprintf("forw=%ld, cnt=%ld, 0x%08lx - 0x%08lx",
9227 + (long)ktep->val[7],
9228 + (long)ktep->val[8],
9229 + (unsigned long)ktep->val[9],
9230 + (unsigned long)ktep->val[10]);
9232 + case XFS_DIR_KTRACE_G_DUL:
9233 + qprintf("forw=%ld, cnt=%ld, 0x%08lx - 0x%08lx",
9234 + (long)ktep->val[7],
9235 + (long)ktep->val[8],
9236 + (unsigned long)ktep->val[9],
9237 + (unsigned long)ktep->val[10]);
9239 + case XFS_DIR_KTRACE_G_DUE:
9240 + qprintf("entry hashval 0x%08lx", (unsigned long)ktep->val[7]);
9242 + case XFS_DIR_KTRACE_G_DUC:
9243 + cookie = (__psunsigned_t)ktep->val[7];
9245 + cookie |= (__psunsigned_t)ktep->val[8];
9246 + hash = XFS_DA_COOKIE_HASH(mp, cookie);
9247 + qprintf("b/e/h=%ld/%ld/0x%08x",
9248 + (long)XFS_DA_COOKIE_BNO(mp, cookie),
9249 + (long)XFS_DA_COOKIE_ENTRY(mp, cookie),
9253 + qprintf("unknown dir trace record format");
9260 +#ifdef XFS_DIR2_TRACE
9262 - * Print an xfs_da_state_path structure.
9263 + * Print a xfs v2 directory trace buffer entry.
9266 -xfs_dastate_path(xfs_da_state_path_t *p)
9268 +xfs_dir2_trace_entry(ktrace_entry_t *ktep)
9275 - kdb_printf("active %d\n", p->active);
9276 - for (i = 0; i < XFS_DA_NODE_MAXDEPTH; i++) {
9277 - kdb_printf(" blk %d bp 0x%p blkno 0x%x",
9278 - i, p->blk[i].bp, p->blk[i].blkno);
9279 - kdb_printf(" index %d hashval 0x%x ",
9280 - p->blk[i].index, (uint_t)p->blk[i].hashval);
9281 - switch(p->blk[i].magic) {
9282 - case XFS_DA_NODE_MAGIC: kdb_printf("NODE\n"); break;
9283 - case XFS_DIR_LEAF_MAGIC: kdb_printf("DIR\n"); break;
9284 - case XFS_ATTR_LEAF_MAGIC: kdb_printf("ATTR\n"); break;
9285 - case XFS_DIR2_LEAFN_MAGIC: kdb_printf("DIR2\n"); break;
9286 - default: kdb_printf("type ??\n"); break;
9288 + if (!ktep->val[0])
9290 + cp = (char *)&ktep->val[10];
9291 + qprintf("%s: '", (char *)ktep->val[1]);
9292 + len = min((__psint_t)ktep->val[9], (__psint_t)sizeof(ktep->val[10])*6);
9293 + for (i = 0; i < len; i++)
9294 + qprintf("%c", cp[i]);
9295 + qprintf("'(%ld)", (long)ktep->val[9]);
9296 + if ((__psunsigned_t)ktep->val[0] != XFS_DIR2_KTRACE_ARGS_BIBII)
9297 + qprintf(" hashval 0x%llx inumber %lld dp 0x%p tp 0x%p check %d",
9298 + (__uint64_t)(unsigned long)ktep->val[2],
9299 + (__int64_t)(unsigned long)ktep->val[3],
9300 + ktep->val[4], ktep->val[5],
9301 + (int)(__psint_t)ktep->val[6]);
9302 + switch ((__psunsigned_t)ktep->val[0]) {
9303 + case XFS_DIR2_KTRACE_ARGS:
9305 + case XFS_DIR2_KTRACE_ARGS_B:
9306 + qprintf(" bp 0x%p", ktep->val[7]);
9308 + case XFS_DIR2_KTRACE_ARGS_BB:
9309 + qprintf(" lbp 0x%p dbp 0x%p", ktep->val[7], ktep->val[8]);
9311 + case XFS_DIR2_KTRACE_ARGS_BIBII:
9312 + qprintf(" dp 0x%p tp 0x%p srcbp 0x%p srci %d dstbp 0x%p dsti %d count %d",
9313 + ktep->val[2], ktep->val[3], ktep->val[4],
9314 + (int)(__psint_t)ktep->val[5], ktep->val[6],
9315 + (int)(__psint_t)ktep->val[7],
9316 + (int)(__psint_t)ktep->val[8]);
9318 + case XFS_DIR2_KTRACE_ARGS_DB:
9319 + qprintf(" db 0x%x bp 0x%p",
9320 + (xfs_dir2_db_t)(unsigned long)ktep->val[7],
9323 + case XFS_DIR2_KTRACE_ARGS_I:
9324 + qprintf(" i 0x%lx", (unsigned long)ktep->val[7]);
9326 + case XFS_DIR2_KTRACE_ARGS_S:
9327 + qprintf(" s 0x%x", (int)(__psint_t)ktep->val[7]);
9329 + case XFS_DIR2_KTRACE_ARGS_SB:
9330 + qprintf(" s 0x%x bp 0x%p", (int)(__psint_t)ktep->val[7],
9334 + qprintf("unknown dirv2 trace record format");
9343 * Print an efd log item.
9344 @@ -2847,19 +3938,19 @@
9345 static char rval[16];
9347 sprintf(rval, "%c%c%c%c%c%c%c%c%c%c%c%c%c",
9348 - "?fc?dxb?r?l?S?m?"[(m & IFMT) >> 12],
9349 - m & ISUID ? 'u' : '-',
9350 - m & ISGID ? 'g' : '-',
9351 - m & ISVTX ? 'v' : '-',
9352 - m & IREAD ? 'r' : '-',
9353 - m & IWRITE ? 'w' : '-',
9354 - m & IEXEC ? 'x' : '-',
9355 - m & (IREAD >> 3) ? 'r' : '-',
9356 - m & (IWRITE >> 3) ? 'w' : '-',
9357 - m & (IEXEC >> 3) ? 'x' : '-',
9358 - m & (IREAD >> 6) ? 'r' : '-',
9359 - m & (IWRITE >> 6) ? 'w' : '-',
9360 - m & (IEXEC >> 6) ? 'x' : '-');
9361 + "?fc?dxb?r?l?S?m?"[(m & S_IFMT) >> 12],
9362 + m & S_ISUID ? 'u' : '-',
9363 + m & S_ISGID ? 'g' : '-',
9364 + m & S_ISVTX ? 'v' : '-',
9365 + m & S_IRUSR ? 'r' : '-',
9366 + m & S_IWUSR ? 'w' : '-',
9367 + m & S_IXUSR ? 'x' : '-',
9368 + m & S_IRGRP ? 'r' : '-',
9369 + m & S_IWGRP ? 'w' : '-',
9370 + m & S_IXGRP ? 'x' : '-',
9371 + m & S_IROTH ? 'r' : '-',
9372 + m & S_IWOTH ? 'w' : '-',
9373 + m & S_IXOTH ? 'x' : '-');
9377 @@ -2883,9 +3974,9 @@
9378 xfs_fmtuuid(uuid_t *uu)
9380 static char rval[40];
9382 - char *i = (unsigned char*)uu;
9385 + char *i = (unsigned char*)uu;
9388 for (b=0;b<16;b++) {
9389 o+=sprintf(o, "%02x", *i++);
9390 @@ -2930,9 +4021,9 @@
9394 - kdb_printf("inode 0x%p ino 0x%llu logged %d flags: ",
9395 + kdb_printf("inode 0x%p ino 0x%llu pushbuf %d logged %d flags: ",
9396 ilip->ili_inode, (unsigned long long) ilip->ili_format.ilf_ino,
9397 - ilip->ili_logged);
9398 + ilip->ili_pushbuf_flag, ilip->ili_logged);
9399 printflags(ilip->ili_flags, ili_flags, NULL);
9401 kdb_printf("ilock recur %d iolock recur %d ext buf 0x%p\n",
9402 @@ -2942,10 +4033,9 @@
9403 kdb_printf("root bytes %d root orig 0x%x\n",
9404 ilip->ili_root_size, ilip->ili_orig_root);
9406 - kdb_printf("size %d fields: ", ilip->ili_format.ilf_size);
9407 - printflags(ilip->ili_format.ilf_fields, ilf_fields, "formatfield");
9408 - kdb_printf(" last fields: ");
9409 - printflags(ilip->ili_last_fields, ilf_fields, "lastfield");
9410 + kdb_printf("size %d ", ilip->ili_format.ilf_size);
9411 + printflags(ilip->ili_format.ilf_fields, ilf_fields, "fields:");
9412 + printflags(ilip->ili_last_fields, ilf_fields, " last fields: ");
9414 kdb_printf(" flush lsn %s last lsn %s\n",
9415 xfs_fmtlsn(&(ilip->ili_flush_lsn)),
9416 @@ -3001,6 +4091,129 @@
9420 +#ifdef XFS_RW_TRACE
9422 + * Print iomap entry trace.
9425 +xfs_iomap_enter_trace_entry(ktrace_entry_t *ktep)
9427 + qprintf("ip 0x%p size 0x%x%x offset 0x%x%x count 0x%x\n",
9429 + (unsigned int)(long)ktep->val[2],
9430 + (unsigned int)(long)ktep->val[3],
9431 + (unsigned int)(long)ktep->val[4],
9432 + (unsigned int)(long)ktep->val[5],
9433 + (unsigned int)(long)ktep->val[6]);
9434 + qprintf("next offset 0x%x%x io offset 0x%x%x\n",
9435 + (unsigned int)(long)ktep->val[7],
9436 + (unsigned int)(long)ktep->val[8],
9437 + (unsigned int)(long)ktep->val[9],
9438 + (unsigned int)(long)ktep->val[10]);
9439 + qprintf("io size 0x%x last req sz 0x%x new size 0x%x%x\n",
9440 + (unsigned int)(long)ktep->val[11],
9441 + (unsigned int)(long)ktep->val[12],
9442 + (unsigned int)(long)ktep->val[13],
9443 + (unsigned int)(long)ktep->val[14]);
9447 + * Print iomap map trace.
9450 +xfs_iomap_map_trace_entry(ktrace_entry_t *ktep)
9452 + qprintf("ip 0x%p size 0x%x%x offset 0x%x%x count 0x%x\n",
9454 + (unsigned int)(long)ktep->val[2],
9455 + (unsigned int)(long)ktep->val[3],
9456 + (unsigned int)(long)ktep->val[4],
9457 + (unsigned int)(long)ktep->val[5],
9458 + (unsigned int)(long)ktep->val[6]);
9459 + qprintf("bmap off 0x%x%x len 0x%x pboff 0x%x pbsize 0x%x bno 0x%x\n",
9460 + (unsigned int)(long)ktep->val[7],
9461 + (unsigned int)(long)ktep->val[8],
9462 + (unsigned int)(long)ktep->val[9],
9463 + (unsigned int)(long)ktep->val[10],
9464 + (unsigned int)(long)ktep->val[11],
9465 + (unsigned int)(long)ktep->val[12]);
9466 + qprintf("imap off 0x%x count 0x%x block 0x%x\n",
9467 + (unsigned int)(long)ktep->val[13],
9468 + (unsigned int)(long)ktep->val[14],
9469 + (unsigned int)(long)ktep->val[15]);
9473 + * Print itrunc entry trace.
9476 +xfs_itrunc_trace_entry(ktrace_entry_t *ktep)
9478 + qprintf("ip 0x%p size 0x%x%x flag %ld new size 0x%x%x\n",
9480 + (unsigned int)(long)ktep->val[2],
9481 + (unsigned int)(long)ktep->val[3],
9482 + (long)ktep->val[4],
9483 + (unsigned int)(long)ktep->val[5],
9484 + (unsigned int)(long)ktep->val[6]);
9485 + qprintf("toss start 0x%x%x toss finish 0x%x%x cpu id %ld\n",
9486 + (unsigned int)(long)ktep->val[7],
9487 + (unsigned int)(long)ktep->val[8],
9488 + (unsigned int)(long)ktep->val[9],
9489 + (unsigned int)(long)ktep->val[10],
9490 + (long)ktep->val[11]);
9494 + * Print bunmap entry trace.
9497 +xfs_bunmap_trace_entry(ktrace_entry_t *ktep)
9499 + static char *bunmapi_flags[] = {
9500 + "write", /* 0x01 */
9501 + "delay", /* 0x02 */
9502 + "entire", /* 0x04 */
9503 + "metadata", /* 0x08 */
9504 + "exact", /* 0x10 */
9505 + "attrfork", /* 0x20 */
9506 + "async", /* 0x40 */
9507 + "rsvblocks", /* 0x80 */
9511 + qprintf("ip 0x%p size 0x%x%x bno 0x%x%x len 0x%x cpu id %ld\n",
9513 + (unsigned int)(long)ktep->val[2],
9514 + (unsigned int)(long)ktep->val[3],
9515 + (unsigned int)(long)ktep->val[4],
9516 + (unsigned int)(long)ktep->val[5],
9517 + (unsigned int)(long)ktep->val[6],
9518 + (long)ktep->val[8]);
9519 + qprintf("ra 0x%p ", ktep->val[9]);
9520 + printflags((__psint_t)ktep->val[7], bunmapi_flags, "flags");
9525 + * Print inval_cached_pages entry trace.
9528 +xfs_inval_cached_trace_entry(ktrace_entry_t *ktep)
9530 + qprintf("ip 0x%p offset 0x%x%x len 0x%x%x first 0x%x%x last 0x%x%x\n",
9532 + (unsigned int)(long)ktep->val[2],
9533 + (unsigned int)(long)ktep->val[3],
9534 + (unsigned int)(long)ktep->val[4],
9535 + (unsigned int)(long)ktep->val[5],
9536 + (unsigned int)(long)ktep->val[6],
9537 + (unsigned int)(long)ktep->val[7],
9538 + (unsigned int)(long)ktep->val[8],
9539 + (unsigned int)(long)ktep->val[9]);
9546 @@ -3047,14 +4260,14 @@
9547 INT_GET(dip->di_gid, convert),
9548 (uint)INT_GET(dip->di_projid, convert),
9549 (uint)INT_GET(dip->di_flushiter, convert));
9550 - kdb_printf("atime 0x%x:%x mtime 0x%x:%x ctime 0x%x:%x\n",
9551 + kdb_printf("atime %u:%u mtime %ud:%u ctime %u:%u\n",
9552 INT_GET(dip->di_atime.t_sec, convert),
9553 INT_GET(dip->di_atime.t_nsec, convert),
9554 INT_GET(dip->di_mtime.t_sec, convert),
9555 INT_GET(dip->di_mtime.t_nsec, convert),
9556 INT_GET(dip->di_ctime.t_sec, convert),
9557 INT_GET(dip->di_ctime.t_nsec, convert));
9558 - kdb_printf("size 0x%Lx ", INT_GET(dip->di_size, convert));
9559 + kdb_printf("size %Ld ", INT_GET(dip->di_size, convert));
9560 kdb_printf("nblocks %Ld extsize 0x%x nextents 0x%x anextents 0x%x\n",
9561 INT_GET(dip->di_nblocks, convert),
9562 INT_GET(dip->di_extsize, convert),
9563 @@ -3071,6 +4284,129 @@
9564 kdb_printf("gen 0x%x\n", INT_GET(dip->di_gen, convert));
9567 +#ifdef XFS_RW_TRACE
9569 + * Print read/write entry trace.
9572 +xfs_rw_enter_trace_entry(ktrace_entry_t *ktep)
9574 + qprintf("ip 0x%p size 0x%x%x uio offset 0x%x%x uio count 0x%x\n",
9576 + (unsigned int)(long)ktep->val[2],
9577 + (unsigned int)(long)ktep->val[3],
9578 + (unsigned int)(long)ktep->val[4],
9579 + (unsigned int)(long)ktep->val[5],
9580 + (unsigned int)(long)ktep->val[6]);
9581 + qprintf("ioflags 0x%x next offset 0x%x%x io offset 0x%x%x\n",
9582 + (unsigned int)(long)ktep->val[7],
9583 + (unsigned int)(long)ktep->val[8],
9584 + (unsigned int)(long)ktep->val[9],
9585 + (unsigned int)(long)ktep->val[10],
9586 + (unsigned int)(long)ktep->val[11]);
9587 + qprintf("io size 0x%x last req sz 0x%x new size 0x%x%x\n",
9588 + (unsigned int)(long)ktep->val[12],
9589 + (unsigned int)(long)ktep->val[13],
9590 + (unsigned int)(long)ktep->val[14],
9591 + (unsigned int)(long)ktep->val[15]);
9595 + * Print read/write trace entry.
9598 +xfs_rw_trace_entry(ktrace_entry_t *ktep)
9600 + switch ( (long)ktep->val[0] ) {
9601 + case XFS_READ_ENTER:
9602 + qprintf("READ ENTER:\n");
9603 + xfs_rw_enter_trace_entry(ktep);
9605 + case XFS_WRITE_ENTER:
9606 + qprintf("WRITE ENTER:\n");
9607 + xfs_rw_enter_trace_entry(ktep);
9609 + case XFS_IOMAP_READ_ENTER:
9610 + qprintf("IOMAP READ ENTER:\n");
9611 + xfs_iomap_enter_trace_entry(ktep);
9613 + case XFS_IOMAP_WRITE_ENTER:
9614 + qprintf("IOMAP WRITE ENTER:\n");
9615 + xfs_iomap_enter_trace_entry(ktep);
9617 + case XFS_IOMAP_WRITE_NOSPACE:
9618 + qprintf("IOMAP WRITE NOSPACE:\n");
9619 + xfs_iomap_enter_trace_entry(ktep);
9621 + case XFS_IOMAP_READ_MAP:
9622 + qprintf("IOMAP READ MAP:\n");
9623 + xfs_iomap_map_trace_entry(ktep);
9625 + case XFS_IOMAP_WRITE_MAP:
9626 + qprintf("IOMAP WRITE MAP:\n");
9627 + xfs_iomap_map_trace_entry(ktep);
9629 + case XFS_ITRUNC_START:
9630 + qprintf("ITRUNC START:\n");
9631 + xfs_itrunc_trace_entry(ktep);
9633 + case XFS_ITRUNC_FINISH1:
9634 + qprintf("ITRUNC FINISH1:\n");
9635 + xfs_itrunc_trace_entry(ktep);
9637 + case XFS_ITRUNC_FINISH2:
9638 + qprintf("ITRUNC FINISH2:\n");
9639 + xfs_itrunc_trace_entry(ktep);
9642 + qprintf("CTRUNC1:\n");
9643 + xfs_ctrunc_trace_entry(ktep);
9646 + qprintf("CTRUNC2:\n");
9647 + xfs_ctrunc_trace_entry(ktep);
9650 + qprintf("CTRUNC3:\n");
9651 + xfs_ctrunc_trace_entry(ktep);
9654 + qprintf("CTRUNC4:\n");
9655 + xfs_ctrunc_trace_entry(ktep);
9658 + qprintf("CTRUNC5:\n");
9659 + xfs_ctrunc_trace_entry(ktep);
9662 + qprintf("CTRUNC6:\n");
9663 + xfs_ctrunc_trace_entry(ktep);
9666 + qprintf("BUNMAPI:\n");
9667 + xfs_bunmap_trace_entry(ktep);
9669 + case XFS_INVAL_CACHED:
9670 + qprintf("INVAL CACHED:\n");
9671 + xfs_inval_cached_trace_entry(ktep);
9673 + case XFS_DIORD_ENTER:
9674 + qprintf("DIORD ENTER:\n");
9675 + xfs_rw_enter_trace_entry(ktep);
9677 + case XFS_DIOWR_ENTER:
9678 + qprintf("DIOWR ENTER:\n");
9679 + xfs_rw_enter_trace_entry(ktep);
9691 * Print xfs extent list for a fork.
9693 @@ -3194,6 +4530,109 @@
9697 +#ifdef XFS_ALLOC_TRACE
9699 + * Print out the last "count" entries in the allocation trace buffer.
9702 +xfsidbg_xalatrace(int count)
9704 + ktrace_entry_t *ktep;
9705 + ktrace_snap_t kts;
9709 + if (xfs_alloc_trace_buf == NULL) {
9710 + qprintf("The xfs alloc trace buffer is not initialized\n");
9713 + nentries = ktrace_nentries(xfs_alloc_trace_buf);
9714 + if (count == -1) {
9717 + if ((count <= 0) || (count > nentries)) {
9718 + qprintf("Invalid count. There are %d entries.\n", nentries);
9722 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9723 + if (count != nentries) {
9725 + * Skip the total minus the number to look at minus one
9726 + * for the entry returned by ktrace_first().
9728 + skip_entries = nentries - count - 1;
9729 + ktep = ktrace_skip(xfs_alloc_trace_buf, skip_entries, &kts);
9730 + if (ktep == NULL) {
9731 + qprintf("Skipped them all\n");
9735 + while (ktep != NULL) {
9736 + if (xfs_alloc_trace_entry(ktep))
9738 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9743 + * Print out all the entries in the alloc trace buf corresponding
9744 + * to the given block number.
9747 +xfsidbg_xalbtrace(xfs_agblock_t bno)
9749 + ktrace_entry_t *ktep;
9750 + ktrace_snap_t kts;
9752 + if (xfs_alloc_trace_buf == NULL) {
9753 + qprintf("The xfs alloc trace buffer is not initialized\n");
9757 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9758 + while (ktep != NULL) {
9759 + switch ((__psint_t)ktep->val[0]) {
9760 + case XFS_ALLOC_KTRACE_ALLOC:
9761 + case XFS_ALLOC_KTRACE_FREE:
9762 + if (bno >= (xfs_agblock_t)((__psint_t)ktep->val[5]) &&
9763 + bno < (xfs_agblock_t)((__psint_t)ktep->val[5]) +
9764 + (xfs_extlen_t)((__psint_t)ktep->val[13])) {
9765 + (void)xfs_alloc_trace_entry(ktep);
9770 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9775 + * Print out all the entries in the alloc trace buf corresponding
9776 + * to the given allocation group.
9779 +xfsidbg_xalgtrace(xfs_agnumber_t agno)
9781 + ktrace_entry_t *ktep;
9782 + ktrace_snap_t kts;
9784 + if (xfs_alloc_trace_buf == NULL) {
9785 + qprintf("The xfs alloc trace buffer is not initialized\n");
9789 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9790 + while (ktep != NULL) {
9791 + if ( (__psint_t)ktep->val[0] &&
9792 + ((xfs_agnumber_t)((__psint_t)ktep->val[4])) == agno ) {
9793 + (void)xfs_alloc_trace_entry(ktep);
9796 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9802 * Print an allocation argument structure for XFS.
9803 @@ -3215,7 +4654,7 @@
9804 args->wasfromfl, args->isfl, args->userdata);
9808 +#ifdef XFS_ALLOC_TRACE
9810 * Print out all the entries in the alloc trace buf corresponding
9811 * to the given mount point.
9812 @@ -3225,7 +4664,6 @@
9814 ktrace_entry_t *ktep;
9816 - extern ktrace_t *xfs_alloc_trace_buf;
9818 if (xfs_alloc_trace_buf == NULL) {
9819 kdb_printf("The xfs alloc trace buffer is not initialized\n");
9820 @@ -3234,14 +4672,53 @@
9822 ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9823 while (ktep != NULL) {
9824 - if ((__psint_t)ktep->val[0] && (xfs_mount_t *)ktep->val[3] == mp) {
9825 + if ((__psint_t)ktep->val[0] &&
9826 + (xfs_mount_t *)ktep->val[3] == mp) {
9827 (void)xfs_alloc_trace_entry(ktep);
9830 ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9836 + * Print out all the entries in the alloc trace buf corresponding
9837 + * to the given entry type.
9840 +xfsidbg_xalttrace(int tag)
9842 + ktrace_entry_t *ktep;
9843 + ktrace_snap_t kts;
9845 + if (xfs_alloc_trace_buf == NULL) {
9846 + qprintf("The xfs alloc trace buffer is not initialized\n");
9850 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9851 + while (ktep != NULL) {
9852 + if ((__psint_t)ktep->val[0] &&
9853 + ((long)ktep->val[0] & 0xffffL) == (long)tag) {
9854 + (void)xfs_alloc_trace_entry(ktep);
9857 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9863 + * Set xtra argument, used by xchksum.
9866 +xfsidbg_xarg(int xarg)
9869 + qprintf("xargument: %d\n", xargument);
9872 +} /* xfsidbg_xarg */
9875 * Print an attr_list() context structure.
9876 @@ -3368,41 +4845,232 @@
9881 +#ifdef XFS_ATTR_TRACE
9883 + * Print out the last "count" entries in the attribute trace buffer.
9886 +xfsidbg_xattrtrace(int count)
9888 + ktrace_entry_t *ktep;
9889 + ktrace_snap_t kts;
9893 + if (xfs_attr_trace_buf == NULL) {
9894 + qprintf("The xfs attribute trace buffer is not initialized\n");
9897 + nentries = ktrace_nentries(xfs_attr_trace_buf);
9898 + if (count == -1) {
9901 + if ((count <= 0) || (count > nentries)) {
9902 + qprintf("Invalid count. There are %d entries.\n", nentries);
9906 + ktep = ktrace_first(xfs_attr_trace_buf, &kts);
9907 + if (count != nentries) {
9909 + * Skip the total minus the number to look at minus one
9910 + * for the entry returned by ktrace_first().
9912 + skip_entries = nentries - count - 1;
9913 + ktep = ktrace_skip(xfs_attr_trace_buf, skip_entries, &kts);
9914 + if (ktep == NULL) {
9915 + qprintf("Skipped them all\n");
9919 + while (ktep != NULL) {
9920 + xfs_attr_trace_entry(ktep);
9921 + ktep = ktrace_next(xfs_attr_trace_buf, &kts);
9927 + * Print xfs bmap internal record
9930 +xfsidbg_xbirec(xfs_bmbt_irec_t *r)
9933 + "startoff %Ld startblock %Lx blockcount %Ld state %Ld\n",
9934 + (__uint64_t)r->br_startoff,
9935 + (__uint64_t)r->br_startblock,
9936 + (__uint64_t)r->br_blockcount,
9937 + (__uint64_t)r->br_state);
9940 +#ifdef XFS_BLI_TRACE
9942 + * Print out the buf log item trace for the given buf log item.
9945 +xfsidbg_xblitrace(xfs_buf_log_item_t *bip)
9947 + ktrace_entry_t *ktep;
9948 + ktrace_snap_t kts;
9950 + static char *xbli_flags[] = {
9951 + "hold", /* 0x01 */
9952 + "dirty", /* 0x02 */
9953 + "stale", /* 0x04 */
9954 + "logged", /* 0x08 */
9957 + static char *xli_flags[] = {
9958 + "in ail", /* 0x1 */
9962 + if (bip->bli_trace == NULL) {
9963 + qprintf("The bli trace buffer is not initialized\n");
9967 + ktep = ktrace_first(bip->bli_trace, &kts);
9968 + while (ktep != NULL) {
9969 + qprintf("%s bp 0x%p flags ",
9970 + (char *)ktep->val[0], ktep->val[1]);
9971 + printflags((__psint_t)(ktep->val[2]), xbli_flags, "xbli");
9973 + qprintf("recur %ld refcount %ld blkno 0x%lx bcount 0x%lx\n",
9974 + (long)ktep->val[3], (long)ktep->val[4],
9975 + (unsigned long)ktep->val[5],
9976 + (unsigned long)ktep->val[6]);
9977 + flags = (((uint64_t)(unsigned long)ktep->val[7] << 32) &
9978 + 0xFFFFFFFF00000000ULL) |
9979 + (((uint64_t)(unsigned long)ktep->val[8]) &
9980 + 0x00000000FFFFFFFFULL);
9981 + qprintf("bp flags ");
9982 + printflags(flags, pb_flag_vals, 0);
9984 + qprintf("fspriv 0x%p fspriv2 0x%p pincount %ld iodone 0x%p\n",
9985 + ktep->val[9], ktep->val[10],
9986 + (long)ktep->val[11], ktep->val[12]);
9987 + qprintf("lockval %ld lid 0x%lx log item flags ",
9988 + (long)ktep->val[13], (unsigned long)ktep->val[14]);
9989 + printflags((__psint_t)(ktep->val[15]), xli_flags, "xli");
9992 + ktep = ktrace_next(bip->bli_trace, &kts);
9998 + * Print a bmap alloc argument structure for XFS.
10001 +xfsidbg_xbmalla(xfs_bmalloca_t *a)
10003 + kdb_printf("tp 0x%p ip 0x%p eof %d prevp 0x%p\n",
10004 + a->tp, a->ip, a->eof, a->prevp);
10005 + kdb_printf("gotp 0x%p firstblock %s alen %d total %d\n",
10006 + a->gotp, xfs_fmtfsblock(a->firstblock, a->ip->i_mount),
10007 + a->alen, a->total);
10008 + kdb_printf("off %s wasdel %d userdata %d minlen %d\n",
10009 + xfs_fmtfsblock(a->off, a->ip->i_mount), a->wasdel,
10010 + a->userdata, a->minlen);
10011 + kdb_printf("minleft %d low %d rval %s aeof %d\n",
10012 + a->minleft, a->low, xfs_fmtfsblock(a->rval, a->ip->i_mount),
10016 +#ifdef XFS_BMAP_TRACE
10018 + * Print out the last "count" entries in the bmap btree trace buffer.
10019 + * The "a" is for "all" inodes.
10022 +xfsidbg_xbmatrace(int count)
10024 + ktrace_entry_t *ktep;
10025 + ktrace_snap_t kts;
10027 + int skip_entries;
10029 + if (xfs_bmbt_trace_buf == NULL) {
10030 + qprintf("The xfs bmap btree trace buffer is not initialized\n"); return;
10032 + nentries = ktrace_nentries(xfs_bmbt_trace_buf);
10033 + if (count == -1) {
10034 + count = nentries;
10036 + if ((count <= 0) || (count > nentries)) {
10037 + qprintf("Invalid count. There are %d entries.\n", nentries);
10041 + ktep = ktrace_first(xfs_bmbt_trace_buf, &kts);
10042 + if (count != nentries) {
10044 + * Skip the total minus the number to look at minus one
10045 + * for the entry returned by ktrace_first().
10047 + skip_entries = nentries - count - 1;
10048 + ktep = ktrace_skip(xfs_bmbt_trace_buf, skip_entries, &kts);
10049 + if (ktep == NULL) {
10050 + qprintf("Skipped them all\n");
10054 + while (ktep != NULL) {
10055 + if (xfs_bmbt_trace_entry(ktep))
10057 + ktep = ktrace_next(xfs_bmbt_trace_buf, &kts);
10062 - * Print xfs bmap internal record
10063 + * Print out the bmap btree trace buffer attached to the given inode.
10066 -xfsidbg_xbirec(xfs_bmbt_irec_t *r)
10067 +xfsidbg_xbmitrace(xfs_inode_t *ip)
10070 - "startoff %Ld startblock %Lx blockcount %Ld state %Ld\n",
10071 - (__uint64_t)r->br_startoff,
10072 - (__uint64_t)r->br_startblock,
10073 - (__uint64_t)r->br_blockcount,
10074 - (__uint64_t)r->br_state);
10076 + ktrace_entry_t *ktep;
10077 + ktrace_snap_t kts;
10079 + if (ip->i_btrace == NULL) {
10080 + qprintf("The inode trace buffer is not initialized\n");
10084 + ktep = ktrace_first(ip->i_btrace, &kts);
10085 + while (ktep != NULL) {
10086 + if (xfs_bmbt_trace_entry(ktep))
10088 + ktep = ktrace_next(ip->i_btrace, &kts);
10093 - * Print a bmap alloc argument structure for XFS.
10094 + * Print out all the entries in the bmap btree trace buf corresponding
10095 + * to the given inode. The "s" is for "single" inode.
10098 -xfsidbg_xbmalla(xfs_bmalloca_t *a)
10099 +xfsidbg_xbmstrace(xfs_inode_t *ip)
10101 - kdb_printf("tp 0x%p ip 0x%p eof %d prevp 0x%p\n",
10102 - a->tp, a->ip, a->eof, a->prevp);
10103 - kdb_printf("gotp 0x%p firstblock %s alen %d total %d\n",
10104 - a->gotp, xfs_fmtfsblock(a->firstblock, a->ip->i_mount),
10105 - a->alen, a->total);
10106 - kdb_printf("off %s wasdel %d userdata %d minlen %d\n",
10107 - xfs_fmtfsblock(a->off, a->ip->i_mount), a->wasdel,
10108 - a->userdata, a->minlen);
10109 - kdb_printf("minleft %d low %d rval %s aeof %d\n",
10110 - a->minleft, a->low, xfs_fmtfsblock(a->rval, a->ip->i_mount),
10113 + ktrace_entry_t *ktep;
10114 + ktrace_snap_t kts;
10116 + if (xfs_bmbt_trace_buf == NULL) {
10117 + qprintf("The xfs bmap btree trace buffer is not initialized\n"); return;
10120 + ktep = ktrace_first(xfs_bmbt_trace_buf, &kts);
10121 + while (ktep != NULL) {
10122 + if ((xfs_inode_t *)(ktep->val[2]) == ip) {
10123 + if (xfs_bmbt_trace_entry(ktep))
10126 + ktep = ktrace_next(xfs_bmbt_trace_buf, &kts);
10132 * Print xfs bmap record
10133 @@ -3667,6 +5335,286 @@
10137 +#ifdef XFS_BMAP_TRACE
10139 + * Print out the last "count" entries in the bmap extent trace buffer.
10140 + * The "a" is for "all" inodes.
10143 +xfsidbg_xbxatrace(int count)
10145 + ktrace_entry_t *ktep;
10146 + ktrace_snap_t kts;
10148 + int skip_entries;
10150 + if (xfs_bmap_trace_buf == NULL) {
10151 + qprintf("The xfs bmap extent trace buffer is not initialized\n");
10154 + nentries = ktrace_nentries(xfs_bmap_trace_buf);
10155 + if (count == -1) {
10156 + count = nentries;
10158 + if ((count <= 0) || (count > nentries)) {
10159 + qprintf("Invalid count. There are %d entries.\n", nentries);
10163 + ktep = ktrace_first(xfs_bmap_trace_buf, &kts);
10164 + if (count != nentries) {
10166 + * Skip the total minus the number to look at minus one
10167 + * for the entry returned by ktrace_first().
10169 + skip_entries = nentries - count - 1;
10170 + ktep = ktrace_skip(xfs_bmap_trace_buf, skip_entries, &kts);
10171 + if (ktep == NULL) {
10172 + qprintf("Skipped them all\n");
10176 + while (ktep != NULL) {
10177 + if (xfs_bmap_trace_entry(ktep))
10179 + ktep = ktrace_next(xfs_bmap_trace_buf, &kts);
10184 + * Print out the bmap extent trace buffer attached to the given inode.
10187 +xfsidbg_xbxitrace(xfs_inode_t *ip)
10189 + ktrace_entry_t *ktep;
10190 + ktrace_snap_t kts;
10191 + if (ip->i_xtrace == NULL) {
10192 + qprintf("The inode trace buffer is not initialized\n");
10196 + ktep = ktrace_first(ip->i_xtrace, &kts);
10197 + while (ktep != NULL) {
10198 + if (xfs_bmap_trace_entry(ktep))
10200 + ktep = ktrace_next(ip->i_xtrace, &kts);
10205 + * Print out all the entries in the bmap extent trace buf corresponding
10206 + * to the given inode. The "s" is for "single" inode.
10209 +xfsidbg_xbxstrace(xfs_inode_t *ip)
10211 + ktrace_entry_t *ktep;
10212 + ktrace_snap_t kts;
10214 + if (xfs_bmap_trace_buf == NULL) {
10215 + qprintf("The xfs bmap extent trace buffer is not initialized\n");
10219 + ktep = ktrace_first(xfs_bmap_trace_buf, &kts);
10220 + while (ktep != NULL) {
10221 + if ((xfs_inode_t *)(ktep->val[3]) == ip) {
10222 + if (xfs_bmap_trace_entry(ktep))
10225 + ktep = ktrace_next(xfs_bmap_trace_buf, &kts);
10230 +#ifdef XFS_ILOCK_TRACE
10232 + * Print out the ilock trace buffer attached to the given inode.
10235 +xfsidbg_xilock_trace_entry(ktrace_entry_t *ktep)
10237 + static char *xiflags[] = {
10246 + if ((__psint_t)ktep->val[0] &&
10247 + (__psint_t)ktep->val[7] == 0) {
10248 + printflags((__psint_t)ktep->val[2], xiflags,"Flags ");
10249 + if ((__psint_t)ktep->val[1] == 1)
10250 + qprintf("LOCK\n");
10251 + else if ((__psint_t)ktep->val[1] == 2)
10252 + qprintf("LOCK SHARED\n");
10253 + else if ((__psint_t)ktep->val[1] == 3)
10254 + qprintf("UNLOCK\n");
10255 + qprintf("ip 0x%p %llx %ld\n",
10257 + (unsigned long long)((xfs_inode_t*)ktep->val[0])->i_ino,
10258 + (long)ktep->val[6]);
10259 + qprintf("raddr 0x%p\n", ktep->val[3]);
10260 + qprintf(" Pid %ld, cpu %ld\n",
10261 + (long)ktep->val[5],
10262 + (long)ktep->val[4]);
10263 + qprintf("-----------------------\n");
10265 + } else if ((__psint_t)ktep->val[7] == 1) {
10266 + if ((__psint_t)ktep->val[1] == 1)
10267 + qprintf("FlushLOCK ");
10268 + else if ((__psint_t)ktep->val[1] == 2)
10269 + qprintf("FlushTRYLOCK %ld ",
10270 + (long)ktep->val[2]);
10271 + else if ((__psint_t)ktep->val[1] == 3)
10272 + qprintf("FlushUNLOCK ");
10273 + else if ((__psint_t)ktep->val[1] == 4)
10274 + qprintf("FlushInode 0x%p",
10276 + else if ((__psint_t)ktep->val[1] == 5)
10277 + qprintf("FlushInodeInt ");
10278 + else qprintf("FlushUNKNOWN ");
10279 + qprintf("ip 0x%p ino %llx @ %ld\n",
10281 + (unsigned long long)((xfs_inode_t*)ktep->val[0])->i_ino,
10282 + (long)ktep->val[6]);
10283 + qprintf("raddr 0x%p\n", ktep->val[3]);
10284 + qprintf(" Pid %ld, cpu %ld\n",
10285 + (long)ktep->val[5],
10286 + (long)ktep->val[4]);
10287 + qprintf("-----------------------\n");
10292 +xfsidbg_xilock_trace(xfs_inode_t *ip)
10294 + static char *xiflags[] = {
10303 + ktrace_entry_t *ktep;
10304 + ktrace_snap_t kts;
10305 + if (ip->i_lock_trace == NULL) {
10306 + qprintf("The inode ilock trace buffer is not initialized\n");
10310 + ktep = ktrace_first(ip->i_lock_trace, &kts);
10311 + while (ktep != NULL) {
10312 + if ((__psint_t)ktep->val[0] &&
10313 + (__psint_t)ktep->val[7] == 0) {
10314 + printflags((__psint_t)ktep->val[2], xiflags,"Flags ");
10315 + if ((__psint_t)ktep->val[1] == 1)
10316 + qprintf("LOCK\n");
10317 + else if ((__psint_t)ktep->val[1] == 2)
10318 + qprintf("LOCK SHARED\n");
10319 + else if ((__psint_t)ktep->val[1] == 3)
10320 + qprintf("UNLOCK\n");
10321 + qprintf("ip 0x%p %lld %ld\n",
10322 + ktep->val[0], (unsigned long long)
10323 + ((xfs_inode_t*)ktep->val[0])->i_ino,
10324 + (long)ktep->val[6]);
10325 + qprintf("raddr 0x%p\n", ktep->val[3]);
10326 + qprintf(" Pid %ld, cpu %ld\n",
10327 + (long)ktep->val[5],
10328 + (long)ktep->val[4]);
10329 + qprintf("-----------------------\n");
10330 + } else if ((__psint_t)ktep->val[7] == 1) {
10331 + if ((__psint_t)ktep->val[1] == 1)
10332 + qprintf("LOCK ");
10333 + else if ((__psint_t)ktep->val[1] == 2)
10334 + qprintf("TRYLOCK %ld ",
10335 + (long)ktep->val[2]);
10336 + else if ((__psint_t)ktep->val[1] == 3)
10337 + qprintf("UNLOCK ");
10338 + else qprintf("UNKNOWN ");
10339 + qprintf("ip 0x%p %lld %ld\n",
10340 + ktep->val[0], (unsigned long long)
10341 + ((xfs_inode_t*)ktep->val[0])->i_ino,
10342 + (long)ktep->val[6]);
10343 + qprintf("raddr 0x%p\n", ktep->val[3]);
10344 + qprintf(" Pid %ld, cpu %ld\n",
10345 + (long)ktep->val[5],
10346 + (long)ktep->val[4]);
10347 + qprintf("-----------------------\n");
10350 + ktep = ktrace_next(ip->i_lock_trace, &kts);
10355 + * Print out the last "count" entries in the inode lock trace buffer.
10356 + * The "a" is for "all" entries.
10359 +xfsidbg_xailock_trace(int count)
10361 + ktrace_entry_t *ktep;
10362 + ktrace_snap_t kts;
10364 + int skip_entries;
10366 + if (xfs_ilock_trace_buf == NULL) {
10367 + qprintf("The xfs inode lock trace buffer is not initialized\n"); return;
10369 + nentries = ktrace_nentries(xfs_ilock_trace_buf);
10370 + if (count == -1) {
10371 + count = nentries;
10373 + if ((count <= 0) || (count > nentries)) {
10374 + qprintf("Invalid count. There are %d entries.\n", nentries);
10378 + ktep = ktrace_first(xfs_ilock_trace_buf, &kts);
10379 + if (count != nentries) {
10381 + * Skip the total minus the number to look at minus one
10382 + * for the entry returned by ktrace_first().
10384 + skip_entries = nentries - count - 1;
10385 + ktep = ktrace_skip(xfs_ilock_trace_buf, skip_entries, &kts);
10386 + if (ktep == NULL) {
10387 + qprintf("Skipped them all\n");
10391 + while (ktep != NULL) {
10392 + xfsidbg_xilock_trace_entry(ktep);
10393 + ktep = ktrace_next(xfs_ilock_trace_buf, &kts);
10399 + * Compute & print buffer's checksum.
10402 +xfsidbg_xchksum(uint *addr)
10404 + uint i, chksum = 0;
10406 + if (((__psint_t)addr) == ((__psint_t)-1)) {
10407 + qprintf("USAGE xchksum <address>\n");
10408 + qprintf(" length is set with xarg\n");
10410 + for (i=0; i<xargument; i++) {
10414 + qprintf("chksum (0x%x) length (%d)\n", chksum, xargument);
10416 +} /* xfsidbg_xchksum */
10419 * Print an xfs_da_args structure.
10420 @@ -3740,9 +5688,8 @@
10421 kdb_printf(" %d:0x%p", i, dabuf->bps[i]);
10423 #ifdef XFS_DABUF_DEBUG
10424 - kdb_printf(" ra 0x%x prev 0x%x next 0x%x dev %s blkno 0x%x\n",
10425 - dabuf->ra, dabuf->prev, dabuf->next,
10426 - XFS_BUFTARG_NAME(dabuf->dev), dabuf->blkno);
10427 + kdb_printf(" ra 0x%x prev 0x%x next 0x%x dev 0x%x blkno 0x%x\n",
10428 + dabuf->ra, dabuf->prev, dabuf->next, dabuf->dev, dabuf->blkno);
10432 @@ -4012,6 +5959,119 @@
10436 +#ifdef XFS_DIR_TRACE
10438 + * Print out the last "count" entries in the directory trace buffer.
10441 +xfsidbg_xdirtrace(int count)
10443 + ktrace_entry_t *ktep;
10444 + ktrace_snap_t kts;
10446 + int skip_entries;
10448 + if (xfs_dir_trace_buf == NULL) {
10449 + qprintf("The xfs directory trace buffer is not initialized\n");
10452 + nentries = ktrace_nentries(xfs_dir_trace_buf);
10453 + if (count == -1) {
10454 + count = nentries;
10456 + if ((count <= 0) || (count > nentries)) {
10457 + qprintf("Invalid count. There are %d entries.\n", nentries);
10461 + ktep = ktrace_first(xfs_dir_trace_buf, &kts);
10462 + if (count != nentries) {
10464 + * Skip the total minus the number to look at minus one
10465 + * for the entry returned by ktrace_first().
10467 + skip_entries = nentries - count - 1;
10468 + ktep = ktrace_skip(xfs_dir_trace_buf, skip_entries, &kts);
10469 + if (ktep == NULL) {
10470 + qprintf("Skipped them all\n");
10474 + while (ktep != NULL) {
10475 + if (xfs_dir_trace_entry(ktep))
10477 + ktep = ktrace_next(xfs_dir_trace_buf, &kts);
10482 +#ifdef XFS_DIR2_TRACE
10484 + * Print out the last "count" entries in the directory v2 trace buffer.
10487 +xfsidbg_xdir2atrace(int count)
10489 + ktrace_entry_t *ktep;
10490 + ktrace_snap_t kts;
10492 + int skip_entries;
10494 + if (xfs_dir2_trace_buf == NULL) {
10495 + qprintf("The xfs dirv2 trace buffer is not initialized\n");
10498 + nentries = ktrace_nentries(xfs_dir2_trace_buf);
10499 + if (count == -1) {
10500 + count = nentries;
10502 + if ((count <= 0) || (count > nentries)) {
10503 + qprintf("Invalid count. There are %d entries.\n", nentries);
10507 + ktep = ktrace_first(xfs_dir2_trace_buf, &kts);
10508 + if (count != nentries) {
10510 + * Skip the total minus the number to look at minus one
10511 + * for the entry returned by ktrace_first().
10513 + skip_entries = nentries - count - 1;
10514 + ktep = ktrace_skip(xfs_dir2_trace_buf, skip_entries, &kts);
10515 + if (ktep == NULL) {
10516 + qprintf("Skipped them all\n");
10520 + while (ktep != NULL) {
10521 + if (xfs_dir2_trace_entry(ktep))
10523 + ktep = ktrace_next(xfs_dir2_trace_buf, &kts);
10528 + * Print out the directory v2 trace buffer attached to the given inode.
10531 +xfsidbg_xdir2itrace(xfs_inode_t *ip)
10533 + ktrace_entry_t *ktep;
10534 + ktrace_snap_t kts;
10536 + if (ip->i_dir_trace == NULL) {
10537 + qprintf("The inode trace buffer is not initialized\n");
10541 + ktep = ktrace_first(ip->i_dir_trace, &kts);
10542 + while (ktep != NULL) {
10543 + if (xfs_dir2_trace_entry(ktep))
10545 + ktep = ktrace_next(ip->i_dir_trace, &kts);
10551 * Print xfs extent list.
10552 @@ -4095,13 +6155,18 @@
10553 kdb_printf("log: 0x%p callb: 0x%p callb_tail: 0x%p roundoff: %d\n",
10554 iclog->ic_log, iclog->ic_callback, iclog->ic_callback_tail,
10555 iclog->ic_roundoff);
10556 - kdb_printf("size: %d (OFFSET: %d) refcnt: %d bwritecnt: %d",
10557 + kdb_printf("size: %d (OFFSET: %d) trace: 0x%p refcnt: %d bwritecnt: %d",
10558 iclog->ic_size, iclog->ic_offset,
10559 +#ifdef XFS_LOG_TRACE
10564 iclog->ic_refcnt, iclog->ic_bwritecnt);
10565 if (iclog->ic_state & XLOG_STATE_ALL)
10566 - printflags(iclog->ic_state, ic_flags, "state:");
10567 + printflags(iclog->ic_state, ic_flags, " state:");
10569 - kdb_printf("state: INVALID 0x%x", iclog->ic_state);
10570 + kdb_printf(" state: INVALID 0x%x", iclog->ic_state);
10572 } /* xfsidbg_xiclog */
10574 @@ -4150,6 +6215,44 @@
10578 +#ifdef XFS_LOG_TRACE
10580 + * Print trace from incore log.
10583 +xfsidbg_xiclogtrace(xlog_in_core_t *iclog)
10585 + ktrace_entry_t *ktep;
10586 + ktrace_snap_t kts;
10587 + ktrace_t *kt = iclog->ic_trace;
10589 + qprintf("iclog->ic_trace 0x%p\n", kt);
10590 + ktep = ktrace_first(kt, &kts);
10591 + while (ktep != NULL) {
10592 + switch ((__psint_t)ktep->val[0]) {
10593 + case XLOG_TRACE_GRAB_FLUSH: {
10594 + qprintf("grabbing semaphore\n");
10597 + case XLOG_TRACE_REL_FLUSH: {
10598 + qprintf("releasing semaphore\n");
10601 + case XLOG_TRACE_SLEEP_FLUSH: {
10602 + qprintf("sleeping on semaphore\n");
10605 + case XLOG_TRACE_WAKE_FLUSH: {
10606 + qprintf("waking up on semaphore\n");
10612 + ktep = ktrace_next(kt, &kts);
10614 +} /* xfsidbg_xiclogtrace */
10618 * Print all of the inodes attached to the given mount structure.
10619 @@ -4270,8 +6373,8 @@
10620 xfsidbg_get_cstate(log->l_covered_state));
10621 kdb_printf("flags: ");
10622 printflags(log->l_flags, t_flags,"log");
10623 - kdb_printf(" dev: %s logBBstart: %lld logsize: %d logBBsize: %d\n",
10624 - XFS_BUFTARG_NAME(log->l_targ), (long long) log->l_logBBstart,
10625 + kdb_printf(" logBBstart: %lld logsize: %d logBBsize: %d\n",
10626 + (long long) log->l_logBBstart,
10627 log->l_logsize,log->l_logBBsize);
10628 kdb_printf("curr_cycle: %d prev_cycle: %d curr_block: %d prev_block: %d\n",
10629 log->l_curr_cycle, log->l_prev_cycle, log->l_curr_block,
10630 @@ -4290,11 +6393,50 @@
10631 log->l_grant_write_cycle, log->l_grant_write_bytes);
10632 rbytes = log->l_grant_reserve_bytes + log->l_roundoff;
10633 wbytes = log->l_grant_write_bytes + log->l_roundoff;
10634 - kdb_printf("GResBlocks: %d GResRemain: %d GWrBlocks: %d GWrRemain: %d\n",
10635 + qprintf("GResBlocks: %d GResRemain: %d GWrBlocks: %d GWrRemain: %d\n",
10636 rbytes / BBSIZE, rbytes % BBSIZE,
10637 wbytes / BBSIZE, wbytes % BBSIZE);
10638 +#ifdef XFS_LOG_TRACE
10639 + qprintf("trace: 0x%p grant_trace: use xlog value\n", log->l_trace);
10641 } /* xfsidbg_xlog */
10643 +#ifdef XFS_LOG_TRACE
10645 + * Print grant trace for a log.
10648 +xfsidbg_xlog_granttrace(xlog_t *log)
10650 + ktrace_entry_t *ktep;
10651 + ktrace_snap_t kts;
10654 + if (((__psint_t)log) == ((__psint_t)-1)) {
10655 + qprintf("Usage: xl_grtr <log>\n");
10658 + if ((kt = log->l_grant_trace))
10659 + qprintf("log->l_grant_trace 0x%p\n", kt);
10661 + qprintf("log->l_grant_trace is empty!\n");
10664 + ktep = ktrace_first(kt, &kts);
10665 + while (ktep != NULL) {
10666 + qprintf("%s\n", (char *)ktep->val[11]);
10667 + qprintf(" tic:0x%p resQ:0x%p wrQ:0x%p ",
10668 + ktep->val[0], ktep->val[1], ktep->val[2]);
10669 + qprintf(" GrResC:%ld GrResB:%ld GrWrC:%ld GrWrB:%ld \n",
10670 + (long)ktep->val[3], (long)ktep->val[4],
10671 + (long)ktep->val[5], (long)ktep->val[6]);
10672 + qprintf(" HeadC:%ld HeadB:%ld TailC:%ld TailB:%ld\n",
10673 + (long)ktep->val[7], (long)ktep->val[8],
10674 + (long)ktep->val[9], (long)ktep->val[10]);
10675 + ktep = ktrace_next(kt, &kts);
10677 +} /* xfsidbg_xlog_granttrace */
10681 * Print out an XFS recovery transaction
10682 @@ -4488,10 +6630,10 @@
10684 printflags((uint)(lip->li_flags), li_flags,"log");
10686 - kdb_printf("ail forw 0x%p ail back 0x%p lsn %s desc %p ops 0x%p\n",
10687 + kdb_printf("ail forw 0x%p ail back 0x%p lsn %s\ndesc %p ops 0x%p",
10688 lip->li_ail.ail_forw, lip->li_ail.ail_back,
10689 xfs_fmtlsn(&(lip->li_lsn)), lip->li_desc, lip->li_ops);
10690 - kdb_printf("iodonefunc &0x%p\n", lip->li_cb);
10691 + kdb_printf(" iodonefunc &0x%p\n", lip->li_cb);
10692 if (lip->li_type == XFS_LI_BUF) {
10693 bio_lip = lip->li_bio_list;
10694 if (bio_lip != NULL) {
10695 @@ -4547,7 +6689,7 @@
10699 - "dquot", /* 10 */
10700 + "dquot", /* 10 */
10703 static char *li_flags[] = {
10704 @@ -4609,7 +6751,7 @@
10705 static char *xmount_flags[] = {
10706 "WSYNC", /* 0x0001 */
10707 "INO64", /* 0x0002 */
10708 - "RQCHK", /* 0x0004 */
10709 + "RQCHK", /* 0x0004 */
10710 "FSCLEAN", /* 0x0008 */
10711 "FSSHUTDN", /* 0x0010 */
10712 "NOATIME", /* 0x0020 */
10713 @@ -4646,14 +6788,11 @@
10714 XFS_MTOVFS(mp), mp->m_tid, &mp->m_ail_lock, &mp->m_ail);
10715 kdb_printf("ail_gen 0x%x &sb 0x%p\n",
10716 mp->m_ail_gen, &mp->m_sb);
10717 - kdb_printf("sb_lock 0x%p sb_bp 0x%p dev %s logdev %s rtdev %s\n",
10718 + kdb_printf("sb_lock 0x%p sb_bp 0x%p dev 0x%x logdev 0x%x rtdev 0x%x\n",
10719 &mp->m_sb_lock, mp->m_sb_bp,
10720 - mp->m_ddev_targp ?
10721 - XFS_BUFTARG_NAME(mp->m_ddev_targp) : "none",
10722 - mp->m_logdev_targp ?
10723 - XFS_BUFTARG_NAME(mp->m_logdev_targp) : "none",
10724 - mp->m_rtdev_targp ?
10725 - XFS_BUFTARG_NAME(mp->m_rtdev_targp) : "none");
10726 + mp->m_ddev_targp ? mp->m_ddev_targp->pbr_dev : 0,
10727 + mp->m_logdev_targp ? mp->m_logdev_targp->pbr_dev : 0,
10728 + mp->m_rtdev_targp ? mp->m_rtdev_targp->pbr_dev : 0);
10729 kdb_printf("bsize %d agfrotor %d agirotor %d ihash 0x%p ihsize %d\n",
10730 mp->m_bsize, mp->m_agfrotor, mp->m_agirotor,
10731 mp->m_ihash, mp->m_ihsize);
10732 @@ -4825,8 +6964,8 @@
10735 XFS_ITOV_NULL(ip));
10736 - kdb_printf("dev %s ino %s\n",
10737 - XFS_BUFTARG_NAME(ip->i_mount->m_ddev_targp),
10738 + kdb_printf("dev %x ino %s\n",
10739 + ip->i_mount->m_dev,
10740 xfs_fmtino(ip->i_ino, ip->i_mount));
10741 kdb_printf("blkno 0x%llx len 0x%x boffset 0x%x\n",
10742 (long long) ip->i_blkno,
10743 @@ -4835,7 +6974,7 @@
10744 kdb_printf("transp 0x%p &itemp 0x%p\n",
10747 - kdb_printf("&lock 0x%p &iolock 0x%p",
10748 + kdb_printf("&lock 0x%p &iolock 0x%p ",
10751 kdb_printf("&flock 0x%p (%d) pincount 0x%x\n",
10752 @@ -4843,14 +6982,29 @@
10753 xfs_ipincount(ip));
10754 kdb_printf("udquotp 0x%p gdquotp 0x%p\n",
10755 ip->i_udquot, ip->i_gdquot);
10756 - kdb_printf("new_size %Lx\n", ip->i_iocore.io_new_size);
10757 + kdb_printf("new_size %Ld\n", ip->i_iocore.io_new_size);
10758 printflags((int)ip->i_flags, tab_flags, "flags");
10760 - kdb_printf("update_core 0x%x update size 0x%x\n",
10761 + kdb_printf("update_core %d update size %d\n",
10762 (int)(ip->i_update_core), (int) ip->i_update_size);
10763 kdb_printf("gen 0x%x delayed blks %d",
10765 ip->i_delayed_blks);
10766 +#ifdef XFS_BMAP_TRACE
10767 + qprintf(" bmap_trace 0x%p\n", ip->i_xtrace);
10769 +#ifdef XFS_BMBT_TRACE
10770 + qprintf(" bmbt trace 0x%p\n", ip->i_btrace);
10772 +#ifdef XFS_RW_TRACE
10773 + qprintf(" rw trace 0x%p\n", ip->i_rwtrace);
10775 +#ifdef XFS_ILOCK_TRACE
10776 + qprintf(" ilock trace 0x%p\n", ip->i_lock_trace);
10778 +#ifdef XFS_DIR2_TRACE
10779 + qprintf(" dir trace 0x%p\n", ip->i_dir_trace);
10782 kdb_printf("chash 0x%p cnext 0x%p cprev 0x%p\n",
10784 @@ -5032,6 +7186,9 @@
10786 (valusema(&dqp->q_flock) <= 0) ? "LCK" : "UNLKD",
10788 +#ifdef XFS_DQUOT_TRACE
10789 + qprintf("dqtrace 0x%p\n", dqp->q_trace);
10791 kdb_printf("disk-dquot 0x%p\n", &dqp->q_core);
10792 xfsidbg_xqm_diskdq(&dqp->q_core);
10794 @@ -5076,7 +7233,7 @@
10795 kdb_printf("\nNumber of inodes with dquots attached: %d\n", n);
10798 -#ifdef CONFIG_XFS_QUOTA
10799 +#ifdef CONFIG_XFS_QUOTA
10801 xfsidbg_xqm_freelist_print(xfs_frlist_t *qlist, char *title)
10803 @@ -5130,6 +7287,80 @@
10807 +#ifdef XFS_DQUOT_TRACE
10809 +xfsidbg_xqm_pr_dqentry(ktrace_entry_t *ktep)
10811 + static char *xdq_flags[] = {
10814 + "LCKD", /* 0x4 */
10816 + "FLOCKD", /* 0x08 */
10817 + "DIRTY", /* 0x10 */
10818 + "WANT", /* 0x20 */
10819 + "INACT", /* 0x40 */
10820 + "MARKER", /* 0x80 */
10824 + if ((__psint_t)ktep->val[0] == 0)
10826 + switch ((__psint_t)ktep->val[0]) {
10827 + case DQUOT_KTRACE_ENTRY:
10828 + qprintf("[%ld] %s\t",
10829 + (long)ktep->val[12], /* pid */
10830 + (char *)ktep->val[1]);
10831 + printflags((__psint_t)ktep->val[3], xdq_flags,"flgs ");
10832 + qprintf("\nnrefs = %u, "
10835 + "res_bc = 0x%x\n"
10836 + "bcnt = 0x%x [0x%x | 0x%x], "
10837 + "icnt = 0x%x [0x%x | 0x%x]\n"
10839 + (unsigned int)(long)ktep->val[2], /* nrefs */
10840 + (unsigned int)(long)ktep->val[3], /* flags */
10841 + (unsigned int)(long)ktep->val[11], /* ID */
10842 + (unsigned int)(long)ktep->val[4], /* res_bc */
10843 + (unsigned int)(long)ktep->val[5], /* bcnt */
10844 + (unsigned int)(long)ktep->val[8], /* bsoft */
10845 + (unsigned int)(long)ktep->val[7], /* bhard */
10846 + (unsigned int)(long)ktep->val[6], /* icnt */
10847 + (unsigned int)(long)ktep->val[10], /* isoft */
10848 + (unsigned int)(long)ktep->val[9], /* ihard */
10849 + (long) ktep->val[13] /* time */
10854 + qprintf("unknown dqtrace record\n");
10861 +xfsidbg_xqm_dqtrace(xfs_dquot_t *dqp)
10863 + ktrace_entry_t *ktep;
10864 + ktrace_snap_t kts;
10866 + if (dqp->q_trace == NULL) {
10867 + qprintf("The xfs dquot trace buffer is not initialized\n");
10870 + qprintf("xdqtrace dquot 0x%p\n", dqp);
10872 + ktep = ktrace_first(dqp->q_trace, &kts);
10873 + while (ktep != NULL) {
10874 + if (xfsidbg_xqm_pr_dqentry(ktep))
10875 + qprintf("---------------------------------\n");
10876 + ktep = ktrace_next(dqp->q_trace, &kts);
10882 xfsidbg_xqm_mplist(xfs_mount_t *mp)
10884 @@ -5206,7 +7437,54 @@
10888 +#ifdef XFS_RW_TRACE
10890 + * Print out the read/write trace buffer attached to the given inode.
10893 +xfsidbg_xrwtrace(xfs_inode_t *ip)
10895 + ktrace_entry_t *ktep;
10896 + ktrace_snap_t kts;
10898 + int skip_entries;
10899 + int count = xargument;
10901 + if (ip->i_rwtrace == NULL) {
10902 + qprintf("The inode trace buffer is not initialized\n");
10905 + qprintf("i_rwtrace = 0x%p\n", ip->i_rwtrace);
10907 + nentries = ktrace_nentries(ip->i_rwtrace);
10908 + if (count == -1) {
10909 + count = nentries;
10911 + if ((count <= 0) || (count > nentries)) {
10912 + qprintf("Invalid count. There are %d entries.\n", nentries);
10916 + ktep = ktrace_first(ip->i_rwtrace, &kts);
10917 + if (count != nentries) {
10919 + * Skip the total minus the number to look at minus one
10920 + * for the entry returned by ktrace_first().
10922 + skip_entries = count - nentries - 1;
10923 + ktep = ktrace_skip(ip->i_rwtrace, skip_entries, &kts);
10924 + if (ktep == NULL) {
10925 + qprintf("Skipped them all\n");
10929 + while (ktep != NULL) {
10930 + if (xfs_rw_trace_entry(ktep))
10932 + ktep = ktrace_next(ip->i_rwtrace, &kts);
10938 * Print xfs superblock.
10939 @@ -5284,7 +7562,7 @@
10941 "sb_dirty", /* 0x2 */
10942 "perm_log_res", /* 0x4 */
10943 - "sync", /* 0x08 */
10944 + "sync", /* 0x08 */
10945 "dq_dirty", /* 0x10 */
10948 @@ -5298,7 +7576,7 @@
10950 kdb_printf("tp 0x%p type ", tp);
10951 switch (tp->t_type) {
10952 - case XFS_TRANS_SETATTR_NOT_SIZE: kdb_printf("SETATTR_NOT_SIZE"); break;
10953 + case XFS_TRANS_SETATTR_NOT_SIZE: kdb_printf("SETATTR_NOT_SIZE");break;
10954 case XFS_TRANS_SETATTR_SIZE: kdb_printf("SETATTR_SIZE"); break;
10955 case XFS_TRANS_INACTIVE: kdb_printf("INACTIVE"); break;
10956 case XFS_TRANS_CREATE: kdb_printf("CREATE"); break;
10957 @@ -5310,32 +7588,31 @@
10958 case XFS_TRANS_MKDIR: kdb_printf("MKDIR"); break;
10959 case XFS_TRANS_RMDIR: kdb_printf("RMDIR"); break;
10960 case XFS_TRANS_SYMLINK: kdb_printf("SYMLINK"); break;
10961 - case XFS_TRANS_SET_DMATTRS: kdb_printf("SET_DMATTRS"); break;
10962 + case XFS_TRANS_SET_DMATTRS: kdb_printf("SET_DMATTRS"); break;
10963 case XFS_TRANS_GROWFS: kdb_printf("GROWFS"); break;
10964 - case XFS_TRANS_STRAT_WRITE: kdb_printf("STRAT_WRITE"); break;
10965 + case XFS_TRANS_STRAT_WRITE: kdb_printf("STRAT_WRITE"); break;
10966 case XFS_TRANS_DIOSTRAT: kdb_printf("DIOSTRAT"); break;
10967 - case XFS_TRANS_WRITE_SYNC: kdb_printf("WRITE_SYNC"); break;
10968 + case XFS_TRANS_WRITE_SYNC: kdb_printf("WRITE_SYNC"); break;
10969 case XFS_TRANS_WRITEID: kdb_printf("WRITEID"); break;
10970 case XFS_TRANS_ADDAFORK: kdb_printf("ADDAFORK"); break;
10971 - case XFS_TRANS_ATTRINVAL: kdb_printf("ATTRINVAL"); break;
10972 - case XFS_TRANS_ATRUNCATE: kdb_printf("ATRUNCATE"); break;
10973 + case XFS_TRANS_ATTRINVAL: kdb_printf("ATTRINVAL"); break;
10974 + case XFS_TRANS_ATRUNCATE: kdb_printf("ATRUNCATE"); break;
10975 case XFS_TRANS_ATTR_SET: kdb_printf("ATTR_SET"); break;
10976 case XFS_TRANS_ATTR_RM: kdb_printf("ATTR_RM"); break;
10977 - case XFS_TRANS_ATTR_FLAG: kdb_printf("ATTR_FLAG"); break;
10978 - case XFS_TRANS_CLEAR_AGI_BUCKET: kdb_printf("CLEAR_AGI_BUCKET"); break;
10979 + case XFS_TRANS_ATTR_FLAG: kdb_printf("ATTR_FLAG"); break;
10980 + case XFS_TRANS_CLEAR_AGI_BUCKET:kdb_printf("CLEAR_AGI_BUCKET"); break;
10981 case XFS_TRANS_QM_SBCHANGE: kdb_printf("QM_SBCHANGE"); break;
10982 case XFS_TRANS_QM_QUOTAOFF: kdb_printf("QM_QUOTAOFF"); break;
10983 - case XFS_TRANS_QM_DQALLOC: kdb_printf("QM_DQALLOC"); break;
10984 - case XFS_TRANS_QM_SETQLIM: kdb_printf("QM_SETQLIM"); break;
10985 + case XFS_TRANS_QM_DQALLOC: kdb_printf("QM_DQALLOC"); break;
10986 + case XFS_TRANS_QM_SETQLIM: kdb_printf("QM_SETQLIM"); break;
10987 case XFS_TRANS_QM_DQCLUSTER: kdb_printf("QM_DQCLUSTER"); break;
10988 case XFS_TRANS_QM_QINOCREATE: kdb_printf("QM_QINOCREATE"); break;
10989 - case XFS_TRANS_QM_QUOTAOFF_END: kdb_printf("QM_QOFF_END"); break;
10990 + case XFS_TRANS_QM_QUOTAOFF_END: kdb_printf("QM_QOFF_END"); break;
10991 case XFS_TRANS_SB_UNIT: kdb_printf("SB_UNIT"); break;
10992 case XFS_TRANS_FSYNC_TS: kdb_printf("FSYNC_TS"); break;
10993 case XFS_TRANS_GROWFSRT_ALLOC: kdb_printf("GROWFSRT_ALLOC"); break;
10994 case XFS_TRANS_GROWFSRT_ZERO: kdb_printf("GROWFSRT_ZERO"); break;
10995 case XFS_TRANS_GROWFSRT_FREE: kdb_printf("GROWFSRT_FREE"); break;
10997 default: kdb_printf("0x%x", tp->t_type); break;
10999 kdb_printf(" mount 0x%p\n", tp->t_mountp);
11000 diff -urN linux.org/fs/xfs/xfs_iget.c linux/fs/xfs/xfs_iget.c
11001 --- linux.org/fs/xfs/xfs_iget.c 2003-12-31 05:48:38.000000000 +0100
11002 +++ linux/fs/xfs/xfs_iget.c 2004-01-02 04:21:44.000000000 +0100
11003 @@ -445,18 +445,17 @@
11005 XFS_STATS_INC(xs_ig_attempts);
11007 - if ((inode = iget_locked(XFS_MTOVFS(mp)->vfs_super, ino))) {
11008 + if ((inode = VFS_GET_INODE(XFS_MTOVFS(mp), ino, 0))) {
11014 vp = LINVFS_GET_VP(inode);
11015 if (inode->i_state & I_NEW) {
11017 vn_initialize(inode);
11018 error = xfs_iget_core(vp, mp, tp, ino,
11019 - lock_flags, ipp, bno);
11020 + lock_flags, ipp, bno);
11022 make_bad_inode(inode);
11023 if (inode->i_state & I_NEW)
11024 @@ -506,9 +505,6 @@
11025 mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER,
11026 "xfsino", (long)vp->v_number);
11027 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", vp->v_number);
11029 - mutex_init(&ip->i_range_lock.r_spinlock, MUTEX_SPIN, "xrange");
11030 -#endif /* NOTYET */
11031 init_waitqueue_head(&ip->i_ipin_wait);
11032 atomic_set(&ip->i_pincount, 0);
11033 init_sema(&ip->i_flock, 1, "xfsfino", vp->v_number);
11034 @@ -830,9 +826,7 @@
11035 } else if (lock_flags & XFS_ILOCK_SHARED) {
11036 mraccess(&ip->i_lock);
11038 -#ifdef XFS_ILOCK_TRACE
11039 - xfs_ilock_trace(ip, 1, lock_flags, (inst_t *)return_address);
11041 + xfs_ilock_trace(ip, 1, lock_flags, (inst_t *)__return_address);
11045 @@ -895,9 +889,7 @@
11049 -#ifdef XFS_ILOCK_TRACE
11050 xfs_ilock_trace(ip, 2, lock_flags, (inst_t *)__return_address);
11055 @@ -955,9 +947,7 @@
11056 (xfs_log_item_t*)(ip->i_itemp));
11059 -#ifdef XFS_ILOCK_TRACE
11060 xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address);
11065 diff -urN linux.org/fs/xfs/xfs_inode.c linux/fs/xfs/xfs_inode.c
11066 --- linux.org/fs/xfs/xfs_inode.c 2003-12-31 05:48:38.000000000 +0100
11067 +++ linux/fs/xfs/xfs_inode.c 2004-01-02 04:21:44.000000000 +0100
11068 @@ -908,9 +908,6 @@
11069 #ifdef XFS_RW_TRACE
11070 ip->i_rwtrace = ktrace_alloc(XFS_RW_KTRACE_SIZE, KM_SLEEP);
11072 -#ifdef XFS_STRAT_TRACE
11073 - ip->i_strat_trace = ktrace_alloc(XFS_STRAT_KTRACE_SIZE, KM_SLEEP);
11075 #ifdef XFS_ILOCK_TRACE
11076 ip->i_lock_trace = ktrace_alloc(XFS_ILOCK_KTRACE_SIZE, KM_SLEEP);
11078 @@ -1144,8 +1141,8 @@
11079 ip->i_d.di_onlink = 0;
11080 ip->i_d.di_nlink = nlink;
11081 ASSERT(ip->i_d.di_nlink == nlink);
11082 - ip->i_d.di_uid = current->fsuid;
11083 - ip->i_d.di_gid = current->fsgid;
11084 + ip->i_d.di_uid = current_fsuid(cr);
11085 + ip->i_d.di_gid = current_fsgid(cr);
11086 ip->i_d.di_projid = prid;
11087 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
11089 @@ -1362,16 +1359,16 @@
11090 ktrace_enter(ip->i_rwtrace,
11091 (void*)((long)tag),
11093 - (void*)((ip->i_d.di_size >> 32) & 0xffffffff),
11094 - (void*)(ip->i_d.di_size & 0xffffffff),
11095 + (void*)(unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff),
11096 + (void*)(unsigned long)(ip->i_d.di_size & 0xffffffff),
11097 (void*)((long)flag),
11098 - (void*)((new_size >> 32) & 0xffffffff),
11099 - (void*)(new_size & 0xffffffff),
11100 - (void*)((toss_start >> 32) & 0xffffffff),
11101 - (void*)(toss_start & 0xffffffff),
11102 - (void*)((toss_finish >> 32) & 0xffffffff),
11103 - (void*)(toss_finish & 0xffffffff),
11104 - (void*)((long)private.p_cpuid),
11105 + (void*)(unsigned long)((new_size >> 32) & 0xffffffff),
11106 + (void*)(unsigned long)(new_size & 0xffffffff),
11107 + (void*)(unsigned long)((toss_start >> 32) & 0xffffffff),
11108 + (void*)(unsigned long)(toss_start & 0xffffffff),
11109 + (void*)(unsigned long)((toss_finish >> 32) & 0xffffffff),
11110 + (void*)(unsigned long)(toss_finish & 0xffffffff),
11111 + (void*)(unsigned long)current_cpu(),
11115 @@ -2755,17 +2752,8 @@
11118 xfs_idestroy_fork(ip, XFS_ATTR_FORK);
11120 - if (ip->i_range_lock.r_sleep != NULL) {
11121 - freesema(ip->i_range_lock.r_sleep);
11122 - kmem_free(ip->i_range_lock.r_sleep, sizeof(sema_t));
11124 -#endif /* NOTYET */
11125 mrfree(&ip->i_lock);
11126 mrfree(&ip->i_iolock);
11128 - mutex_destroy(&ip->i_range_lock.r_spinlock);
11129 -#endif /* NOTYET */
11130 freesema(&ip->i_flock);
11131 #ifdef XFS_BMAP_TRACE
11132 ktrace_free(ip->i_xtrace);
11133 @@ -2776,9 +2764,6 @@
11134 #ifdef XFS_RW_TRACE
11135 ktrace_free(ip->i_rwtrace);
11137 -#ifdef XFS_STRAT_TRACE
11138 - ktrace_free(ip->i_strat_trace);
11140 #ifdef XFS_ILOCK_TRACE
11141 ktrace_free(ip->i_lock_trace);
11143 @@ -3707,7 +3692,7 @@
11144 if ((error = _ACL_XFS_IACCESS(ip, mode, cr)) != -1)
11145 return error ? XFS_ERROR(error) : 0;
11147 - if (current->fsuid != ip->i_d.di_uid) {
11148 + if (current_fsuid(cr) != ip->i_d.di_uid) {
11150 if (!in_group_p((gid_t)ip->i_d.di_gid))
11152 @@ -3814,7 +3799,7 @@
11153 * We're not supposed to change timestamps in readonly-mounted
11154 * filesystems. Throw it away if anyone asks us.
11156 - if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
11157 + if (unlikely(vp->v_vfsp->vfs_flag & VFS_RDONLY))
11161 @@ -3828,17 +3813,17 @@
11164 if (flags & XFS_ICHGTIME_MOD) {
11165 - inode->i_mtime = tv;
11166 + VN_MTIMESET(vp, &tv);
11167 ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
11168 ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
11170 if (flags & XFS_ICHGTIME_ACC) {
11171 - inode->i_atime = tv;
11172 + VN_ATIMESET(vp, &tv);
11173 ip->i_d.di_atime.t_sec = (__int32_t)tv.tv_sec;
11174 ip->i_d.di_atime.t_nsec = (__int32_t)tv.tv_nsec;
11176 if (flags & XFS_ICHGTIME_CHG) {
11177 - inode->i_ctime = tv;
11178 + VN_CTIMESET(vp, &tv);
11179 ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec;
11180 ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec;
11182 @@ -3859,17 +3844,18 @@
11185 #ifdef XFS_ILOCK_TRACE
11186 +ktrace_t *xfs_ilock_trace_buf;
11189 xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra)
11191 ktrace_enter(ip->i_lock_trace,
11193 - (void *)(__psint_t)lock, /* 1 = LOCK, 3=UNLOCK, etc */
11194 - (void *)(__psint_t)lockflags, /* XFS_ILOCK_EXCL etc */
11195 - (void *)ra, /* caller of ilock */
11196 - (void *)(__psint_t)cpuid(),
11197 - (void *)(__psint_t)current_pid(),
11198 + (void *)(unsigned long)lock, /* 1 = LOCK, 3=UNLOCK, etc */
11199 + (void *)(unsigned long)lockflags, /* XFS_ILOCK_EXCL etc */
11200 + (void *)ra, /* caller of ilock */
11201 + (void *)(unsigned long)current_cpu(),
11202 + (void *)(unsigned long)current_pid(),
11203 0,0,0,0,0,0,0,0,0,0);
11206 -#endif /* ILOCK_TRACE */
11208 diff -urN linux.org/fs/xfs/xfs_inode.h linux/fs/xfs/xfs_inode.h
11209 --- linux.org/fs/xfs/xfs_inode.h 2003-12-31 05:48:01.000000000 +0100
11210 +++ linux/fs/xfs/xfs_inode.h 2004-01-02 04:21:44.000000000 +0100
11215 +#if defined(XFS_ILOCK_TRACE)
11216 +#define XFS_ILOCK_KTRACE_SIZE 32
11217 +extern ktrace_t *xfs_ilock_trace_buf;
11218 +extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
11220 +#define xfs_ilock_trace(i,n,f,ra)
11224 * This structure is used to communicate which extents of a file
11225 @@ -264,7 +271,10 @@
11226 sema_t i_flock; /* inode flush lock */
11227 atomic_t i_pincount; /* inode pin count */
11228 wait_queue_head_t i_ipin_wait; /* inode pinning wait queue */
11230 +#ifdef HAVE_REFCACHE
11231 + struct xfs_inode **i_refcache; /* ptr to entry in ref cache */
11232 + struct xfs_inode *i_release; /* inode to unref */
11235 xfs_iocore_t i_iocore; /* I/O core */
11237 @@ -280,15 +290,22 @@
11238 struct xfs_inode *i_cnext; /* cluster hash link forward */
11239 struct xfs_inode *i_cprev; /* cluster hash link backward */
11242 /* Trace buffers per inode. */
11243 +#ifdef XFS_BMAP_TRACE
11244 struct ktrace *i_xtrace; /* inode extent list trace */
11246 +#ifdef XFS_BMBT_TRACE
11247 struct ktrace *i_btrace; /* inode bmap btree trace */
11249 +#ifdef XFS_RW_TRACE
11250 struct ktrace *i_rwtrace; /* inode read/write trace */
11251 - struct ktrace *i_strat_trace; /* inode strat_write trace */
11253 +#ifdef XFS_ILOCK_TRACE
11254 struct ktrace *i_lock_trace; /* inode lock/unlock trace */
11256 +#ifdef XFS_DIR2_TRACE
11257 struct ktrace *i_dir_trace; /* inode directory trace */
11258 -#endif /* DEBUG */
11262 #endif /* __KERNEL__ */
11263 @@ -536,12 +553,6 @@
11264 extern struct kmem_zone *xfs_ili_zone;
11265 extern struct vnodeops xfs_vnodeops;
11267 -#ifdef XFS_ILOCK_TRACE
11268 -#define XFS_ILOCK_KTRACE_SIZE 32
11269 -void xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags,
11273 #endif /* __KERNEL__ */
11275 #endif /* __XFS_INODE_H__ */
11276 diff -urN linux.org/fs/xfs/xfs_iocore.c linux/fs/xfs/xfs_iocore.c
11277 --- linux.org/fs/xfs/xfs_iocore.c 2003-12-31 05:48:05.000000000 +0100
11278 +++ linux/fs/xfs/xfs_iocore.c 2004-01-02 04:21:44.000000000 +0100
11280 #include "xfs_rw.h"
11281 #include "xfs_quota.h"
11282 #include "xfs_trans_space.h"
11283 +#include "xfs_iomap.h"
11287 diff -urN linux.org/fs/xfs/xfs_iomap.h linux/fs/xfs/xfs_iomap.h
11288 --- linux.org/fs/xfs/xfs_iomap.h 1970-01-01 01:00:00.000000000 +0100
11289 +++ linux/fs/xfs/xfs_iomap.h 2004-01-02 04:21:44.000000000 +0100
11292 + * Copyright (c) 2003 Silicon Graphics, Inc. All Rights Reserved.
11294 + * This program is free software; you can redistribute it and/or modify it
11295 + * under the terms of version 2 of the GNU General Public License as
11296 + * published by the Free Software Foundation.
11298 + * This program is distributed in the hope that it would be useful, but
11299 + * WITHOUT ANY WARRANTY; without even the implied warranty of
11300 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11302 + * Further, this software is distributed without any warranty that it is
11303 + * free of the rightful claim of any third person regarding infringement
11304 + * or the like. Any license provided herein, whether implied or
11305 + * otherwise, applies only to this software file. Patent licenses, if
11306 + * any, provided herein do not apply to combinations of this program with
11307 + * other software, or any other product whatsoever.
11309 + * You should have received a copy of the GNU General Public License along
11310 + * with this program; if not, write the Free Software Foundation, Inc., 59
11311 + * Temple Place - Suite 330, Boston MA 02111-1307, USA.
11313 + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
11314 + * Mountain View, CA 94043, or:
11316 + * http://www.sgi.com
11318 + * For further information regarding this notice, see:
11320 + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
11325 +#ifndef __XFS_IOMAP_H__
11326 +#define __XFS_IOMAP_H__
11328 +#define IOMAP_DADDR_NULL ((xfs_daddr_t) (-1LL))
11331 +typedef enum { /* iomap_flags values */
11332 + IOMAP_EOF = 0x01, /* mapping contains EOF */
11333 + IOMAP_HOLE = 0x02, /* mapping covers a hole */
11334 + IOMAP_DELAY = 0x04, /* mapping covers delalloc region */
11335 + IOMAP_UNWRITTEN = 0x20, /* mapping covers allocated */
11336 + /* but uninitialized file data */
11337 + IOMAP_NEW = 0x40 /* just allocate */
11341 + /* base extent manipulation calls */
11342 + BMAPI_READ = (1 << 0), /* read extents */
11343 + BMAPI_WRITE = (1 << 1), /* create extents */
11344 + BMAPI_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
11345 + BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
11347 + BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
11348 + BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
11349 + BMAPI_MMAP = (1 << 6), /* allocate for mmap write */
11350 + BMAPI_SYNC = (1 << 7), /* sync write */
11351 + BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */
11352 + BMAPI_DEVICE = (1 << 9), /* we only want to know the device */
11357 + * xfs_iomap_t: File system I/O map
11359 + * The iomap_bn, iomap_offset and iomap_length fields are expressed in disk blocks.
11360 + * The iomap_length field specifies the size of the underlying backing store
11361 + * for the particular mapping.
11363 + * The iomap_bsize, iomap_size and iomap_delta fields are in bytes and indicate
11364 + * the size of the mapping, the number of bytes that are valid to access
11365 + * (read or write), and the offset into the mapping, given the offset
11366 + * supplied to the file I/O map routine. iomap_delta is the offset of the
11367 + * desired data from the beginning of the mapping.
11369 + * When a request is made to read beyond the logical end of the object,
11370 + * iomap_size may be set to 0, but iomap_offset and iomap_length should be set to
11371 + * the actual amount of underlying storage that has been allocated, if any.
11374 +typedef struct xfs_iomap {
11375 + xfs_daddr_t iomap_bn;
11376 + xfs_buftarg_t *iomap_target;
11377 + loff_t iomap_offset;
11378 + size_t iomap_delta;
11379 + size_t iomap_bsize;
11380 + iomap_flags_t iomap_flags;
11383 +struct xfs_iocore;
11385 +struct xfs_bmbt_irec;
11387 +extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int,
11388 + struct xfs_iomap *, int *);
11389 +extern int xfs_iomap_write_direct(struct xfs_inode *, loff_t, size_t,
11390 + int, struct xfs_bmbt_irec *, int *, int);
11391 +extern int xfs_iomap_write_delay(struct xfs_inode *, loff_t, size_t, int,
11392 + struct xfs_bmbt_irec *, int *);
11393 +extern int xfs_iomap_write_allocate(struct xfs_inode *,
11394 + struct xfs_bmbt_irec *, int *);
11395 +extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t);
11397 +#endif /* __XFS_IOMAP_H__*/
11398 diff -urN linux.org/fs/xfs/xfs_itable.c linux/fs/xfs/xfs_itable.c
11399 --- linux.org/fs/xfs/xfs_itable.c 2003-12-31 05:46:26.000000000 +0100
11400 +++ linux/fs/xfs/xfs_itable.c 2004-01-02 04:21:44.000000000 +0100
11402 xfs_trans_t *tp, /* transaction pointer */
11403 xfs_ino_t ino, /* inode number to get data for */
11404 void *buffer, /* buffer to place output in */
11405 + int ubsize, /* size of buffer */
11406 + void *private_data, /* my private data */
11407 xfs_daddr_t bno, /* starting bno of inode cluster */
11408 + int *ubused, /* bytes used by me */
11409 void *dibuff, /* on-disk inode buffer */
11410 int *stat) /* BULKSTAT_RV_... */
11413 *stat = BULKSTAT_RV_NOTHING;
11414 return XFS_ERROR(EINVAL);
11416 + if (ubsize < sizeof(*buf)) {
11417 + *stat = BULKSTAT_RV_NOTHING;
11418 + return XFS_ERROR(ENOMEM);
11422 /* We're not being passed a pointer to a dinode. This happens
11423 @@ -218,6 +225,8 @@
11426 *stat = BULKSTAT_RV_DIDONE;
11428 + *ubused = sizeof(*buf);
11432 @@ -231,6 +240,7 @@
11433 xfs_ino_t *lastinop, /* last inode returned */
11434 int *ubcountp, /* size of buffer/count returned */
11435 bulkstat_one_pf formatter, /* func that'd fill a single buf */
11436 + void *private_data,/* private data for formatter */
11437 size_t statstruct_size, /* sizeof struct filling */
11438 xfs_caddr_t ubuffer, /* buffer with inode stats */
11439 int flags, /* defined in xfs_itable.h */
11440 @@ -265,8 +275,10 @@
11441 int rval; /* return value error code */
11442 int tmp; /* result value from btree calls */
11443 int ubcount; /* size of user's buffer */
11444 - int ubleft; /* spaces left in user's buffer */
11445 + int ubleft; /* bytes left in user's buffer */
11446 xfs_caddr_t ubufp; /* current pointer into user's buffer */
11447 + int ubelem; /* spaces used in user's buffer */
11448 + int ubused; /* bytes used by formatter */
11449 xfs_buf_t *bp; /* ptr to on-disk inode cluster buf */
11450 xfs_dinode_t *dip; /* ptr into bp for specific inode */
11451 xfs_inode_t *ip; /* ptr to in-core inode struct */
11452 @@ -284,8 +296,9 @@
11456 - ubcount = ubleft = *ubcountp;
11458 + ubcount = *ubcountp; /* statstruct's */
11459 + ubleft = ubcount * statstruct_size; /* bytes */
11460 + *ubcountp = ubelem = 0;
11464 @@ -317,7 +330,7 @@
11465 * inode returned; 0 means start of the allocation group.
11468 - while (ubleft > 0 && agno < mp->m_sb.sb_agcount) {
11469 + while ((ubleft/statstruct_size) > 0 && agno < mp->m_sb.sb_agcount) {
11471 down_read(&mp->m_peraglock);
11472 error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
11473 @@ -402,7 +415,7 @@
11474 * Loop through inode btree records in this ag,
11475 * until we run out of inodes or space in the buffer.
11477 - while (irbp < irbufend && icount < ubcount) {
11478 + while (irbp < irbufend && icount < (ubleft/statstruct_size)) {
11480 * Loop as long as we're unable to read the
11482 @@ -453,7 +466,8 @@
11483 * Now format all the good inodes into the user's buffer.
11486 - for (irbp = irbuf; irbp < irbufend && ubleft > 0; irbp++) {
11487 + for (irbp = irbuf;
11488 + irbp < irbufend && (ubleft/statstruct_size) > 0; irbp++) {
11490 * Read-ahead the next chunk's worth of inodes.
11492 @@ -561,14 +575,19 @@
11493 * Get the inode and fill in a single buffer.
11494 * BULKSTAT_FG_QUICK uses dip to fill it in.
11495 * BULKSTAT_FG_IGET uses igets.
11496 - * See: xfs_bulkstat_one & dm_bulkstat_one.
11497 + * See: xfs_bulkstat_one & xfs_dm_bulkstat_one.
11498 * This is also used to count inodes/blks, etc
11499 * in xfs_qm_quotacheck.
11501 - error = formatter(mp, tp, ino, ubufp, bno, dip,
11503 - if (fmterror == BULKSTAT_RV_NOTHING)
11504 + ubused = statstruct_size;
11505 + error = formatter(mp, tp, ino, ubufp,
11506 + ubleft, private_data,
11507 + bno, &ubused, dip, &fmterror);
11508 + if (fmterror == BULKSTAT_RV_NOTHING) {
11509 + if (error == ENOMEM)
11513 if (fmterror == BULKSTAT_RV_GIVEUP) {
11516 @@ -576,8 +595,9 @@
11520 - ubufp += statstruct_size;
11523 + ubleft -= ubused;
11528 @@ -605,7 +625,7 @@
11530 unuseracc(ubuffer, ubcount * statstruct_size, (B_READ|B_PHYS));
11532 - *ubcountp = ubcount - ubleft;
11533 + *ubcountp = ubelem;
11534 if (agno >= mp->m_sb.sb_agcount) {
11536 * If we ran out of filesystem, mark lastino as off
11537 @@ -647,7 +667,8 @@
11540 ino = (xfs_ino_t)*lastinop;
11541 - error = xfs_bulkstat_one(mp, NULL, ino, &bstat, 0, 0, &res);
11542 + error = xfs_bulkstat_one(mp, NULL, ino, &bstat, sizeof(bstat),
11543 + NULL, 0, NULL, NULL, &res);
11546 * Special case way failed, do it the "long" way
11547 @@ -656,6 +677,7 @@
11550 if (xfs_bulkstat(mp, NULL, lastinop, &count, xfs_bulkstat_one,
11552 sizeof(bstat), buffer, BULKSTAT_FG_IGET, done))
11554 if (count == 0 || (xfs_ino_t)*lastinop != ino)
11555 diff -urN linux.org/fs/xfs/xfs_itable.h linux/fs/xfs/xfs_itable.h
11556 --- linux.org/fs/xfs/xfs_itable.h 2003-12-31 05:48:36.000000000 +0100
11557 +++ linux/fs/xfs/xfs_itable.h 2004-01-02 04:21:42.000000000 +0100
11558 @@ -36,15 +36,19 @@
11559 * xfs_bulkstat() is used to fill in xfs_bstat structures as well as dm_stat
11560 * structures (by the dmi library). This is a pointer to a formatter function
11561 * that will iget the inode and fill in the appropriate structure.
11562 - * see xfs_bulkstat_one() and dm_bulkstat_one() in dmi_xfs.c
11563 + * see xfs_bulkstat_one() and xfs_dm_bulkstat_one() in dmapi_xfs.c
11565 typedef int (*bulkstat_one_pf)(struct xfs_mount *mp,
11566 struct xfs_trans *tp,
11570 + void *private_data,
11577 * Values for stat return value.
11580 xfs_ino_t *lastino, /* last inode returned */
11581 int *count, /* size of buffer/count returned */
11582 bulkstat_one_pf formatter, /* func that'd fill a single buf */
11583 + void *private_data, /* private data for formatter */
11584 size_t statstruct_size,/* sizeof struct that we're filling */
11585 xfs_caddr_t ubuffer, /* buffer with inode stats */
11586 int flags, /* flag to control access method */
11592 + void *private_data,
11598 diff -urN linux.org/fs/xfs/xfs_log.c linux/fs/xfs/xfs_log.c
11599 --- linux.org/fs/xfs/xfs_log.c 2003-12-31 05:48:47.000000000 +0100
11600 +++ linux/fs/xfs/xfs_log.c 2004-01-02 04:21:42.000000000 +0100
11601 @@ -159,11 +159,15 @@
11604 #if defined(XFS_LOG_TRACE)
11607 xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
11609 - if (! log->l_grant_trace)
11610 - log->l_grant_trace = ktrace_alloc(1024, KM_SLEEP);
11611 + if (! log->l_grant_trace) {
11612 + log->l_grant_trace = ktrace_alloc(1024, KM_NOSLEEP);
11613 + if (! log->l_grant_trace)
11617 ktrace_enter(log->l_grant_trace,
11619 @@ -185,31 +189,6 @@
11623 -xlog_trace_tic(xlog_t *log, xlog_ticket_t *tic)
11625 - if (! log->l_trace)
11626 - log->l_trace = ktrace_alloc(256, KM_SLEEP);
11628 - ktrace_enter(log->l_trace,
11630 - (void *)((unsigned long)tic->t_curr_res),
11631 - (void *)((unsigned long)tic->t_unit_res),
11632 - (void *)((unsigned long)tic->t_ocnt),
11633 - (void *)((unsigned long)tic->t_cnt),
11634 - (void *)((unsigned long)tic->t_flags),
11635 - (void *)((unsigned long)7),
11636 - (void *)((unsigned long)8),
11637 - (void *)((unsigned long)9),
11638 - (void *)((unsigned long)10),
11639 - (void *)((unsigned long)11),
11640 - (void *)((unsigned long)12),
11641 - (void *)((unsigned long)13),
11642 - (void *)((unsigned long)14),
11643 - (void *)((unsigned long)15),
11644 - (void *)((unsigned long)16));
11648 xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
11651 @@ -1044,7 +1023,6 @@
11653 * If the filesystem blocksize is too large, we may need to choose a
11654 * larger size since the directory code currently logs entire blocks.
11655 - * XXXmiken XXXcurtis
11659 @@ -1059,7 +1037,7 @@
11660 * When logbufs == 0, someone has disabled the log from the FSTAB
11661 * file. This is not a documented feature. We need to set xlog_debug
11662 * to zero (this deactivates the log) and set xlog_target to the
11663 - * appropriate dev_t. Only one filesystem may be affected as such
11664 + * appropriate device. Only one filesystem may be affected as such
11665 * since this is just a performance hack to test what we might be able
11666 * to get if the log were not present.
11668 @@ -1078,7 +1056,7 @@
11669 if (xfs_physmem <= btoc(128*1024*1024)) {
11670 log->l_iclog_bufs = XLOG_MIN_ICLOGS;
11671 } else if (xfs_physmem <= btoc(400*1024*1024)) {
11672 - log->l_iclog_bufs = XLOG_MED_ICLOGS;;
11673 + log->l_iclog_bufs = XLOG_MED_ICLOGS;
11675 /* 256K with 32K bufs */
11676 log->l_iclog_bufs = XLOG_MAX_ICLOGS;
11677 @@ -1087,9 +1065,9 @@
11678 log->l_iclog_bufs = mp->m_logbufs;
11680 #if defined(DEBUG) || defined(XLOG_NOLOG)
11681 - /* We are reactivating a filesystem after it was active */
11682 + /* We are reactivating a filesystem after it was inactive */
11683 if (log->l_targ == xlog_target) {
11684 - xlog_target = 1; /* XXX(hch): WTF? */
11685 + xlog_target = NULL;
11689 @@ -1578,7 +1556,7 @@
11690 sv_destroy(&iclog->ic_forcesema);
11691 sv_destroy(&iclog->ic_writesema);
11692 xfs_buf_free(iclog->ic_bp);
11694 +#ifdef XFS_LOG_TRACE
11695 if (iclog->ic_trace != NULL) {
11696 ktrace_free(iclog->ic_trace);
11698 @@ -1609,7 +1587,7 @@
11701 xfs_buf_free(log->l_xbuf);
11703 +#ifdef XFS_LOG_TRACE
11704 if (log->l_trace != NULL) {
11705 ktrace_free(log->l_trace);
11707 diff -urN linux.org/fs/xfs/xfs_log.h linux/fs/xfs/xfs_log.h
11708 --- linux.org/fs/xfs/xfs_log.h 2003-12-31 05:48:56.000000000 +0100
11709 +++ linux/fs/xfs/xfs_log.h 2004-01-02 04:21:42.000000000 +0100
11711 * endian issues in treating two 32 bit numbers as one 64 bit number
11714 -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
11715 -__attribute__((unused)) /* gcc 2.95 miscompiles this when inlined */
11716 +#if defined(__GNUC__) && (__GNUC__ == 2) && ( (__GNUC_MINOR__ == 95) || (__GNUC_MINOR__ == 96))
11717 +__attribute__((unused)) /* gcc 2.95, 2.96 miscompile this when inlined */
11721 diff -urN linux.org/fs/xfs/xfs_log_priv.h linux/fs/xfs/xfs_log_priv.h
11722 --- linux.org/fs/xfs/xfs_log_priv.h 2003-12-31 05:46:29.000000000 +0100
11723 +++ linux/fs/xfs/xfs_log_priv.h 2004-01-02 04:21:42.000000000 +0100
11725 #ifndef __XFS_LOG_PRIV_H__
11726 #define __XFS_LOG_PRIV_H__
11728 -#if defined(XFS_ALL_TRACE)
11729 -#define XFS_LOG_TRACE
11732 -#if !defined(DEBUG)
11733 -#undef XFS_LOG_TRACE
11739 @@ -109,6 +101,7 @@
11745 * get client id from packed copy.
11747 @@ -434,7 +427,7 @@
11748 struct log *ic_log;
11749 xfs_log_callback_t *ic_callback;
11750 xfs_log_callback_t **ic_callback_tail;
11752 +#ifdef XFS_LOG_TRACE
11753 struct ktrace *ic_trace;
11756 @@ -531,7 +524,7 @@
11757 int l_grant_write_bytes;
11759 /* The following fields don't need locking */
11761 +#ifdef XFS_LOG_TRACE
11762 struct ktrace *l_trace;
11763 struct ktrace *l_grant_trace;
11765 diff -urN linux.org/fs/xfs/xfs_mount.c linux/fs/xfs/xfs_mount.c
11766 --- linux.org/fs/xfs/xfs_mount.c 2003-12-31 05:46:55.000000000 +0100
11767 +++ linux/fs/xfs/xfs_mount.c 2004-01-02 04:21:42.000000000 +0100
11768 @@ -903,7 +903,7 @@
11769 * File systems that don't support user level file handles (i.e.
11770 * all of them except for XFS) will leave vfs_altfsid as NULL.
11772 - vfsp->vfs_altfsid = (fsid_t *)mp->m_fixedfsid;
11773 + vfsp->vfs_altfsid = (xfs_fsid_t *)mp->m_fixedfsid;
11774 mp->m_dmevmask = 0; /* not persistent; set after each mount */
11777 diff -urN linux.org/fs/xfs/xfs_qmops.c linux/fs/xfs/xfs_qmops.c
11778 --- linux.org/fs/xfs/xfs_qmops.c 2003-12-31 05:46:56.000000000 +0100
11779 +++ linux/fs/xfs/xfs_qmops.c 2004-01-02 04:21:43.000000000 +0100
11781 #include "xfs_mount.h"
11784 -#ifndef CONFIG_XFS_QUOTA
11785 STATIC struct xfs_dquot *
11786 xfs_dqvopchown_default(
11787 struct xfs_trans *tp,
11789 .xfs_dqvopchown = xfs_dqvopchown_default,
11790 .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr,
11792 -#endif /* CONFIG_XFS_QUOTA */
11793 diff -urN linux.org/fs/xfs/xfs_refcache.c linux/fs/xfs/xfs_refcache.c
11794 --- linux.org/fs/xfs/xfs_refcache.c 1970-01-01 01:00:00.000000000 +0100
11795 +++ linux/fs/xfs/xfs_refcache.c 2004-01-02 04:21:43.000000000 +0100
11798 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
11800 + * This program is free software; you can redistribute it and/or modify it
11801 + * under the terms of version 2 of the GNU General Public License as
11802 + * published by the Free Software Foundation.
11804 + * This program is distributed in the hope that it would be useful, but
11805 + * WITHOUT ANY WARRANTY; without even the implied warranty of
11806 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11808 + * Further, this software is distributed without any warranty that it is
11809 + * free of the rightful claim of any third person regarding infringement
11810 + * or the like. Any license provided herein, whether implied or
11811 + * otherwise, applies only to this software file. Patent licenses, if
11812 + * any, provided herein do not apply to combinations of this program with
11813 + * other software, or any other product whatsoever.
11815 + * You should have received a copy of the GNU General Public License along
11816 + * with this program; if not, write the Free Software Foundation, Inc., 59
11817 + * Temple Place - Suite 330, Boston MA 02111-1307, USA.
11819 + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
11820 + * Mountain View, CA 94043, or:
11822 + * http://www.sgi.com
11824 + * For further information regarding this notice, see:
11826 + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
11830 +#include "xfs_macros.h"
11831 +#include "xfs_types.h"
11832 +#include "xfs_inum.h"
11833 +#include "xfs_log.h"
11834 +#include "xfs_trans.h"
11835 +#include "xfs_sb.h"
11836 +#include "xfs_ag.h"
11837 +#include "xfs_dir.h"
11838 +#include "xfs_dir2.h"
11839 +#include "xfs_dmapi.h"
11840 +#include "xfs_mount.h"
11841 +#include "xfs_alloc_btree.h"
11842 +#include "xfs_bmap_btree.h"
11843 +#include "xfs_ialloc_btree.h"
11844 +#include "xfs_itable.h"
11845 +#include "xfs_btree.h"
11846 +#include "xfs_alloc.h"
11847 +#include "xfs_ialloc.h"
11848 +#include "xfs_attr.h"
11849 +#include "xfs_attr_sf.h"
11850 +#include "xfs_dir_sf.h"
11851 +#include "xfs_dir2_sf.h"
11852 +#include "xfs_dinode.h"
11853 +#include "xfs_inode_item.h"
11854 +#include "xfs_inode.h"
11855 +#include "xfs_bmap.h"
11856 +#include "xfs_error.h"
11857 +#include "xfs_buf_item.h"
11858 +#include "xfs_refcache.h"
11860 +STATIC spinlock_t xfs_refcache_lock = SPIN_LOCK_UNLOCKED;
11861 +STATIC xfs_inode_t **xfs_refcache;
11862 +STATIC int xfs_refcache_index;
11863 +STATIC int xfs_refcache_busy;
11864 +STATIC int xfs_refcache_count;
11867 + * Insert the given inode into the reference cache.
11870 +xfs_refcache_insert(
11874 + xfs_inode_t *release_ip;
11875 + xfs_inode_t **refcache;
11877 + ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE));
11880 + * If an unmount is busy blowing entries out of the cache,
11881 + * then don't bother.
11883 + if (xfs_refcache_busy) {
11888 + * If we tuned the refcache down to zero, don't do anything.
11890 + if (!xfs_refcache_size) {
11895 + * The inode is already in the refcache, so don't bother
11898 + if (ip->i_refcache != NULL) {
11902 + vp = XFS_ITOV(ip);
11903 + /* ASSERT(vp->v_count > 0); */
11907 + * We allocate the reference cache on use so that we don't
11908 + * waste the memory on systems not being used as NFS servers.
11910 + if (xfs_refcache == NULL) {
11911 + refcache = (xfs_inode_t **)kmem_zalloc(XFS_REFCACHE_SIZE_MAX *
11912 + sizeof(xfs_inode_t *),
11918 + spin_lock(&xfs_refcache_lock);
11921 + * If we allocated memory for the refcache above and it still
11922 + * needs it, then use the memory we allocated. Otherwise we'll
11923 + * free the memory below.
11925 + if (refcache != NULL) {
11926 + if (xfs_refcache == NULL) {
11927 + xfs_refcache = refcache;
11933 + * If an unmount is busy clearing out the cache, don't add new
11936 + if (xfs_refcache_busy) {
11937 + spin_unlock(&xfs_refcache_lock);
11940 + * If we allocated memory for the refcache above but someone
11941 + * else beat us to using it, then free the memory now.
11943 + if (refcache != NULL) {
11944 + kmem_free(refcache,
11945 + XFS_REFCACHE_SIZE_MAX * sizeof(xfs_inode_t *));
11949 + release_ip = xfs_refcache[xfs_refcache_index];
11950 + if (release_ip != NULL) {
11951 + release_ip->i_refcache = NULL;
11952 + xfs_refcache_count--;
11953 + ASSERT(xfs_refcache_count >= 0);
11955 + xfs_refcache[xfs_refcache_index] = ip;
11956 + ASSERT(ip->i_refcache == NULL);
11957 + ip->i_refcache = &(xfs_refcache[xfs_refcache_index]);
11958 + xfs_refcache_count++;
11959 + ASSERT(xfs_refcache_count <= xfs_refcache_size);
11960 + xfs_refcache_index++;
11961 + if (xfs_refcache_index == xfs_refcache_size) {
11962 + xfs_refcache_index = 0;
11964 + spin_unlock(&xfs_refcache_lock);
11967 + * Save the pointer to the inode to be released so that we can
11968 + * VN_RELE it once we've dropped our inode locks in xfs_rwunlock().
11969 + * The pointer may be NULL, but that's OK.
11971 + ip->i_release = release_ip;
11974 + * If we allocated memory for the refcache above but someone
11975 + * else beat us to using it, then free the memory now.
11977 + if (refcache != NULL) {
11978 + kmem_free(refcache,
11979 + XFS_REFCACHE_SIZE_MAX * sizeof(xfs_inode_t *));
11985 + * If the given inode is in the reference cache, purge its entry and
11986 + * release the reference on the vnode.
11989 +xfs_refcache_purge_ip(
11996 + * If we're not pointing to our entry in the cache, then
11997 + * we must not be in the cache.
11999 + if (ip->i_refcache == NULL) {
12003 + spin_lock(&xfs_refcache_lock);
12004 + if (ip->i_refcache == NULL) {
12005 + spin_unlock(&xfs_refcache_lock);
12010 + * Clear both our pointer to the cache entry and its pointer
12013 + ASSERT(*(ip->i_refcache) == ip);
12014 + *(ip->i_refcache) = NULL;
12015 + ip->i_refcache = NULL;
12016 + xfs_refcache_count--;
12017 + ASSERT(xfs_refcache_count >= 0);
12018 + spin_unlock(&xfs_refcache_lock);
12020 + vp = XFS_ITOV(ip);
12021 + /* ASSERT(vp->v_count > 1); */
12022 + VOP_RELEASE(vp, error);
12028 + * This is called from the XFS unmount code to purge all entries for the
12029 + * given mount from the cache. It uses the refcache busy counter to
12030 + * make sure that new entries are not added to the cache as we purge them.
12033 +xfs_refcache_purge_mp(
12040 + if (xfs_refcache == NULL) {
12044 + spin_lock(&xfs_refcache_lock);
12046 + * Bumping the busy counter keeps new entries from being added
12047 + * to the cache. We use a counter since multiple unmounts could
12048 + * be in here simultaneously.
12050 + xfs_refcache_busy++;
12052 + for (i = 0; i < xfs_refcache_size; i++) {
12053 + ip = xfs_refcache[i];
12054 + if ((ip != NULL) && (ip->i_mount == mp)) {
12055 + xfs_refcache[i] = NULL;
12056 + ip->i_refcache = NULL;
12057 + xfs_refcache_count--;
12058 + ASSERT(xfs_refcache_count >= 0);
12059 + spin_unlock(&xfs_refcache_lock);
12060 + vp = XFS_ITOV(ip);
12061 + VOP_RELEASE(vp, error);
12063 + spin_lock(&xfs_refcache_lock);
12067 + xfs_refcache_busy--;
12068 + ASSERT(xfs_refcache_busy >= 0);
12069 + spin_unlock(&xfs_refcache_lock);
12074 + * This is called from the XFS sync code to ensure that the refcache
12075 + * is emptied out over time. We purge a small number of entries with
12079 +xfs_refcache_purge_some(xfs_mount_t *mp)
12083 + int iplist_index;
12084 + xfs_inode_t **iplist;
12086 + if ((xfs_refcache == NULL) || (xfs_refcache_count == 0)) {
12090 + iplist_index = 0;
12091 + iplist = (xfs_inode_t **)kmem_zalloc(xfs_refcache_purge_count *
12092 + sizeof(xfs_inode_t *), KM_SLEEP);
12094 + spin_lock(&xfs_refcache_lock);
12097 + * Store any inodes we find in the next several entries
12098 + * into the iplist array to be released after dropping
12099 + * the spinlock. We always start looking from the currently
12100 + * oldest place in the cache. We move the refcache index
12101 + * forward as we go so that we are sure to eventually clear
12102 + * out the entire cache when the system goes idle.
12104 + for (i = 0; i < xfs_refcache_purge_count; i++) {
12105 + ip = xfs_refcache[xfs_refcache_index];
12106 + if (ip != NULL) {
12107 + xfs_refcache[xfs_refcache_index] = NULL;
12108 + ip->i_refcache = NULL;
12109 + xfs_refcache_count--;
12110 + ASSERT(xfs_refcache_count >= 0);
12111 + iplist[iplist_index] = ip;
12114 + xfs_refcache_index++;
12115 + if (xfs_refcache_index == xfs_refcache_size) {
12116 + xfs_refcache_index = 0;
12120 + spin_unlock(&xfs_refcache_lock);
12123 + * Now drop the inodes we collected.
12125 + for (i = 0; i < iplist_index; i++) {
12126 + VOP_RELEASE(XFS_ITOV(iplist[i]), error);
12127 + VN_RELE(XFS_ITOV(iplist[i]));
12130 + kmem_free(iplist, xfs_refcache_purge_count *
12131 + sizeof(xfs_inode_t *));
12135 + * This is called when the refcache is dynamically resized
12138 + * If the new size is smaller than the old size, purge all
12139 + * entries in slots greater than the new size, and move
12140 + * the index if necessary.
12142 + * If the refcache hasn't even been allocated yet, or the
12143 + * new size is larger than the old size, just set the value
12144 + * of xfs_refcache_size.
12148 +xfs_refcache_resize(int xfs_refcache_new_size)
12152 + int iplist_index = 0;
12153 + xfs_inode_t **iplist;
12157 + * If the new size is smaller than the current size,
12158 + * purge entries to create smaller cache, and
12159 + * reposition index if necessary.
12160 + * Don't bother if no refcache yet.
12162 + if (xfs_refcache && (xfs_refcache_new_size < xfs_refcache_size)) {
12164 + iplist = (xfs_inode_t **)kmem_zalloc(XFS_REFCACHE_SIZE_MAX *
12165 + sizeof(xfs_inode_t *), KM_SLEEP);
12167 + spin_lock(&xfs_refcache_lock);
12169 + for (i = xfs_refcache_new_size; i < xfs_refcache_size; i++) {
12170 + ip = xfs_refcache[i];
12171 + if (ip != NULL) {
12172 + xfs_refcache[i] = NULL;
12173 + ip->i_refcache = NULL;
12174 + xfs_refcache_count--;
12175 + ASSERT(xfs_refcache_count >= 0);
12176 + iplist[iplist_index] = ip;
12181 + xfs_refcache_size = xfs_refcache_new_size;
12184 + * Move index to beginning of cache if it's now past the end
12186 + if (xfs_refcache_index >= xfs_refcache_new_size)
12187 + xfs_refcache_index = 0;
12189 + spin_unlock(&xfs_refcache_lock);
12192 + * Now drop the inodes we collected.
12194 + for (i = 0; i < iplist_index; i++) {
12195 + VOP_RELEASE(XFS_ITOV(iplist[i]), error);
12196 + VN_RELE(XFS_ITOV(iplist[i]));
12199 + kmem_free(iplist, XFS_REFCACHE_SIZE_MAX *
12200 + sizeof(xfs_inode_t *));
12202 + spin_lock(&xfs_refcache_lock);
12203 + xfs_refcache_size = xfs_refcache_new_size;
12204 + spin_unlock(&xfs_refcache_lock);
12209 +xfs_refcache_iunlock(
12213 + xfs_inode_t *release_ip;
12216 + release_ip = ip->i_release;
12217 + ip->i_release = NULL;
12219 + xfs_iunlock(ip, lock_flags);
12221 + if (release_ip != NULL) {
12222 + VOP_RELEASE(XFS_ITOV(release_ip), error);
12223 + VN_RELE(XFS_ITOV(release_ip));
12228 +xfs_refcache_destroy(void)
12230 + if (xfs_refcache) {
12231 + kmem_free(xfs_refcache,
12232 + XFS_REFCACHE_SIZE_MAX * sizeof(xfs_inode_t *));
12233 + xfs_refcache = NULL;
12236 diff -urN linux.org/fs/xfs/xfs_refcache.h linux/fs/xfs/xfs_refcache.h
12237 --- linux.org/fs/xfs/xfs_refcache.h 1970-01-01 01:00:00.000000000 +0100
12238 +++ linux/fs/xfs/xfs_refcache.h 2004-01-02 04:21:43.000000000 +0100
12241 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12243 + * This program is free software; you can redistribute it and/or modify it
12244 + * under the terms of version 2 of the GNU General Public License as
12245 + * published by the Free Software Foundation.
12247 + * This program is distributed in the hope that it would be useful, but
12248 + * WITHOUT ANY WARRANTY; without even the implied warranty of
12249 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12251 + * Further, this software is distributed without any warranty that it is
12252 + * free of the rightful claim of any third person regarding infringement
12253 + * or the like. Any license provided herein, whether implied or
12254 + * otherwise, applies only to this software file. Patent licenses, if
12255 + * any, provided herein do not apply to combinations of this program with
12256 + * other software, or any other product whatsoever.
12258 + * You should have received a copy of the GNU General Public License along
12259 + * with this program; if not, write the Free Software Foundation, Inc., 59
12260 + * Temple Place - Suite 330, Boston MA 02111-1307, USA.
12262 + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
12263 + * Mountain View, CA 94043, or:
12265 + * http://www.sgi.com
12267 + * For further information regarding this notice, see:
12269 + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
12271 +#ifndef __XFS_REFCACHE_H__
12272 +#define __XFS_REFCACHE_H__
12274 +#ifdef HAVE_REFCACHE
12276 + * Maximum size (in inodes) for the NFS reference cache
12278 +#define XFS_REFCACHE_SIZE_MAX 512
12283 +extern void xfs_refcache_insert(struct xfs_inode *);
12284 +extern void xfs_refcache_purge_ip(struct xfs_inode *);
12285 +extern void xfs_refcache_purge_mp(struct xfs_mount *);
12286 +extern void xfs_refcache_purge_some(struct xfs_mount *);
12287 +extern void xfs_refcache_resize(int);
12288 +extern void xfs_refcache_destroy(void);
12290 +extern void xfs_refcache_iunlock(struct xfs_inode *, uint);
12294 +#define xfs_refcache_insert(ip) do { } while (0)
12295 +#define xfs_refcache_purge_ip(ip) do { } while (0)
12296 +#define xfs_refcache_purge_mp(mp) do { } while (0)
12297 +#define xfs_refcache_purge_some(mp) do { } while (0)
12298 +#define xfs_refcache_resize(size) do { } while (0)
12299 +#define xfs_refcache_destroy() do { } while (0)
12301 +#define xfs_refcache_iunlock(ip, flags) xfs_iunlock(ip, flags)
12305 +#endif /* __XFS_REFCACHE_H__ */
12306 diff -urN linux.org/fs/xfs/xfs_rename.c linux/fs/xfs/xfs_rename.c
12307 --- linux.org/fs/xfs/xfs_rename.c 2003-12-31 05:47:23.000000000 +0100
12308 +++ linux/fs/xfs/xfs_rename.c 2004-01-02 04:21:43.000000000 +0100
12311 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
12312 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12314 * This program is free software; you can redistribute it and/or modify it
12315 * under the terms of version 2 of the GNU General Public License as
12317 #include "xfs_bmap.h"
12318 #include "xfs_error.h"
12319 #include "xfs_quota.h"
12320 -#include "xfs_rw.h"
12321 +#include "xfs_refcache.h"
12322 #include "xfs_utils.h"
12323 #include "xfs_trans_space.h"
12324 #include "xfs_da_btree.h"
12325 @@ -343,8 +343,7 @@
12326 src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR);
12329 - * Drop the locks on our inodes so that we can do the ancestor
12330 - * check if necessary and start the transaction.
12331 + * Drop the locks on our inodes so that we can start the transaction.
12333 xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
12335 @@ -486,7 +485,7 @@
12336 error = xfs_droplink(tp, target_ip);
12338 rename_which_error_return = __LINE__;
12339 - goto abort_return;;
12340 + goto abort_return;
12342 target_ip_dropped = 1;
12344 @@ -627,6 +626,7 @@
12346 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL);
12347 if (target_ip != NULL) {
12348 + xfs_refcache_purge_ip(target_ip);
12352 diff -urN linux.org/fs/xfs/xfs_rw.c linux/fs/xfs/xfs_rw.c
12353 --- linux.org/fs/xfs/xfs_rw.c 2003-12-31 05:48:40.000000000 +0100
12354 +++ linux/fs/xfs/xfs_rw.c 2004-01-02 04:21:43.000000000 +0100
12357 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
12358 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12360 * This program is free software; you can redistribute it and/or modify it
12361 * under the terms of version 2 of the GNU General Public License as
12362 @@ -149,6 +149,9 @@
12363 xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp,
12364 "Corruption of in-memory data detected. Shutting down filesystem: %s",
12366 + if (XFS_ERRLEVEL_HIGH <= xfs_error_level) {
12367 + xfs_stack_trace();
12369 } else if (!(flags & XFS_FORCE_UMOUNT)) {
12371 xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp,
12372 @@ -351,54 +354,3 @@
12378 - * xfs_inval_cached_pages()
12379 - * This routine is responsible for keeping direct I/O and buffered I/O
12380 - * somewhat coherent. From here we make sure that we're at least
12381 - * temporarily holding the inode I/O lock exclusively and then call
12382 - * the page cache to flush and invalidate any cached pages. If there
12383 - * are no cached pages this routine will be very quick.
12386 -xfs_inval_cached_pages(
12388 - xfs_iocore_t *io,
12389 - xfs_off_t offset,
12395 - if (!VN_CACHED(vp)) {
12399 - mp = io->io_mount;
12402 - * We need to get the I/O lock exclusively in order
12403 - * to safely invalidate pages and mappings.
12406 - XFS_IUNLOCK(mp, io, XFS_IOLOCK_SHARED);
12407 - XFS_ILOCK(mp, io, XFS_IOLOCK_EXCL);
12410 - /* Writing beyond EOF creates a hole that must be zeroed */
12411 - if (write && (offset > XFS_SIZE(mp, io))) {
12412 - xfs_fsize_t isize;
12414 - XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
12415 - isize = XFS_SIZE(mp, io);
12416 - if (offset > isize) {
12417 - xfs_zero_eof(vp, io, offset, isize, offset);
12419 - XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
12422 - VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);
12424 - XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL);
12427 diff -urN linux.org/fs/xfs/xfs_rw.h linux/fs/xfs/xfs_rw.h
12428 --- linux.org/fs/xfs/xfs_rw.h 2003-12-31 05:46:29.000000000 +0100
12429 +++ linux/fs/xfs/xfs_rw.h 2004-01-02 04:21:43.000000000 +0100
12432 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
12433 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12435 * This program is free software; you can redistribute it and/or modify it
12436 * under the terms of version 2 of the GNU General Public License as
12438 #ifndef __XFS_RW_H__
12439 #define __XFS_RW_H__
12448 -struct xfs_iocore;
12453 * Maximum count of bmaps used by read and write paths.
12455 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
12458 - * Defines for the trace mechanisms in xfs_rw.c.
12460 -#define XFS_RW_KTRACE_SIZE 64
12461 -#define XFS_STRAT_KTRACE_SIZE 64
12462 -#define XFS_STRAT_GTRACE_SIZE 512
12464 -#define XFS_READ_ENTER 1
12465 -#define XFS_WRITE_ENTER 2
12466 -#define XFS_IOMAP_READ_ENTER 3
12467 -#define XFS_IOMAP_WRITE_ENTER 4
12468 -#define XFS_IOMAP_READ_MAP 5
12469 -#define XFS_IOMAP_WRITE_MAP 6
12470 -#define XFS_IOMAP_WRITE_NOSPACE 7
12471 -#define XFS_ITRUNC_START 8
12472 -#define XFS_ITRUNC_FINISH1 9
12473 -#define XFS_ITRUNC_FINISH2 10
12474 -#define XFS_CTRUNC1 11
12475 -#define XFS_CTRUNC2 12
12476 -#define XFS_CTRUNC3 13
12477 -#define XFS_CTRUNC4 14
12478 -#define XFS_CTRUNC5 15
12479 -#define XFS_CTRUNC6 16
12480 -#define XFS_BUNMAPI 17
12481 -#define XFS_INVAL_CACHED 18
12482 -#define XFS_DIORD_ENTER 19
12483 -#define XFS_DIOWR_ENTER 20
12485 -#if defined(XFS_ALL_TRACE)
12486 -#define XFS_RW_TRACE
12487 -#define XFS_STRAT_TRACE
12490 -#if !defined(DEBUG)
12491 -#undef XFS_RW_TRACE
12492 -#undef XFS_STRAT_TRACE
12496 * Prototypes for functions in xfs_rw.c.
12499 @@ -141,14 +96,6 @@
12500 struct xfs_mount *mp,
12501 struct xfs_buf *bp);
12504 -xfs_inval_cached_pages(
12505 - struct vnode *vp,
12506 - struct xfs_iocore *io,
12507 - xfs_off_t offset,
12513 struct xfs_buf *b);
12514 diff -urN linux.org/fs/xfs/xfs_trans.c linux/fs/xfs/xfs_trans.c
12515 --- linux.org/fs/xfs/xfs_trans.c 2003-12-31 05:47:13.000000000 +0100
12516 +++ linux/fs/xfs/xfs_trans.c 2004-01-02 04:21:43.000000000 +0100
12517 @@ -142,9 +142,9 @@
12522 ASSERT(xfs_trans_zone != NULL);
12523 tp = kmem_zone_zalloc(xfs_trans_zone, KM_SLEEP);
12524 - tp->t_dqinfo = NULL;
12527 * Initialize the transaction structure.
12528 diff -urN linux.org/fs/xfs/xfs_vfsops.c linux/fs/xfs/xfs_vfsops.c
12529 --- linux.org/fs/xfs/xfs_vfsops.c 2003-12-31 05:46:41.000000000 +0100
12530 +++ linux/fs/xfs/xfs_vfsops.c 2004-01-02 04:21:43.000000000 +0100
12532 #include "xfs_bmap.h"
12533 #include "xfs_da_btree.h"
12534 #include "xfs_rw.h"
12535 +#include "xfs_refcache.h"
12536 #include "xfs_buf_item.h"
12537 #include "xfs_extfree_item.h"
12538 #include "xfs_quota.h"
12539 @@ -74,24 +75,11 @@
12543 - extern kmem_zone_t *xfs_da_state_zone;
12544 extern kmem_zone_t *xfs_bmap_free_item_zone;
12545 extern kmem_zone_t *xfs_btree_cur_zone;
12546 - extern kmem_zone_t *xfs_inode_zone;
12547 - extern kmem_zone_t *xfs_chashlist_zone;
12548 extern kmem_zone_t *xfs_trans_zone;
12549 extern kmem_zone_t *xfs_buf_item_zone;
12550 - extern kmem_zone_t *xfs_efd_zone;
12551 - extern kmem_zone_t *xfs_efi_zone;
12552 extern kmem_zone_t *xfs_dabuf_zone;
12554 - extern ktrace_t *xfs_alloc_trace_buf;
12555 - extern ktrace_t *xfs_bmap_trace_buf;
12556 - extern ktrace_t *xfs_bmbt_trace_buf;
12557 - extern ktrace_t *xfs_dir_trace_buf;
12558 - extern ktrace_t *xfs_attr_trace_buf;
12559 - extern ktrace_t *xfs_dir2_trace_buf;
12560 -#endif /* DEBUG */
12561 #ifdef XFS_DABUF_DEBUG
12562 extern lock_t xfs_dabuf_global_lock;
12563 spinlock_init(&xfs_dabuf_global_lock, "xfsda");
12564 @@ -132,14 +120,6 @@
12566 _ACL_ZONE_INIT(xfs_acl_zone, "xfs_acl");
12568 -#ifdef CONFIG_XFS_VNODE_TRACING
12569 - ktrace_init(VNODE_TRACE_SIZE);
12577 * Allocate global trace buffers.
12579 @@ -189,6 +169,7 @@
12581 xfs_cleanup_procfs();
12582 xfs_sysctl_unregister();
12583 + xfs_refcache_destroy();
12585 kmem_cache_destroy(xfs_bmap_free_item_zone);
12586 kmem_cache_destroy(xfs_btree_cur_zone);
12587 @@ -203,9 +184,6 @@
12588 kmem_cache_destroy(xfs_ili_zone);
12589 kmem_cache_destroy(xfs_chashlist_zone);
12590 _ACL_ZONE_DESTROY(xfs_acl_zone);
12591 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
12597 @@ -547,6 +525,12 @@
12598 0 : DM_FLAGS_UNWANTED;
12602 + * First blow any referenced inode from this file system
12603 + * out of the reference cache, and delete the timer.
12605 + xfs_refcache_purge_mp(mp);
12607 XFS_bflush(mp->m_ddev_targp);
12608 error = xfs_unmount_flush(mp, 0);
12610 @@ -617,6 +601,7 @@
12613 if (*flags & MS_RDONLY) {
12614 + xfs_refcache_purge_mp(mp);
12615 pagebuf_delwri_flush(mp->m_ddev_targp, 0, NULL);
12616 xfs_finish_reclaim_all(mp, 0);
12618 @@ -758,7 +743,7 @@
12622 - struct kstatfs *statp,
12623 + xfs_statfs_t *statp,
12626 __uint64_t fakeinos;
12627 @@ -766,7 +751,6 @@
12633 mp = XFS_BHVTOM(bdp);
12635 @@ -793,9 +777,8 @@
12636 statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree);
12637 XFS_SB_UNLOCK(mp, s);
12639 - id = huge_encode_dev(mp->m_dev);
12640 - statp->f_fsid.val[0] = (u32)id;
12641 - statp->f_fsid.val[1] = (u32)(id >> 32);
12642 + statp->f_fsid.val[0] = mp->m_dev;
12643 + statp->f_fsid.val[1] = 0;
12644 statp->f_namelen = MAXNAMELEN - 1;
12647 @@ -1489,8 +1472,18 @@
12651 + * If this is the periodic sync, then kick some entries out of
12652 + * the reference cache. This ensures that idle entries are
12653 + * eventually kicked out of the cache.
12655 + if (flags & SYNC_REFCACHE) {
12656 + xfs_refcache_purge_some(mp);
12660 * Now check to see if the log needs a "dummy" transaction.
12663 if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) {
12666 @@ -1784,10 +1782,14 @@
12669 /* the few simple ones we can get from the mount struct */
12670 + { XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC },
12671 + { XFS_MOUNT_INO64, "," MNTOPT_INO64 },
12672 { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN },
12673 + { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
12674 { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY },
12675 { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC },
12676 - { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
12677 + { XFS_MOUNT_NOLOGFLUSH, "," MNTOPT_NOLOGFLUSH },
12678 + { XFS_MOUNT_IDELETE, "," MNTOPT_NOIKEEP },
12681 struct proc_xfs_info *xfs_infop;
12682 @@ -1823,6 +1825,9 @@
12683 seq_printf(m, "," MNTOPT_SWIDTH "=%d",
12684 (int)XFS_FSB_TO_BB(mp, mp->m_swidth));
12686 + if (!(mp->m_flags & XFS_MOUNT_32BITINOOPT))
12687 + seq_printf(m, "," MNTOPT_64BITINODE);
12692 @@ -1840,6 +1845,7 @@
12693 .vfs_vget = xfs_vget,
12694 .vfs_dmapiops = (vfs_dmapiops_t)fs_nosys,
12695 .vfs_quotactl = (vfs_quotactl_t)fs_nosys,
12696 + .vfs_get_inode = xfs_get_inode,
12697 .vfs_init_vnode = xfs_initialize_vnode,
12698 .vfs_force_shutdown = xfs_do_force_shutdown,
12700 diff -urN linux.org/fs/xfs/xfs_vnodeops.c linux/fs/xfs/xfs_vnodeops.c
12701 --- linux.org/fs/xfs/xfs_vnodeops.c 2003-12-31 05:48:49.000000000 +0100
12702 +++ linux/fs/xfs/xfs_vnodeops.c 2004-01-02 04:21:43.000000000 +0100
12704 #include "xfs_da_btree.h"
12705 #include "xfs_attr.h"
12706 #include "xfs_rw.h"
12707 +#include "xfs_refcache.h"
12708 #include "xfs_error.h"
12709 #include "xfs_bit.h"
12710 #include "xfs_rtalloc.h"
12713 #define SYMLINK_MAPS 2
12715 -extern int xfs_ioctl(bhv_desc_t *, struct inode *, struct file *,
12716 - int, unsigned int, unsigned long);
12720 * For xfs, we check that the file isn't too big to be opened by this kernel.
12721 * No other open action is required for regular files. Devices are handled
12722 @@ -434,7 +431,7 @@
12725 /* boolean: are we the file owner? */
12726 - file_owner = (current->fsuid == ip->i_d.di_uid);
12727 + file_owner = (current_fsuid(credp) == ip->i_d.di_uid);
12730 * Change various properties of a file.
12731 @@ -1660,6 +1657,12 @@
12732 if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
12735 +#ifdef HAVE_REFCACHE
12736 + /* If we are in the NFS reference cache then don't do this now */
12737 + if (ip->i_refcache)
12743 if (ip->i_d.di_nlink != 0) {
12744 @@ -2004,7 +2007,8 @@
12746 * Make sure that we have allocated dquot(s) on disk.
12748 - error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid,
12749 + error = XFS_QM_DQVOPALLOC(mp, dp,
12750 + current_fsuid(credp), current_fsgid(credp),
12751 XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp);
12754 @@ -2613,6 +2617,14 @@
12759 + * Before we drop our extra reference to the inode, purge it
12760 + * from the refcache if it is there. By waiting until afterwards
12761 + * to do the IRELE, we ensure that we won't go inactive in the
12762 + * xfs_refcache_purge_ip routine (although that would be OK).
12764 + xfs_refcache_purge_ip(ip);
12766 vn_trace_exit(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
12769 @@ -2652,6 +2664,14 @@
12770 cancel_flags |= XFS_TRANS_ABORT;
12771 xfs_trans_cancel(tp, cancel_flags);
12774 + * Before we drop our extra reference to the inode, purge it
12775 + * from the refcache if it is there. By waiting until afterwards
12776 + * to do the IRELE, we ensure that we won't go inactive in the
12777 + * xfs_refcache_purge_ip routine (although that would be OK).
12779 + xfs_refcache_purge_ip(ip);
12784 @@ -2899,7 +2919,8 @@
12786 * Make sure that we have allocated dquot(s) on disk.
12788 - error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid,
12789 + error = XFS_QM_DQVOPALLOC(mp, dp,
12790 + current_fsuid(credp), current_fsgid(credp),
12791 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
12794 @@ -3456,7 +3477,8 @@
12796 * Make sure that we have allocated dquot(s) on disk.
12798 - error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid,
12799 + error = XFS_QM_DQVOPALLOC(mp, dp,
12800 + current_fsuid(credp), current_fsgid(credp),
12801 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
12804 @@ -3743,7 +3765,14 @@
12806 ip = XFS_BHVTOI(bdp);
12807 if (locktype == VRWLOCK_WRITE) {
12808 - xfs_iunlock (ip, XFS_IOLOCK_EXCL);
12810 + * In the write case, we may have added a new entry to
12811 + * the reference cache. This might store a pointer to
12812 + * an inode to be released in this inode. If it is there,
12813 + * clear the pointer and release the inode after unlocking
12816 + xfs_refcache_iunlock(ip, XFS_IOLOCK_EXCL);
12818 ASSERT((locktype == VRWLOCK_READ) ||
12819 (locktype == VRWLOCK_WRITE_DIRECT));
12820 @@ -4738,7 +4767,9 @@
12821 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
12822 .vop_open = xfs_open,
12823 .vop_read = xfs_read,
12824 +#ifdef HAVE_SENDFILE
12825 .vop_sendfile = xfs_sendfile,
12827 .vop_write = xfs_write,
12828 .vop_ioctl = xfs_ioctl,
12829 .vop_getattr = xfs_getattr,