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 @@ -1395,7 +1510,6 @@
2833 sector += nbytes >> BBSHIFT;
2836 @@ -1403,15 +1517,11 @@
2839 if (likely(bio->bi_size)) {
2840 - if (pb->pb_flags & PBF_READ) {
2841 - submit_bio(READ, bio);
2843 - submit_bio(WRITE, bio);
2846 + submit_bio((pb->pb_flags & PBF_READ) ? READ : WRITE, bio);
2851 pagebuf_ioerror(pb, EIO);
2854 @@ -1444,7 +1554,7 @@
2855 pagebuf_iorequest( /* start real I/O */
2856 page_buf_t *pb) /* buffer to convey to device */
2858 - PB_TRACE(pb, PB_TRACE_REC(ioreq), 0);
2859 + PB_TRACE(pb, "iorequest", 0);
2861 if (pb->pb_flags & PBF_DELWRI) {
2862 pagebuf_delwri_queue(pb, 1);
2863 @@ -1480,11 +1590,11 @@
2867 - PB_TRACE(pb, PB_TRACE_REC(iowait), 0);
2868 + PB_TRACE(pb, "iowait", 0);
2869 if (atomic_read(&pb->pb_io_remaining))
2871 down(&pb->pb_iodonesema);
2872 - PB_TRACE(pb, PB_TRACE_REC(iowaited), (int)pb->pb_error);
2873 + PB_TRACE(pb, "iowaited", (long)pb->pb_error);
2874 return pb->pb_error;
2877 @@ -1575,7 +1685,7 @@
2881 - PB_TRACE(pb, PB_TRACE_REC(delwri_q), unlock);
2882 + PB_TRACE(pb, "delwri_q", (long)unlock);
2883 spin_lock(&pbd_delwrite_lock);
2884 /* If already in the queue, dequeue and place at tail */
2885 if (!list_empty(&pb->pb_list)) {
2886 @@ -1598,7 +1708,7 @@
2887 pagebuf_delwri_dequeue(
2890 - PB_TRACE(pb, PB_TRACE_REC(delwri_uq), 0);
2891 + PB_TRACE(pb, "delwri_uq", 0);
2892 spin_lock(&pbd_delwrite_lock);
2893 list_del_init(&pb->pb_list);
2894 pb->pb_flags &= ~PBF_DELWRI;
2895 @@ -1665,7 +1775,7 @@
2896 list_for_each_safe(curr, next, &pbd_delwrite_queue) {
2897 pb = list_entry(curr, page_buf_t, pb_list);
2899 - PB_TRACE(pb, PB_TRACE_REC(walkq1), pagebuf_ispin(pb));
2900 + PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb));
2902 if ((pb->pb_flags & PBF_DELWRI) && !pagebuf_ispin(pb) &&
2903 (((pb->pb_flags & _PBF_LOCKABLE) == 0) ||
2904 @@ -1738,7 +1848,7 @@
2908 - PB_TRACE(pb, PB_TRACE_REC(walkq2), pagebuf_ispin(pb));
2909 + PB_TRACE(pb, "walkq2", (long)pagebuf_ispin(pb));
2910 if (pagebuf_ispin(pb)) {
2913 @@ -1839,7 +1949,7 @@
2915 int *valp = ctl->data;
2917 - ret = proc_doulongvec_minmax(ctl, write, filp, buffer, lenp);
2918 + ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
2920 if (!ret && write && *valp) {
2921 printk("XFS Clearing pbstats\n");
2922 @@ -1960,11 +2070,7 @@
2925 #ifdef PAGEBUF_TRACE
2926 - pb_trace.buf = (pagebuf_trace_t *)kmalloc(
2927 - PB_TRACE_BUFSIZE * sizeof(pagebuf_trace_t), GFP_KERNEL);
2928 - memset(pb_trace.buf, 0, PB_TRACE_BUFSIZE * sizeof(pagebuf_trace_t));
2929 - pb_trace.start = 0;
2930 - pb_trace.end = PB_TRACE_BUFSIZE - 1;
2931 + pagebuf_trace_buf = ktrace_alloc(PAGEBUF_TRACE_SIZE, KM_SLEEP);
2934 pagebuf_daemon_start();
2935 @@ -1996,3 +2102,6 @@
2936 * Module management (for kernel debugger module)
2938 EXPORT_SYMBOL(pagebuf_offset);
2940 +EXPORT_SYMBOL(pbd_delwrite_queue);
2942 diff -urN linux.org/fs/xfs/pagebuf/page_buf.h linux/fs/xfs/pagebuf/page_buf.h
2943 --- linux.org/fs/xfs/pagebuf/page_buf.h 2003-12-31 05:47:38.000000000 +0100
2944 +++ linux/fs/xfs/pagebuf/page_buf.h 2004-01-02 04:21:44.000000000 +0100
2947 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
2948 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
2950 * This program is free software; you can redistribute it and/or modify it
2951 * under the terms of version 2 of the GNU General Public License as
2953 #include <linux/uio.h>
2956 - * Turn this on to get pagebuf lock ownership
2957 -#define PAGEBUF_LOCK_TRACKING
2966 #define PAGE_BUF_DADDR_NULL ((page_buf_daddr_t) (-1LL))
2968 -typedef size_t page_buf_dsize_t; /* size of buffer in blocks */
2970 #define page_buf_ctob(pp) ((pp) * PAGE_CACHE_SIZE)
2971 #define page_buf_btoc(dd) (((dd) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)
2972 #define page_buf_btoct(dd) ((dd) >> PAGE_CACHE_SHIFT)
2974 PBRW_ZERO = 3 /* Zero target memory */
2977 -typedef enum { /* pbm_flags values */
2978 - PBMF_EOF = 0x01, /* mapping contains EOF */
2979 - PBMF_HOLE = 0x02, /* mapping covers a hole */
2980 - PBMF_DELAY = 0x04, /* mapping covers delalloc region */
2981 - PBMF_UNWRITTEN = 0x20, /* mapping covers allocated */
2982 - /* but uninitialized file data */
2983 - PBMF_NEW = 0x40 /* just allocated */
2987 - /* base extent manipulation calls */
2988 - BMAP_READ = (1 << 0), /* read extents */
2989 - BMAP_WRITE = (1 << 1), /* create extents */
2990 - BMAP_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
2991 - BMAP_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
2993 - BMAP_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
2994 - BMAP_DIRECT = (1 << 5), /* direct instead of buffered write */
2995 - BMAP_MMAP = (1 << 6), /* allocate for mmap write */
2996 - BMAP_SYNC = (1 << 7), /* sync write */
2997 - BMAP_TRYLOCK = (1 << 8), /* non-blocking request */
2998 - BMAP_DEVICE = (1 << 9), /* we only want to know the device */
3001 typedef enum page_buf_flags_e { /* pb_flags values */
3002 PBF_READ = (1 << 0), /* buffer intended for reading from device */
3003 @@ -123,12 +93,13 @@
3004 _PBF_PRIVATE_BH = (1 << 17), /* do not use public buffer heads */
3005 _PBF_ALL_PAGES_MAPPED = (1 << 18), /* all pages in range mapped */
3006 _PBF_ADDR_ALLOCATED = (1 << 19), /* pb_addr space was allocated */
3007 - _PBF_MEM_ALLOCATED = (1 << 20), /* pb_mem+underlying pages alloc'd */
3008 + _PBF_MEM_ALLOCATED = (1 << 20), /* underlying pages are allocated */
3009 + _PBF_MEM_SLAB = (1 << 21), /* underlying pages are slab allocated */
3011 - PBF_FORCEIO = (1 << 21),
3012 - PBF_FLUSH = (1 << 22), /* flush disk write cache */
3013 - PBF_READ_AHEAD = (1 << 23),
3014 - PBF_RUN_QUEUES = (1 << 24), /* run block device task queue */
3015 + PBF_FORCEIO = (1 << 22), /* ignore any cache state */
3016 + PBF_FLUSH = (1 << 23), /* flush disk write cache */
3017 + PBF_READ_AHEAD = (1 << 24), /* asynchronous read-ahead */
3018 + PBF_RUN_QUEUES = (1 << 25), /* run block device task queue */
3022 @@ -146,36 +117,6 @@
3026 - * page_buf_bmap_t: File system I/O map
3028 - * The pbm_bn, pbm_offset and pbm_length fields are expressed in disk blocks.
3029 - * The pbm_length field specifies the size of the underlying backing store
3030 - * for the particular mapping.
3032 - * The pbm_bsize, pbm_size and pbm_delta fields are in bytes and indicate
3033 - * the size of the mapping, the number of bytes that are valid to access
3034 - * (read or write), and the offset into the mapping, given the offset
3035 - * supplied to the file I/O map routine. pbm_delta is the offset of the
3036 - * desired data from the beginning of the mapping.
3038 - * When a request is made to read beyond the logical end of the object,
3039 - * pbm_size may be set to 0, but pbm_offset and pbm_length should be set to
3040 - * the actual amount of underlying storage that has been allocated, if any.
3043 -typedef struct page_buf_bmap_s {
3044 - page_buf_daddr_t pbm_bn; /* block number in file system */
3045 - pb_target_t *pbm_target; /* device to do I/O to */
3046 - loff_t pbm_offset; /* byte offset of mapping in file */
3047 - size_t pbm_delta; /* offset of request into bmap */
3048 - size_t pbm_bsize; /* size of this mapping in bytes */
3049 - bmap_flags_t pbm_flags; /* options flags for mapping */
3052 -typedef page_buf_bmap_t pb_bmap_t;
3056 * page_buf_t: Buffer structure for page cache-based buffers
3058 * This buffer structure is used by the page cache buffer management routines
3059 @@ -381,4 +322,19 @@
3060 extern int pagebuf_init(void);
3061 extern void pagebuf_terminate(void);
3064 +#ifdef PAGEBUF_TRACE
3065 +extern ktrace_t *pagebuf_trace_buf;
3066 +extern void pagebuf_trace(
3067 + page_buf_t *, /* buffer being traced */
3068 + char *, /* description of operation */
3069 + void *, /* arbitrary diagnostic value */
3070 + void *); /* return address */
3072 +# define pagebuf_trace(pb, id, ptr, ra) do { } while (0)
3075 +#define pagebuf_target_name(target) \
3076 + ({ char __b[BDEVNAME_SIZE]; bdevname((target)->pbr_bdev, __b); __b; })
3078 #endif /* __PAGE_BUF_H__ */
3079 diff -urN linux.org/fs/xfs/pagebuf/page_buf_internal.h linux/fs/xfs/pagebuf/page_buf_internal.h
3080 --- linux.org/fs/xfs/pagebuf/page_buf_internal.h 2003-12-31 05:47:14.000000000 +0100
3081 +++ linux/fs/xfs/pagebuf/page_buf_internal.h 1970-01-01 01:00:00.000000000 +0100
3084 - * Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved.
3086 - * This program is free software; you can redistribute it and/or modify it
3087 - * under the terms of version 2 of the GNU General Public License as
3088 - * published by the Free Software Foundation.
3090 - * This program is distributed in the hope that it would be useful, but
3091 - * WITHOUT ANY WARRANTY; without even the implied warranty of
3092 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3094 - * Further, this software is distributed without any warranty that it is
3095 - * free of the rightful claim of any third person regarding infringement
3096 - * or the like. Any license provided herein, whether implied or
3097 - * otherwise, applies only to this software file. Patent licenses, if
3098 - * any, provided herein do not apply to combinations of this program with
3099 - * other software, or any other product whatsoever.
3101 - * You should have received a copy of the GNU General Public License along
3102 - * with this program; if not, write the Free Software Foundation, Inc., 59
3103 - * Temple Place - Suite 330, Boston MA 02111-1307, USA.
3105 - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
3106 - * Mountain View, CA 94043, or:
3108 - * http://www.sgi.com
3110 - * For further information regarding this notice, see:
3112 - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
3116 - * Written by Steve Lord at SGI
3119 -#ifndef __PAGE_BUF_PRIVATE_H__
3120 -#define __PAGE_BUF_PRIVATE_H__
3122 -#include <linux/percpu.h>
3123 -#include "page_buf.h"
3125 -#define _PAGE_BUF_INTERNAL_
3126 -#define PB_DEFINE_TRACES
3127 -#include "page_buf_trace.h"
3129 -#ifdef PAGEBUF_LOCK_TRACKING
3130 -#define PB_SET_OWNER(pb) (pb->pb_last_holder = current->pid)
3131 -#define PB_CLEAR_OWNER(pb) (pb->pb_last_holder = -1)
3132 -#define PB_GET_OWNER(pb) (pb->pb_last_holder)
3134 -#define PB_SET_OWNER(pb)
3135 -#define PB_CLEAR_OWNER(pb)
3136 -#define PB_GET_OWNER(pb)
3137 -#endif /* PAGEBUF_LOCK_TRACKING */
3139 -/* Tracing utilities for pagebuf */
3143 - page_buf_flags_t flags;
3144 - unsigned short hold;
3145 - unsigned short lock_value;
3153 -struct pagebuf_trace_buf {
3154 - pagebuf_trace_t *buf;
3155 - volatile int start;
3159 -#define PB_TRACE_BUFSIZE 1024
3160 -#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1))
3163 - * Tunable pagebuf parameters
3166 -typedef struct pb_sysctl_val {
3172 -typedef struct pagebuf_param {
3173 - pb_sysctl_val_t flush_interval; /* interval between runs of the
3174 - * delwri flush daemon. */
3175 - pb_sysctl_val_t age_buffer; /* time for buffer to age before
3177 - pb_sysctl_val_t stats_clear; /* clear the pagebuf stats */
3178 - pb_sysctl_val_t debug; /* debug tracing on or off */
3184 - PB_STATS_CLEAR = 3,
3188 -extern pagebuf_param_t pb_params;
3191 - * Pagebuf statistics
3196 - u_int32_t pb_create;
3197 - u_int32_t pb_get_locked;
3198 - u_int32_t pb_get_locked_waited;
3199 - u_int32_t pb_busy_locked;
3200 - u_int32_t pb_miss_locked;
3201 - u_int32_t pb_page_retries;
3202 - u_int32_t pb_page_found;
3203 - u_int32_t pb_get_read;
3206 -DECLARE_PER_CPU(struct pbstats, pbstats);
3208 -/* We don't disable preempt, not too worried about poking the
3209 - * wrong cpu's stat for now */
3210 -#define PB_STATS_INC(count) (__get_cpu_var(pbstats).count++)
3213 -# define STATIC static
3216 -#endif /* __PAGE_BUF_PRIVATE_H__ */
3217 diff -urN linux.org/fs/xfs/pagebuf/page_buf_locking.c linux/fs/xfs/pagebuf/page_buf_locking.c
3218 --- linux.org/fs/xfs/pagebuf/page_buf_locking.c 2003-12-31 05:47:32.000000000 +0100
3219 +++ linux/fs/xfs/pagebuf/page_buf_locking.c 1970-01-01 01:00:00.000000000 +0100
3222 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3224 - * This program is free software; you can redistribute it and/or modify it
3225 - * under the terms of version 2 of the GNU General Public License as
3226 - * published by the Free Software Foundation.
3228 - * This program is distributed in the hope that it would be useful, but
3229 - * WITHOUT ANY WARRANTY; without even the implied warranty of
3230 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3232 - * Further, this software is distributed without any warranty that it is
3233 - * free of the rightful claim of any third person regarding infringement
3234 - * or the like. Any license provided herein, whether implied or
3235 - * otherwise, applies only to this software file. Patent licenses, if
3236 - * any, provided herein do not apply to combinations of this program with
3237 - * other software, or any other product whatsoever.
3239 - * You should have received a copy of the GNU General Public License along
3240 - * with this program; if not, write the Free Software Foundation, Inc., 59
3241 - * Temple Place - Suite 330, Boston MA 02111-1307, USA.
3243 - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
3244 - * Mountain View, CA 94043, or:
3246 - * http://www.sgi.com
3248 - * For further information regarding this notice, see:
3250 - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
3254 - * page_buf_locking.c
3256 - * The page_buf module provides an abstract buffer cache model on top of
3257 - * the Linux page cache. Cached metadata blocks for a file system are
3258 - * hashed to the inode for the block device. The page_buf module
3259 - * assembles buffer (page_buf_t) objects on demand to aggregate such
3260 - * cached pages for I/O. The page_buf_locking module adds support for
3261 - * locking such page buffers.
3263 - * Written by Steve Lord at SGI
3267 -#include <linux/stddef.h>
3268 -#include <linux/errno.h>
3269 -#include <linux/slab.h>
3270 -#include <linux/bitops.h>
3271 -#include <linux/string.h>
3272 -#include <linux/pagemap.h>
3273 -#include <linux/init.h>
3274 -#include <linux/major.h>
3276 -#include <support/debug.h>
3278 -#include "page_buf_internal.h"
3281 - * pagebuf_cond_lock
3283 - * pagebuf_cond_lock locks a buffer object, if it is not already locked.
3284 - * Note that this in no way
3285 - * locks the underlying pages, so it is only useful for synchronizing
3286 - * concurrent use of page buffer objects, not for synchronizing independent
3287 - * access to the underlying pages.
3290 -pagebuf_cond_lock( /* lock buffer, if not locked */
3291 - /* returns -EBUSY if locked) */
3296 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3298 - locked = down_trylock(&pb->pb_sema) == 0;
3303 - PB_TRACE(pb, PB_TRACE_REC(condlck), locked);
3305 - return(locked ? 0 : -EBUSY);
3309 - * pagebuf_lock_value
3311 - * Return lock value for a pagebuf
3314 -pagebuf_lock_value(
3317 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3318 - return(atomic_read(&pb->pb_sema.count));
3324 - * pagebuf_lock locks a buffer object. Note that this in no way
3325 - * locks the underlying pages, so it is only useful for synchronizing
3326 - * concurrent use of page buffer objects, not for synchronizing independent
3327 - * access to the underlying pages.
3333 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3335 - PB_TRACE(pb, PB_TRACE_REC(lock), 0);
3336 - if (atomic_read(&pb->pb_io_remaining))
3338 - down(&pb->pb_sema);
3340 - PB_TRACE(pb, PB_TRACE_REC(locked), 0);
3347 - * pagebuf_unlock releases the lock on the buffer object created by
3348 - * pagebuf_lock or pagebuf_cond_lock (not any
3349 - * pinning of underlying pages created by pagebuf_pin).
3352 -pagebuf_unlock( /* unlock buffer */
3353 - page_buf_t *pb) /* buffer to unlock */
3355 - ASSERT(pb->pb_flags & _PBF_LOCKABLE);
3356 - PB_CLEAR_OWNER(pb);
3358 - PB_TRACE(pb, PB_TRACE_REC(unlock), 0);
3360 diff -urN linux.org/fs/xfs/pagebuf/page_buf_trace.h linux/fs/xfs/pagebuf/page_buf_trace.h
3361 --- linux.org/fs/xfs/pagebuf/page_buf_trace.h 2003-12-31 05:47:37.000000000 +0100
3362 +++ linux/fs/xfs/pagebuf/page_buf_trace.h 1970-01-01 01:00:00.000000000 +0100
3365 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3367 - * This program is free software; you can redistribute it and/or modify it
3368 - * under the terms of version 2 of the GNU General Public License as
3369 - * published by the Free Software Foundation.
3371 - * This program is distributed in the hope that it would be useful, but
3372 - * WITHOUT ANY WARRANTY; without even the implied warranty of
3373 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3375 - * Further, this software is distributed without any warranty that it is
3376 - * free of the rightful claim of any third person regarding infringement
3377 - * or the like. Any license provided herein, whether implied or
3378 - * otherwise, applies only to this software file. Patent licenses, if
3379 - * any, provided herein do not apply to combinations of this program with
3380 - * other software, or any other product whatsoever.
3382 - * You should have received a copy of the GNU General Public License along
3383 - * with this program; if not, write the Free Software Foundation, Inc., 59
3384 - * Temple Place - Suite 330, Boston MA 02111-1307, USA.
3386 - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
3387 - * Mountain View, CA 94043, or:
3389 - * http://www.sgi.com
3391 - * For further information regarding this notice, see:
3393 - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
3396 -#ifndef __PAGEBUF_TRACE__
3397 -#define __PAGEBUF_TRACE__
3399 -#ifdef PB_DEFINE_TRACES
3400 -#define PB_TRACE_START typedef enum {
3401 -#define PB_TRACE_REC(x) pb_trace_point_##x
3402 -#define PB_TRACE_END } pb_trace_var_t;
3404 -#define PB_TRACE_START static char *event_names[] = {
3405 -#define PB_TRACE_REC(x) #x
3406 -#define PB_TRACE_END };
3411 -PB_TRACE_REC(get_obj),
3412 -PB_TRACE_REC(free_obj),
3413 -PB_TRACE_REC(look_pg),
3414 -PB_TRACE_REC(get_read),
3415 -PB_TRACE_REC(no_daddr),
3416 -PB_TRACE_REC(hold),
3417 -PB_TRACE_REC(rele),
3418 -PB_TRACE_REC(done),
3419 -PB_TRACE_REC(ioerror),
3420 -PB_TRACE_REC(iostart),
3421 -PB_TRACE_REC(end_io),
3422 -PB_TRACE_REC(do_io),
3423 -PB_TRACE_REC(ioreq),
3424 -PB_TRACE_REC(iowait),
3425 -PB_TRACE_REC(iowaited),
3426 -PB_TRACE_REC(free_lk),
3427 -PB_TRACE_REC(freed_l),
3429 -PB_TRACE_REC(get_lk),
3430 -PB_TRACE_REC(got_lk),
3431 -PB_TRACE_REC(skip),
3432 -PB_TRACE_REC(lock),
3433 -PB_TRACE_REC(locked),
3434 -PB_TRACE_REC(unlock),
3435 -PB_TRACE_REC(avl_ret),
3436 -PB_TRACE_REC(condlck),
3437 -PB_TRACE_REC(avl_ins),
3438 -PB_TRACE_REC(walkq1),
3439 -PB_TRACE_REC(walkq2),
3440 -PB_TRACE_REC(walkq3),
3441 -PB_TRACE_REC(delwri_q),
3442 -PB_TRACE_REC(delwri_uq),
3444 -PB_TRACE_REC(unpin),
3445 -PB_TRACE_REC(file_write),
3446 -PB_TRACE_REC(external),
3449 -extern void pb_trace_func(page_buf_t *, int, void *, void *);
3450 -#ifdef PAGEBUF_TRACE
3451 -# define PB_TRACE(pb, event, misc) \
3452 - pb_trace_func(pb, event, (void *) misc, \
3453 - (void *)__builtin_return_address(0))
3455 -# define PB_TRACE(pb, event, misc) do { } while (0)
3458 -#endif /* __PAGEBUF_TRACE__ */
3459 diff -urN linux.org/fs/xfs/quota/xfs_dquot.c linux/fs/xfs/quota/xfs_dquot.c
3460 --- linux.org/fs/xfs/quota/xfs_dquot.c 2003-12-31 05:47:13.000000000 +0100
3461 +++ linux/fs/xfs/quota/xfs_dquot.c 2004-01-02 04:21:44.000000000 +0100
3463 initnsema(&dqp->q_flock, 1, "fdq");
3464 sv_init(&dqp->q_pinwait, SV_DEFAULT, "pdq");
3466 -#ifdef DQUOT_TRACING
3467 +#ifdef XFS_DQUOT_TRACE
3468 dqp->q_trace = ktrace_alloc(DQUOT_TRACE_SIZE, KM_SLEEP);
3469 xfs_dqtrace_entry(dqp, "DQINIT");
3473 ASSERT(dqp->dq_flnext == dqp->dq_flprev);
3475 -#ifdef DQUOT_TRACING
3476 +#ifdef XFS_DQUOT_TRACE
3477 ASSERT(dqp->q_trace);
3478 xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT");
3481 freesema(&dqp->q_flock);
3482 sv_destroy(&dqp->q_pinwait);
3484 -#ifdef DQUOT_TRACING
3485 +#ifdef XFS_DQUOT_TRACE
3487 ktrace_free(dqp->q_trace);
3488 dqp->q_trace = NULL;
3489 @@ -201,20 +201,20 @@
3493 -#ifdef DQUOT_TRACING
3494 +#ifdef XFS_DQUOT_TRACE
3496 * Dquot tracing for debugging.
3500 -xfs_dqtrace_entry__(
3505 +__xfs_dqtrace_entry(
3511 - xfs_dquot_t *udqp = NULL;
3513 + xfs_dquot_t *udqp = NULL;
3514 + xfs_ino_t ino = 0;
3516 ASSERT(dqp->q_trace);
3518 @@ -227,13 +227,19 @@
3519 (void *)(__psint_t)dqp->q_nrefs,
3520 (void *)(__psint_t)dqp->dq_flags,
3521 (void *)(__psint_t)dqp->q_res_bcount,
3522 - (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT),
3523 - (void *)(__psint_t)INT_GET(dqp->q_core.d_icount, ARCH_CONVERT),
3524 - (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT),
3525 - (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT),
3526 - (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT),
3527 - (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT),
3528 - (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT), /* 11 */
3529 + (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount,
3531 + (void *)(__psint_t)INT_GET(dqp->q_core.d_icount,
3533 + (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit,
3535 + (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit,
3537 + (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit,
3539 + (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit,
3541 + (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT),
3542 (void *)(__psint_t)current_pid(),
3543 (void *)(__psint_t)ino,
3544 (void *)(__psint_t)retaddr,
3549 - ASSERT(! XFS_DQ_IS_LOCKED(dqp));
3553 @@ -1000,7 +1005,6 @@
3555 * Dquot lock comes after hashlock in the lock ordering
3557 - ASSERT(! XFS_DQ_IS_LOCKED(dqp));
3559 xfs_ilock(ip, XFS_ILOCK_EXCL);
3560 if (! XFS_IS_DQTYPE_ON(mp, type)) {
3561 @@ -1504,7 +1508,7 @@
3563 ASSERT(XFS_DQ_IS_ON_FREELIST(dqp));
3565 - dqp->q_mount = NULL;;
3566 + dqp->q_mount = NULL;
3568 dqp->dq_flags = XFS_DQ_INACTIVE;
3569 memset(&dqp->q_core, 0, sizeof(dqp->q_core));
3570 diff -urN linux.org/fs/xfs/quota/xfs_dquot.h linux/fs/xfs/quota/xfs_dquot.h
3571 --- linux.org/fs/xfs/quota/xfs_dquot.h 2003-12-31 05:48:42.000000000 +0100
3572 +++ linux/fs/xfs/quota/xfs_dquot.h 2004-01-02 04:21:44.000000000 +0100
3574 sema_t q_flock; /* flush lock */
3575 uint q_pincount; /* pin count for this dquot */
3576 sv_t q_pinwait; /* sync var for pinning */
3577 -#ifdef DQUOT_TRACING
3578 +#ifdef XFS_DQUOT_TRACE
3579 struct ktrace *q_trace; /* trace header structure */
3582 @@ -175,23 +175,25 @@
3583 #define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \
3584 (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
3585 (XFS_IS_GQUOTA_ON((d)->q_mount))))
3586 -#ifdef DQUOT_TRACING
3588 +#ifdef XFS_DQUOT_TRACE
3590 * Dquot Tracing stuff.
3592 #define DQUOT_TRACE_SIZE 64
3593 #define DQUOT_KTRACE_ENTRY 1
3595 +extern void __xfs_dqtrace_entry(xfs_dquot_t *dqp, char *func,
3596 + void *, xfs_inode_t *);
3597 #define xfs_dqtrace_entry_ino(a,b,ip) \
3598 -xfs_dqtrace_entry__((a), (b), (void*)__return_address, (ip))
3599 + __xfs_dqtrace_entry((a), (b), (void*)__return_address, (ip))
3600 #define xfs_dqtrace_entry(a,b) \
3601 -xfs_dqtrace_entry__((a), (b), (void*)__return_address, NULL)
3602 -extern void xfs_dqtrace_entry__(xfs_dquot_t *dqp, char *func,
3603 - void *, xfs_inode_t *);
3604 + __xfs_dqtrace_entry((a), (b), (void*)__return_address, NULL)
3606 #define xfs_dqtrace_entry(a,b)
3607 #define xfs_dqtrace_entry_ino(a,b,ip)
3611 extern void xfs_qm_dqprint(xfs_dquot_t *);
3613 diff -urN linux.org/fs/xfs/quota/xfs_qm.c linux/fs/xfs/quota/xfs_qm.c
3614 --- linux.org/fs/xfs/quota/xfs_qm.c 2003-12-31 05:46:24.000000000 +0100
3615 +++ linux/fs/xfs/quota/xfs_qm.c 2004-01-02 04:21:44.000000000 +0100
3618 kmem_zone_t *qm_dqzone;
3619 kmem_zone_t *qm_dqtrxzone;
3620 +kmem_shaker_t xfs_qm_shaker;
3622 STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int);
3623 STATIC void xfs_qm_list_destroy(xfs_dqlist_t *);
3625 #define XQM_LIST_PRINT(l, NXT, title) do { } while (0)
3628 -struct shrinker *xfs_qm_shrinker;
3631 * Initialize the XQM structure.
3632 * Note that there is not one quota manager per file system.
3635 xqm->qm_dqzone = qm_dqzone;
3637 - xfs_qm_shrinker = set_shrinker(DEFAULT_SEEKS, xfs_qm_shake);
3638 + xfs_qm_shaker = kmem_shake_register(xfs_qm_shake);
3641 * The t_dqinfo portion of transactions.
3644 ASSERT(xqm != NULL);
3645 ASSERT(xqm->qm_nrefs == 0);
3647 - remove_shrinker(xfs_qm_shrinker);
3648 + kmem_shake_deregister(xfs_qm_shaker);
3649 hsize = xqm->qm_dqhashmask + 1;
3650 for (i = 0; i < hsize; i++) {
3651 xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));
3653 ASSERT(XFS_DQ_IS_LOCKED(dqp));
3656 - ASSERT(!udqhint || !XFS_DQ_IS_LOCKED(udqhint));
3664 - ASSERT(! XFS_DQ_IS_LOCKED(udqhint));
3665 ASSERT(XFS_DQ_IS_LOCKED(dqp));
3666 if (! xfs_qm_dqlock_nowait(udqhint)) {
3668 @@ -826,14 +822,10 @@
3671 ASSERT(XFS_DQ_IS_LOCKED(udqhint));
3673 - ASSERT(! XFS_DQ_IS_LOCKED(udqhint));
3677 ASSERT(XFS_DQ_IS_LOCKED(dqp));
3679 - ASSERT(! XFS_DQ_IS_LOCKED(dqp));
3685 ASSERT(XFS_DQ_IS_LOCKED(udq));
3686 ASSERT(XFS_DQ_IS_LOCKED(gdq));
3688 - ASSERT(! XFS_DQ_IS_LOCKED(udq));
3689 - ASSERT(! XFS_DQ_IS_LOCKED(gdq));
3693 @@ -890,15 +879,12 @@
3697 - ASSERT(! XFS_DQ_IS_LOCKED(udq));
3698 - ASSERT(! XFS_DQ_IS_LOCKED(gdq));
3703 ASSERT(XFS_DQ_IS_LOCKED(udq));
3705 - ASSERT(! XFS_DQ_IS_LOCKED(gdq));
3709 @@ -1006,14 +992,10 @@
3711 if (flags & XFS_QMOPT_DQLOCK)
3712 ASSERT(XFS_DQ_IS_LOCKED(ip->i_udquot));
3714 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_udquot));
3717 if (flags & XFS_QMOPT_DQLOCK)
3718 ASSERT(XFS_DQ_IS_LOCKED(ip->i_gdquot));
3720 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_gdquot));
3722 if (XFS_IS_UQUOTA_ON(mp))
3723 ASSERT(ip->i_udquot);
3724 @@ -1756,7 +1738,10 @@
3725 xfs_trans_t *tp, /* transaction pointer - NULL */
3726 xfs_ino_t ino, /* inode number to get data for */
3727 void *buffer, /* not used */
3728 + int ubsize, /* not used */
3729 + void *private_data, /* not used */
3730 xfs_daddr_t bno, /* starting block of inode cluster */
3731 + int *ubused, /* not used */
3732 void *dip, /* on-disk inode pointer (not used) */
3733 int *res) /* result code value */
3735 @@ -1920,7 +1905,7 @@
3736 * adjusting the corresponding dquot counters in core.
3738 if ((error = xfs_bulkstat(mp, NULL, &lastino, &count,
3739 - xfs_qm_dqusage_adjust,
3740 + xfs_qm_dqusage_adjust, NULL,
3742 BULKSTAT_FG_IGET|BULKSTAT_FG_VFSLOCKED,
3744 @@ -2091,7 +2076,7 @@
3746 xfs_qm_freelist_unlock(xfs_Gqm);
3747 if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS)
3749 + return (nreclaimed);
3750 XQM_STATS_INC(xqmstats.xs_qm_dqwants);
3753 @@ -2166,7 +2151,7 @@
3754 XFS_DQ_HASH_UNLOCK(hash);
3755 xfs_qm_freelist_unlock(xfs_Gqm);
3756 if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS)
3758 + return (nreclaimed);
3761 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
3762 @@ -2191,14 +2176,12 @@
3765 xfs_qm_freelist_unlock(xfs_Gqm);
3767 - return nreclaimed;
3768 + return (nreclaimed);
3773 - * The shake manager routine called by shaked() when memory is
3775 + * The kmem_shake interface is invoked when memory is running low.
3779 @@ -2206,10 +2189,10 @@
3781 int ndqused, nfree, n;
3783 - if (!(gfp_mask & __GFP_WAIT))
3785 + if (!kmem_shake_allow(gfp_mask))
3791 nfree = xfs_Gqm->qm_dqfreelist.qh_nelems; /* free dquots */
3792 /* incore dquots in all f/s's */
3793 @@ -2218,7 +2201,7 @@
3794 ASSERT(ndqused >= 0);
3796 if (nfree <= ndqused && nfree < ndquot)
3800 ndqused *= xfs_Gqm->qm_dqfree_ratio; /* target # of free dquots */
3801 n = nfree - ndqused - ndquot; /* # over target */
3802 diff -urN linux.org/fs/xfs/quota/xfs_qm_syscalls.c linux/fs/xfs/quota/xfs_qm_syscalls.c
3803 --- linux.org/fs/xfs/quota/xfs_qm_syscalls.c 2003-12-31 05:47:47.000000000 +0100
3804 +++ linux/fs/xfs/quota/xfs_qm_syscalls.c 2004-01-02 04:21:44.000000000 +0100
3805 @@ -1301,7 +1301,10 @@
3806 xfs_trans_t *tp, /* transaction pointer */
3807 xfs_ino_t ino, /* inode number to get data for */
3808 void *buffer, /* not used */
3809 + int ubsize, /* not used */
3810 + void *private_data, /* not used */
3811 xfs_daddr_t bno, /* starting block of inode cluster */
3812 + int *ubused, /* not used */
3813 void *dip, /* not used */
3814 int *res) /* bulkstat result code */
3816 @@ -1403,7 +1406,7 @@
3817 * adjusting the corresponding dquot counters
3819 if ((error = xfs_bulkstat(mp, NULL, &lastino, &count,
3820 - xfs_qm_internalqcheck_adjust,
3821 + xfs_qm_internalqcheck_adjust, NULL,
3822 0, NULL, BULKSTAT_FG_IGET, &done))) {
3825 diff -urN linux.org/fs/xfs/quota/xfs_trans_dquot.c linux/fs/xfs/quota/xfs_trans_dquot.c
3826 --- linux.org/fs/xfs/quota/xfs_trans_dquot.c 2003-12-31 05:46:41.000000000 +0100
3827 +++ linux/fs/xfs/quota/xfs_trans_dquot.c 2004-01-02 04:21:44.000000000 +0100
3828 @@ -835,13 +835,6 @@
3829 ASSERT(ip->i_ino != mp->m_sb.sb_uquotino);
3830 ASSERT(ip->i_ino != mp->m_sb.sb_gquotino);
3834 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_udquot));
3836 - ASSERT(! XFS_DQ_IS_LOCKED(ip->i_gdquot));
3839 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
3840 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount));
3841 ASSERT((type & ~XFS_QMOPT_FORCE_RES) == XFS_TRANS_DQ_RES_RTBLKS ||
3842 diff -urN linux.org/fs/xfs/support/debug.h linux/fs/xfs/support/debug.h
3843 --- linux.org/fs/xfs/support/debug.h 2003-12-31 05:48:49.000000000 +0100
3844 +++ linux/fs/xfs/support/debug.h 2004-01-02 04:21:44.000000000 +0100
3846 extern void icmn_err(int, char *, va_list);
3847 extern void cmn_err(int, char *, ...);
3850 +# define STATIC static
3855 # define ASSERT(EX) ((void)0) /* avoid "constant in conditional" babble */
3856 diff -urN linux.org/fs/xfs/support/kmem.h linux/fs/xfs/support/kmem.h
3857 --- linux.org/fs/xfs/support/kmem.h 2003-12-31 05:48:56.000000000 +0100
3858 +++ linux/fs/xfs/support/kmem.h 2004-01-02 04:21:44.000000000 +0100
3859 @@ -165,4 +165,25 @@
3860 kmem_cache_free(zone, ptr);
3863 +typedef struct shrinker *kmem_shaker_t;
3864 +typedef int (*kmem_shake_func_t)(int, unsigned int);
3866 +static __inline kmem_shaker_t
3867 +kmem_shake_register(kmem_shake_func_t sfunc)
3869 + return set_shrinker(DEFAULT_SEEKS, sfunc);
3872 +static __inline void
3873 +kmem_shake_deregister(kmem_shaker_t shrinker)
3875 + remove_shrinker(shrinker);
3878 +static __inline int
3879 +kmem_shake_allow(unsigned int gfp_mask)
3881 + return (gfp_mask & __GFP_WAIT);
3884 #endif /* __XFS_SUPPORT_KMEM_H__ */
3885 diff -urN linux.org/fs/xfs/support/ktrace.c linux/fs/xfs/support/ktrace.c
3886 --- linux.org/fs/xfs/support/ktrace.c 2003-12-31 05:47:09.000000000 +0100
3887 +++ linux/fs/xfs/support/ktrace.c 2004-01-02 04:21:44.000000000 +0100
3890 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3891 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
3893 * This program is free software; you can redistribute it and/or modify it
3894 * under the terms of version 2 of the GNU General Public License as
3899 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
3901 static kmem_zone_t *ktrace_hdr_zone;
3902 static kmem_zone_t *ktrace_ent_zone;
3903 static int ktrace_zentries;
3905 ktp->kt_nentries = nentries;
3907 ktp->kt_rollover = 0;
3915 static lock_t wrap_lock = SPIN_LOCK_UNLOCKED;
3916 + unsigned long flags;
3918 ktrace_entry_t *ktep;
3920 @@ -190,11 +188,11 @@
3922 * Grab an entry by pushing the index up to the next one.
3924 - spin_lock(&wrap_lock);
3925 + spin_lock_irqsave(&wrap_lock, flags);
3926 index = ktp->kt_index;
3927 if (++ktp->kt_index == ktp->kt_nentries)
3929 - spin_unlock(&wrap_lock);
3930 + spin_unlock_irqrestore(&wrap_lock, flags);
3932 if (!ktp->kt_rollover && index == ktp->kt_nentries - 1)
3933 ktp->kt_rollover = 1;
3935 return (ktp->kt_rollover ? ktp->kt_nentries : ktp->kt_index);
3947 +EXPORT_SYMBOL(ktrace_first);
3951 @@ -311,11 +308,7 @@
3956 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
3957 -EXPORT_SYMBOL(ktrace_first);
3958 EXPORT_SYMBOL(ktrace_next);
3964 * Skip the next "count" entries and return the entry after that.
3965 * Return NULL if this causes us to iterate past the beginning again.
3971 @@ -362,18 +354,3 @@
3979 -ktrace_alloc(int nentries, int sleep)
3982 - * KM_SLEEP callers don't expect failure.
3984 - if (sleep & KM_SLEEP)
3985 - panic("ktrace_alloc: NULL memory on KM_SLEEP request!");
3990 diff -urN linux.org/fs/xfs/support/ktrace.h linux/fs/xfs/support/ktrace.h
3991 --- linux.org/fs/xfs/support/ktrace.h 2003-12-31 05:47:26.000000000 +0100
3992 +++ linux/fs/xfs/support/ktrace.h 2004-01-02 04:21:44.000000000 +0100
3995 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
3996 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
3998 * This program is free software; you can redistribute it and/or modify it
3999 * under the terms of version 2 of the GNU General Public License as
4001 #ifndef __XFS_SUPPORT_KTRACE_H__
4002 #define __XFS_SUPPORT_KTRACE_H__
4004 +#include <support/spin.h>
4007 * Trace buffer entry structure.
4009 int ks_index; /* current index */
4013 - * Exported interfaces.
4015 -extern ktrace_t *ktrace_alloc(int, int);
4017 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
4018 +#ifdef CONFIG_XFS_TRACE
4020 extern void ktrace_init(int zentries);
4021 extern void ktrace_uninit(void);
4023 +extern ktrace_t *ktrace_alloc(int, int);
4024 extern void ktrace_free(ktrace_t *);
4026 extern void ktrace_enter(
4028 extern ktrace_entry_t *ktrace_skip(ktrace_t *, int, ktrace_snap_t *);
4031 +#define ktrace_init(x) do { } while (0)
4032 +#define ktrace_uninit() do { } while (0)
4033 +#endif /* CONFIG_XFS_TRACE */
4035 -#define ktrace_free(ktp)
4036 -#define ktrace_enter(ktp,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15)
4040 -#endif /* __XFS_SUPPORT_KTRACE_H__ */
4041 +#endif /* __XFS_SUPPORT_KTRACE_H__ */
4042 diff -urN linux.org/fs/xfs/support/qsort.c linux/fs/xfs/support/qsort.c
4043 --- linux.org/fs/xfs/support/qsort.c 2003-12-31 05:48:26.000000000 +0100
4044 +++ linux/fs/xfs/support/qsort.c 2004-01-02 04:21:44.000000000 +0100
4046 -/* Copyright (C) 1991, 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
4047 - This file is part of the GNU C Library.
4048 - Written by Douglas C. Schmidt (schmidt@ics.uci.edu).
4050 - The GNU C Library is free software; you can redistribute it and/or
4051 - modify it under the terms of the GNU Lesser General Public
4052 - License as published by the Free Software Foundation; either
4053 - version 2.1 of the License, or (at your option) any later version.
4055 - The GNU C Library is distributed in the hope that it will be useful,
4056 - but WITHOUT ANY WARRANTY; without even the implied warranty of
4057 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4058 - Lesser General Public License for more details.
4060 - You should have received a copy of the GNU Lesser General Public
4061 - License along with the GNU C Library; if not, write to the Free
4062 - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4063 - 02111-1307 USA. */
4065 -/* If you consider tuning this algorithm, you should consult first:
4066 - Engineering a sort function; Jon Bentley and M. Douglas McIlroy;
4067 - Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993. */
4069 + * Copyright (c) 1992, 1993
4070 + * The Regents of the University of California. All rights reserved.
4072 + * Redistribution and use in source and binary forms, with or without
4073 + * modification, are permitted provided that the following conditions
4075 + * 1. Redistributions of source code must retain the above copyright
4076 + * notice, this list of conditions and the following disclaimer.
4077 + * 2. Redistributions in binary form must reproduce the above copyright
4078 + * notice, this list of conditions and the following disclaimer in the
4079 + * documentation and/or other materials provided with the distribution.
4080 + * 3. Neither the name of the University nor the names of its contributors
4081 + * may be used to endorse or promote products derived from this software
4082 + * without specific prior written permission.
4084 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4085 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4086 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4087 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
4088 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4089 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4090 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4091 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4092 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4093 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4097 #include <linux/kernel.h>
4098 #include <linux/string.h>
4100 -/* Byte-wise swap two items of size SIZE. */
4101 -#define SWAP(a, b, size) \
4104 - register size_t __size = (size); \
4105 - register char *__a = (a), *__b = (b); \
4108 - char __tmp = *__a; \
4111 - } while (--__size > 0); \
4114 -/* Discontinue quicksort algorithm when partition gets below this size.
4115 - This particular magic number was chosen to work best on a Sun 4/260. */
4116 -#define MAX_THRESH 4
4118 -/* Stack node declarations used to store unfulfilled partition obligations. */
4125 -/* The next 4 #defines implement a very fast in-line stack abstraction. */
4126 -/* The stack needs log (total_elements) entries (we could even subtract
4127 - log(MAX_THRESH)). Since total_elements has type size_t, we get as
4128 - upper bound for log (total_elements):
4129 - bits per byte (CHAR_BIT) * sizeof(size_t). */
4130 -#define STACK_SIZE (8 * sizeof(unsigned long int))
4131 -#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top))
4132 -#define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi)))
4133 -#define STACK_NOT_EMPTY (stack < top)
4136 -/* Order size using quicksort. This implementation incorporates
4137 - four optimizations discussed in Sedgewick:
4139 - 1. Non-recursive, using an explicit stack of pointer that store the
4140 - next array partition to sort. To save time, this maximum amount
4141 - of space required to store an array of SIZE_MAX is allocated on the
4142 - stack. Assuming a 32-bit (64 bit) integer for size_t, this needs
4143 - only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes).
4144 - Pretty cheap, actually.
4146 - 2. Chose the pivot element using a median-of-three decision tree.
4147 - This reduces the probability of selecting a bad pivot value and
4148 - eliminates certain extraneous comparisons.
4150 - 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving
4151 - insertion sort to order the MAX_THRESH items within each partition.
4152 - This is a big win, since insertion sort is faster for small, mostly
4153 - sorted array segments.
4155 - 4. The larger of the two sub-partitions is always pushed onto the
4156 - stack first, with the algorithm then concentrating on the
4157 - smaller partition. This *guarantees* no more than log (total_elems)
4158 - stack size is needed (actually O(1) in this case)! */
4160 + * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
4162 +#define swapcode(TYPE, parmi, parmj, n) { \
4163 + long i = (n) / sizeof (TYPE); \
4164 + register TYPE *pi = (TYPE *) (parmi); \
4165 + register TYPE *pj = (TYPE *) (parmj); \
4167 + register TYPE t = *pi; \
4170 + } while (--i > 0); \
4174 -qsort (void *const pbase, size_t total_elems, size_t size,
4175 - int (*cmp)(const void *, const void *))
4176 +#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
4177 + es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
4179 +static __inline void
4180 +swapfunc(char *a, char *b, int n, int swaptype)
4182 - register char *base_ptr = (char *) pbase;
4183 + if (swaptype <= 1)
4184 + swapcode(long, a, b, n)
4186 + swapcode(char, a, b, n)
4189 - const size_t max_thresh = MAX_THRESH * size;
4190 +#define swap(a, b) \
4191 + if (swaptype == 0) { \
4192 + long t = *(long *)(a); \
4193 + *(long *)(a) = *(long *)(b); \
4194 + *(long *)(b) = t; \
4196 + swapfunc(a, b, es, swaptype)
4198 - if (total_elems == 0)
4199 - /* Avoid lossage with unsigned arithmetic below. */
4202 - if (total_elems > MAX_THRESH)
4204 - char *lo = base_ptr;
4205 - char *hi = &lo[size * (total_elems - 1)];
4206 - stack_node stack[STACK_SIZE];
4207 - stack_node *top = stack + 1;
4209 - while (STACK_NOT_EMPTY)
4214 - /* Select median value from among LO, MID, and HI. Rearrange
4215 - LO and HI so the three values are sorted. This lowers the
4216 - probability of picking a pathological pivot value and
4217 - skips a comparison for both the LEFT_PTR and RIGHT_PTR in
4218 - the while loops. */
4220 - char *mid = lo + size * ((hi - lo) / size >> 1);
4222 - if ((*cmp) ((void *) mid, (void *) lo) < 0)
4223 - SWAP (mid, lo, size);
4224 - if ((*cmp) ((void *) hi, (void *) mid) < 0)
4225 - SWAP (mid, hi, size);
4228 - if ((*cmp) ((void *) mid, (void *) lo) < 0)
4229 - SWAP (mid, lo, size);
4232 - left_ptr = lo + size;
4233 - right_ptr = hi - size;
4235 - /* Here's the famous ``collapse the walls'' section of quicksort.
4236 - Gotta like those tight inner loops! They are the main reason
4237 - that this algorithm runs much faster than others. */
4240 - while ((*cmp) ((void *) left_ptr, (void *) mid) < 0)
4243 - while ((*cmp) ((void *) mid, (void *) right_ptr) < 0)
4244 - right_ptr -= size;
4246 - if (left_ptr < right_ptr)
4248 - SWAP (left_ptr, right_ptr, size);
4249 - if (mid == left_ptr)
4251 - else if (mid == right_ptr)
4254 - right_ptr -= size;
4256 - else if (left_ptr == right_ptr)
4259 - right_ptr -= size;
4261 +#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
4263 +static __inline char *
4264 +med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
4266 + return cmp(a, b) < 0 ?
4267 + (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
4268 + :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c ));
4272 +qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
4274 + char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
4275 + int d, r, swaptype, swap_cnt;
4276 + register char *a = aa;
4278 +loop: SWAPINIT(a, es);
4281 + for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es)
4282 + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
4284 + swap(pl, pl - es);
4287 + pm = (char *)a + (n / 2) * es;
4290 + pn = (char *)a + (n - 1) * es;
4293 + pl = med3(pl, pl + d, pl + 2 * d, cmp);
4294 + pm = med3(pm - d, pm, pm + d, cmp);
4295 + pn = med3(pn - 2 * d, pn - d, pn, cmp);
4298 - while (left_ptr <= right_ptr);
4299 + pm = med3(pl, pm, pn, cmp);
4302 + pa = pb = (char *)a + es;
4304 - /* Set up pointers for next iteration. First determine whether
4305 - left and right partitions are below the threshold size. If so,
4306 - ignore one or both. Otherwise, push the larger partition's
4307 - bounds on the stack and continue sorting the smaller one. */
4309 - if ((size_t) (right_ptr - lo) <= max_thresh)
4311 - if ((size_t) (hi - left_ptr) <= max_thresh)
4312 - /* Ignore both small partitions. */
4315 - /* Ignore small left partition. */
4318 - else if ((size_t) (hi - left_ptr) <= max_thresh)
4319 - /* Ignore small right partition. */
4321 - else if ((right_ptr - lo) > (hi - left_ptr))
4323 - /* Push larger left partition indices. */
4324 - PUSH (lo, right_ptr);
4329 - /* Push larger right partition indices. */
4330 - PUSH (left_ptr, hi);
4333 + pc = pd = (char *)a + (n - 1) * es;
4335 + while (pb <= pc && (r = cmp(pb, a)) <= 0) {
4343 + while (pb <= pc && (r = cmp(pc, a)) >= 0) {
4358 + if (swap_cnt == 0) { /* Switch to insertion sort */
4359 + for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
4360 + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
4362 + swap(pl, pl - es);
4367 - /* Once the BASE_PTR array is partially sorted by quicksort the rest
4368 - is completely sorted using insertion sort, since this is efficient
4369 - for partitions below MAX_THRESH size. BASE_PTR points to the beginning
4370 - of the array to sort, and END_PTR points at the very last element in
4371 - the array (*not* one beyond it!). */
4373 - char *const end_ptr = &base_ptr[size * (total_elems - 1)];
4374 - char *tmp_ptr = base_ptr;
4375 - char *const thresh = min_t(char *const, end_ptr, base_ptr + max_thresh);
4376 - register char *run_ptr;
4378 - /* Find smallest element in first threshold and place it at the
4379 - array's beginning. This is the smallest array element,
4380 - and the operation speeds up insertion sort's inner loop. */
4382 - for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size)
4383 - if ((*cmp) ((void *) run_ptr, (void *) tmp_ptr) < 0)
4384 - tmp_ptr = run_ptr;
4386 - if (tmp_ptr != base_ptr)
4387 - SWAP (tmp_ptr, base_ptr, size);
4389 - /* Insertion sort, running from left-hand-side up to right-hand-side. */
4391 - run_ptr = base_ptr + size;
4392 - while ((run_ptr += size) <= end_ptr)
4394 - tmp_ptr = run_ptr - size;
4395 - while ((*cmp) ((void *) run_ptr, (void *) tmp_ptr) < 0)
4399 - if (tmp_ptr != run_ptr)
4403 - trav = run_ptr + size;
4404 - while (--trav >= run_ptr)
4409 - for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo)
4416 + pn = (char *)a + n * es;
4417 + r = min(pa - (char *)a, pb - pa);
4418 + vecswap(a, pb - r, r);
4419 + r = min((long)(pd - pc), (long)(pn - pd - es));
4420 + vecswap(pb, pn - r, r);
4421 + if ((r = pb - pa) > es)
4422 + qsort(a, r / es, es, cmp);
4423 + if ((r = pd - pc) > es) {
4424 + /* Iterate rather than recurse to save stack space */
4429 +/* qsort(pn - r, r / es, es, cmp);*/
4431 diff -urN linux.org/fs/xfs/xfs_acl.h linux/fs/xfs/xfs_acl.h
4432 --- linux.org/fs/xfs/xfs_acl.h 2003-12-31 05:47:08.000000000 +0100
4433 +++ linux/fs/xfs/xfs_acl.h 2004-01-02 04:21:42.000000000 +0100
4436 - * Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
4437 + * Copyright (c) 2001-2003 Silicon Graphics, Inc. All Rights Reserved.
4439 * This program is free software; you can redistribute it and/or modify it
4440 * under the terms of version 2 of the GNU General Public License as
4442 #define xfs_acl_vset(v,p,sz,t) (-EOPNOTSUPP)
4443 #define xfs_acl_vget(v,p,sz,t) (-EOPNOTSUPP)
4444 #define xfs_acl_vremove(v,t) (-EOPNOTSUPP)
4445 +#define xfs_acl_vhasacl_access(v) (0)
4446 +#define xfs_acl_vhasacl_default(v) (0)
4447 #define _ACL_DECL(a) ((void)0)
4448 #define _ACL_ALLOC(a) (1) /* successfully allocate nothing */
4449 #define _ACL_FREE(a) ((void)0)
4450 diff -urN linux.org/fs/xfs/xfs_alloc.c linux/fs/xfs/xfs_alloc.c
4451 --- linux.org/fs/xfs/xfs_alloc.c 2003-12-31 05:46:44.000000000 +0100
4452 +++ linux/fs/xfs/xfs_alloc.c 2004-01-02 04:21:42.000000000 +0100
4454 #include "xfs_error.h"
4459 - * Allocation tracing.
4461 -ktrace_t *xfs_alloc_trace_buf;
4464 #define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b)))
4466 #define XFSA_FIXUP_BNO_OK 1
4470 #if defined(XFS_ALLOC_TRACE)
4471 +ktrace_t *xfs_alloc_trace_buf;
4473 #define TRACE_ALLOC(s,a) \
4474 xfs_alloc_trace_alloc(fname, s, a, __LINE__)
4475 #define TRACE_FREE(s,a,b,x,f) \
4477 xfs_alloc_trace_busy(fname, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__)
4478 #define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) \
4479 xfs_alloc_trace_busy(fname, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__)
4483 #define TRACE_ALLOC(s,a)
4484 #define TRACE_FREE(s,a,b,x,f)
4485 diff -urN linux.org/fs/xfs/xfs_alloc.h linux/fs/xfs/xfs_alloc.h
4486 --- linux.org/fs/xfs/xfs_alloc.h 2003-12-31 05:46:56.000000000 +0100
4487 +++ linux/fs/xfs/xfs_alloc.h 2004-01-02 04:21:42.000000000 +0100
4492 +#if defined(XFS_ALLOC_TRACE)
4494 + * Allocation tracing buffer size.
4496 +#define XFS_ALLOC_TRACE_SIZE 4096
4497 +extern ktrace_t *xfs_alloc_trace_buf;
4500 * Types for alloc tracing.
4502 @@ -104,26 +111,9 @@
4503 #define XFS_ALLOC_KTRACE_BUSY 4
4504 #define XFS_ALLOC_KTRACE_UNBUSY 5
4505 #define XFS_ALLOC_KTRACE_BUSYSEARCH 6
4509 - * Allocation tracing buffer size.
4511 -#define XFS_ALLOC_TRACE_SIZE 4096
4513 -#ifdef XFS_ALL_TRACE
4514 -#define XFS_ALLOC_TRACE
4517 -#if !defined(DEBUG)
4518 -#undef XFS_ALLOC_TRACE
4522 - * Prototypes for visible xfs_alloc.c routines
4526 * Compute and fill in value of m_ag_maxlevels.
4529 diff -urN linux.org/fs/xfs/xfs_arch.h linux/fs/xfs/xfs_arch.h
4530 --- linux.org/fs/xfs/xfs_arch.h 2003-12-31 05:48:14.000000000 +0100
4531 +++ linux/fs/xfs/xfs_arch.h 2004-01-02 04:21:42.000000000 +0100
4534 #define ARCH_NOCONVERT 1
4535 #if __BYTE_ORDER == __LITTLE_ENDIAN
4536 -#define ARCH_CONVERT 0
4537 +# define ARCH_CONVERT 0
4539 -#define ARCH_CONVERT ARCH_NOCONVERT
4540 +# define ARCH_CONVERT ARCH_NOCONVERT
4543 /* generic swapping macros */
4545 +#ifndef HAVE_SWABMACROS
4546 #define INT_SWAP16(type,var) ((typeof(type))(__swab16((__u16)(var))))
4547 #define INT_SWAP32(type,var) ((typeof(type))(__swab32((__u32)(var))))
4548 #define INT_SWAP64(type,var) ((typeof(type))(__swab64((__u64)(var))))
4551 #define INT_SWAP(type, var) \
4552 ((sizeof(type) == 8) ? INT_SWAP64(type,var) : \
4553 diff -urN linux.org/fs/xfs/xfs_attr.c linux/fs/xfs/xfs_attr.c
4554 --- linux.org/fs/xfs/xfs_attr.c 2003-12-31 05:47:38.000000000 +0100
4555 +++ linux/fs/xfs/xfs_attr.c 2004-01-02 04:21:42.000000000 +0100
4558 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4559 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4561 * This program is free software; you can redistribute it and/or modify it
4562 * under the terms of version 2 of the GNU General Public License as
4564 #include "xfs_quota.h"
4566 #include "xfs_trans_space.h"
4567 +#include "xfs_acl.h"
4571 @@ -2234,7 +2235,8 @@
4572 (__psunsigned_t)context->count,
4573 (__psunsigned_t)context->firstu,
4575 - (context->count > 0)
4576 + ((context->count > 0) &&
4577 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4578 ? (ATTR_ENTRY(context->alist,
4579 context->count-1)->a_valuelen)
4581 @@ -2262,7 +2264,8 @@
4582 (__psunsigned_t)context->count,
4583 (__psunsigned_t)context->firstu,
4585 - (context->count > 0)
4586 + ((context->count > 0) &&
4587 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4588 ? (ATTR_ENTRY(context->alist,
4589 context->count-1)->a_valuelen)
4591 @@ -2290,7 +2293,8 @@
4592 (__psunsigned_t)context->count,
4593 (__psunsigned_t)context->firstu,
4595 - (context->count > 0)
4596 + ((context->count > 0) &&
4597 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4598 ? (ATTR_ENTRY(context->alist,
4599 context->count-1)->a_valuelen)
4601 @@ -2318,7 +2322,8 @@
4602 (__psunsigned_t)context->count,
4603 (__psunsigned_t)context->firstu,
4605 - (context->count > 0)
4606 + ((context->count > 0) &&
4607 + !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
4608 ? (ATTR_ENTRY(context->alist,
4609 context->count-1)->a_valuelen)
4611 @@ -2353,3 +2358,307 @@
4612 (void *)a14, (void *)a15);
4614 #endif /* XFS_ATTR_TRACE */
4617 +/*========================================================================
4618 + * System (pseudo) namespace attribute interface routines.
4619 + *========================================================================*/
4622 +posix_acl_access_set(
4623 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4625 + return xfs_acl_vset(vp, data, size, _ACL_TYPE_ACCESS);
4629 +posix_acl_access_remove(
4630 + struct vnode *vp, char *name, int xflags)
4632 + return xfs_acl_vremove(vp, _ACL_TYPE_ACCESS);
4636 +posix_acl_access_get(
4637 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4639 + return xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS);
4643 +posix_acl_access_exists(
4646 + return xfs_acl_vhasacl_access(vp);
4650 +posix_acl_default_set(
4651 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4653 + return xfs_acl_vset(vp, data, size, _ACL_TYPE_DEFAULT);
4657 +posix_acl_default_get(
4658 + vnode_t *vp, char *name, void *data, size_t size, int xflags)
4660 + return xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT);
4664 +posix_acl_default_remove(
4665 + struct vnode *vp, char *name, int xflags)
4667 + return xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT);
4671 +posix_acl_default_exists(
4674 + return xfs_acl_vhasacl_default(vp);
4677 +struct attrnames posix_acl_access = {
4678 + .attr_name = "posix_acl_access",
4679 + .attr_namelen = sizeof("posix_acl_access") - 1,
4680 + .attr_get = posix_acl_access_get,
4681 + .attr_set = posix_acl_access_set,
4682 + .attr_remove = posix_acl_access_remove,
4683 + .attr_exists = posix_acl_access_exists,
4686 +struct attrnames posix_acl_default = {
4687 + .attr_name = "posix_acl_default",
4688 + .attr_namelen = sizeof("posix_acl_default") - 1,
4689 + .attr_get = posix_acl_default_get,
4690 + .attr_set = posix_acl_default_set,
4691 + .attr_remove = posix_acl_default_remove,
4692 + .attr_exists = posix_acl_default_exists,
4695 +struct attrnames *attr_system_names[] =
4696 + { &posix_acl_access, &posix_acl_default };
4699 +/*========================================================================
4700 + * Namespace-prefix-style attribute name interface routines.
4701 + *========================================================================*/
4705 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4709 + VOP_ATTR_SET(vp, name, data, size, xflags, NULL, error);
4715 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4717 + int error, asize = size;
4719 + VOP_ATTR_GET(vp, name, data, &asize, xflags, NULL, error);
4726 +attr_generic_remove(
4727 + struct vnode *vp, char *name, int xflags)
4731 + VOP_ATTR_REMOVE(vp, name, xflags, NULL, error);
4736 +attr_generic_listadd(
4737 + attrnames_t *prefix,
4738 + attrnames_t *namesp,
4743 + char *p = data + *result;
4745 + *result += prefix->attr_namelen;
4746 + *result += namesp->attr_namelen + 1;
4749 + if (*result > size)
4751 + strcpy(p, prefix->attr_name);
4752 + p += prefix->attr_namelen;
4753 + strcpy(p, namesp->attr_name);
4754 + p += namesp->attr_namelen + 1;
4765 + attrnames_t *namesp;
4768 + for (i = 0; i < ATTR_SYSCOUNT; i++) {
4769 + namesp = attr_system_names[i];
4770 + if (!namesp->attr_exists || !namesp->attr_exists(vp))
4772 + error = attr_generic_listadd(&attr_system, namesp,
4773 + data, size, result);
4782 + struct vnode *vp, void *data, size_t size, int xflags, ssize_t *result)
4784 + attrlist_cursor_kern_t cursor = { 0 };
4787 + VOP_ATTR_LIST(vp, data, size, xflags, &cursor, NULL, error);
4791 + return attr_system_list(vp, data, size, result);
4795 +attr_lookup_namespace(
4797 + struct attrnames **names,
4802 + for (i = 0; i < nnames; i++)
4803 + if (!strncmp(name, names[i]->attr_name, names[i]->attr_namelen))
4809 + * Some checks to prevent people abusing EAs to get over quota:
4810 + * - Don't allow modifying user EAs on devices/symlinks;
4811 + * - Don't allow modifying user EAs if sticky bit set;
4818 + struct inode *inode = LINVFS_GET_IP(vp);
4820 + if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
4822 + if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) &&
4823 + !capable(CAP_SYS_ADMIN))
4825 + if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
4826 + (current_fsuid(cred) != inode->i_uid) && !capable(CAP_FOWNER))
4832 +attr_trusted_capable(
4836 + struct inode *inode = LINVFS_GET_IP(vp);
4838 + if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
4840 + if (!capable(CAP_SYS_ADMIN))
4847 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4849 + attrnames_t *namesp;
4852 + if (xflags & ATTR_CREATE)
4855 + namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
4857 + return -EOPNOTSUPP;
4858 + error = namesp->attr_set(vp, name, data, size, xflags);
4860 + error = vn_revalidate(vp);
4866 + struct vnode *vp, char *name, void *data, size_t size, int xflags)
4868 + attrnames_t *namesp;
4870 + namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
4872 + return -EOPNOTSUPP;
4873 + return namesp->attr_get(vp, name, data, size, xflags);
4877 +attr_system_remove(
4878 + struct vnode *vp, char *name, int xflags)
4880 + attrnames_t *namesp;
4882 + namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
4884 + return -EOPNOTSUPP;
4885 + return namesp->attr_remove(vp, name, xflags);
4888 +struct attrnames attr_system = {
4889 + .attr_name = "system.",
4890 + .attr_namelen = sizeof("system.") - 1,
4891 + .attr_flag = ATTR_SYSTEM,
4892 + .attr_get = attr_system_get,
4893 + .attr_set = attr_system_set,
4894 + .attr_remove = attr_system_remove,
4895 + .attr_capable = (attrcapable_t)fs_noerr,
4898 +struct attrnames attr_trusted = {
4899 + .attr_name = "trusted.",
4900 + .attr_namelen = sizeof("trusted.") - 1,
4901 + .attr_flag = ATTR_ROOT,
4902 + .attr_get = attr_generic_get,
4903 + .attr_set = attr_generic_set,
4904 + .attr_remove = attr_generic_remove,
4905 + .attr_capable = attr_trusted_capable,
4908 +struct attrnames attr_user = {
4909 + .attr_name = "user.",
4910 + .attr_namelen = sizeof("user.") - 1,
4911 + .attr_get = attr_generic_get,
4912 + .attr_set = attr_generic_set,
4913 + .attr_remove = attr_generic_remove,
4914 + .attr_capable = attr_user_capable,
4917 +struct attrnames *attr_namespaces[] =
4918 + { &attr_system, &attr_trusted, &attr_user };
4919 diff -urN linux.org/fs/xfs/xfs_attr.h linux/fs/xfs/xfs_attr.h
4920 --- linux.org/fs/xfs/xfs_attr.h 2003-12-31 05:46:42.000000000 +0100
4921 +++ linux/fs/xfs/xfs_attr.h 2004-01-02 04:21:42.000000000 +0100
4924 - * Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved.
4925 + * Copyright (c) 2000, 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
4927 * This program is free software; you can redistribute it and/or modify it
4928 * under the terms of version 2 of the GNU General Public License as
4930 * as possible so as to fit into the literal area of the inode.
4933 -#ifdef XFS_ALL_TRACE
4934 -#define XFS_ATTR_TRACE
4937 -#if !defined(DEBUG)
4938 -#undef XFS_ATTR_TRACE
4942 /*========================================================================
4943 * External interfaces
4944 *========================================================================*/
4946 -#define ATTR_ROOT 0x0002 /* use attrs in root namespace, not user */
4950 +typedef int (*attrset_t)(struct vnode *, char *, void *, size_t, int);
4951 +typedef int (*attrget_t)(struct vnode *, char *, void *, size_t, int);
4952 +typedef int (*attrremove_t)(struct vnode *, char *, int);
4953 +typedef int (*attrexists_t)(struct vnode *);
4954 +typedef int (*attrcapable_t)(struct vnode *, struct cred *);
4956 +typedef struct attrnames {
4958 + unsigned int attr_namelen;
4959 + unsigned int attr_flag;
4960 + attrget_t attr_get;
4961 + attrset_t attr_set;
4962 + attrremove_t attr_remove;
4963 + attrexists_t attr_exists;
4964 + attrcapable_t attr_capable;
4967 +#define ATTR_NAMECOUNT 3
4968 +extern struct attrnames attr_user;
4969 +extern struct attrnames attr_system;
4970 +extern struct attrnames attr_trusted;
4971 +extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT];
4973 +#define ATTR_SYSCOUNT 2
4974 +extern struct attrnames posix_acl_access;
4975 +extern struct attrnames posix_acl_default;
4976 +extern struct attrnames *attr_system_names[ATTR_SYSCOUNT];
4978 +extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int);
4979 +extern int attr_generic_list(struct vnode *, void *, size_t, int, ssize_t *);
4981 +#define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */
4982 +#define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */
4983 +#define ATTR_TRUST 0x0004 /* -- unused, from IRIX -- */
4984 #define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */
4985 #define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */
4986 +#define ATTR_SYSTEM 0x0100 /* use attrs in system (pseudo) namespace */
4987 #define ATTR_KERNOTIME 0x1000 /* [kernel] don't update inode timestamps */
4988 #define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */
4989 #define ATTR_KERNAMELS 0x4000 /* [kernel] list attr names (simple list) */
4990 @@ -135,11 +163,8 @@
4991 * Function prototypes for the kernel.
4992 *========================================================================*/
4997 struct attrlist_cursor_kern;
4998 -struct xfs_ext_attr;
5002 diff -urN linux.org/fs/xfs/xfs_attr_leaf.c linux/fs/xfs/xfs_attr_leaf.c
5003 --- linux.org/fs/xfs/xfs_attr_leaf.c 2003-12-31 05:47:15.000000000 +0100
5004 +++ linux/fs/xfs/xfs_attr_leaf.c 2004-01-02 04:21:42.000000000 +0100
5007 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
5008 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
5010 * This program is free software; you can redistribute it and/or modify it
5011 * under the terms of version 2 of the GNU General Public License as
5012 @@ -444,8 +444,10 @@
5013 < context->bufsize) {
5014 for (i = 0, sfe = &sf->list[0];
5015 i < INT_GET(sf->hdr.count, ARCH_CONVERT); i++) {
5016 - int ns = (sfe->flags & XFS_ATTR_ROOT)?
5017 - ROOT_NAMES : USER_NAMES;
5018 + attrnames_t *namesp;
5020 + namesp = (sfe->flags & XFS_ATTR_ROOT) ? &attr_trusted :
5022 if (((context->flags & ATTR_ROOT) != 0) !=
5023 ((sfe->flags & XFS_ATTR_ROOT) != 0) &&
5024 !(context->flags & ATTR_KERNFULLS)) {
5025 @@ -454,11 +456,11 @@
5027 if (context->flags & ATTR_KERNOVAL) {
5028 ASSERT(context->flags & ATTR_KERNAMELS);
5029 - context->count += xfs_namespaces[ns].namelen +
5030 + context->count += namesp->attr_namelen +
5031 INT_GET(sfe->namelen, ARCH_CONVERT) + 1;
5034 - if (xfs_attr_put_listent(context, ns,
5035 + if (xfs_attr_put_listent(context, namesp,
5036 (char *)sfe->nameval,
5038 (int)INT_GET(sfe->valuelen,
5039 @@ -544,18 +546,22 @@
5040 * Loop putting entries into the user buffer.
5042 for ( ; i < nsbuf; i++, sbp++) {
5043 - int ns = (sbp->flags & XFS_ATTR_ROOT)? ROOT_NAMES:USER_NAMES;
5044 + attrnames_t *namesp;
5046 + namesp = (sfe->flags & XFS_ATTR_ROOT) ? &attr_trusted :
5049 if (cursor->hashval != INT_GET(sbp->hash, ARCH_CONVERT)) {
5050 cursor->hashval = INT_GET(sbp->hash, ARCH_CONVERT);
5053 if (context->flags & ATTR_KERNOVAL) {
5054 ASSERT(context->flags & ATTR_KERNAMELS);
5055 - context->count += xfs_namespaces[ns].namelen
5056 - + sbp->namelen + 1;
5057 + context->count += namesp->attr_namelen +
5061 - if (xfs_attr_put_listent(context, ns,
5062 + if (xfs_attr_put_listent(context, namesp,
5063 sbp->name, sbp->namelen,
5064 INT_GET(sbp->valuelen, ARCH_CONVERT)))
5066 @@ -2270,7 +2276,7 @@
5068 for ( ; (i < INT_GET(leaf->hdr.count, ARCH_CONVERT))
5069 && (retval == 0); entry++, i++) {
5070 - int ns = (entry->flags & XFS_ATTR_ROOT)? ROOT_NAMES:USER_NAMES;
5071 + attrnames_t *namesp;
5073 if (INT_GET(entry->hashval, ARCH_CONVERT) != cursor->hashval) {
5074 cursor->hashval = INT_GET(entry->hashval, ARCH_CONVERT);
5075 @@ -2284,14 +2290,17 @@
5076 !(context->flags & ATTR_KERNFULLS))
5077 continue; /* skip non-matching entries */
5079 + namesp = (entry->flags & XFS_ATTR_ROOT) ? &attr_trusted :
5082 if (entry->flags & XFS_ATTR_LOCAL) {
5083 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i);
5084 if (context->flags & ATTR_KERNOVAL) {
5085 ASSERT(context->flags & ATTR_KERNAMELS);
5086 - context->count += xfs_namespaces[ns].namelen
5087 - + (int)name_loc->namelen + 1;
5088 + context->count += namesp->attr_namelen +
5089 + (int)name_loc->namelen + 1;
5091 - retval = xfs_attr_put_listent(context, ns,
5092 + retval = xfs_attr_put_listent(context, namesp,
5093 (char *)name_loc->nameval,
5094 (int)name_loc->namelen,
5095 (int)INT_GET(name_loc->valuelen,
5096 @@ -2301,10 +2310,10 @@
5097 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i);
5098 if (context->flags & ATTR_KERNOVAL) {
5099 ASSERT(context->flags & ATTR_KERNAMELS);
5100 - context->count += xfs_namespaces[ns].namelen
5101 - + (int)name_rmt->namelen + 1;
5102 + context->count += namesp->attr_namelen +
5103 + (int)name_rmt->namelen + 1;
5105 - retval = xfs_attr_put_listent(context, ns,
5106 + retval = xfs_attr_put_listent(context, namesp,
5107 (char *)name_rmt->name,
5108 (int)name_rmt->namelen,
5109 (int)INT_GET(name_rmt->valuelen,
5110 @@ -2333,7 +2342,7 @@
5113 xfs_attr_put_listent(xfs_attr_list_context_t *context,
5114 - int ns, char *name, int namelen, int valuelen)
5115 + attrnames_t *namesp, char *name, int namelen, int valuelen)
5117 attrlist_ent_t *aep;
5119 @@ -2341,23 +2350,21 @@
5120 ASSERT(!(context->flags & ATTR_KERNOVAL));
5121 if (context->flags & ATTR_KERNAMELS) {
5123 - xattr_namespace_t *nsp;
5125 ASSERT(context->count >= 0);
5127 - nsp = &xfs_namespaces[ns];
5128 - arraytop = context->count + nsp->namelen + namelen+1;
5129 + arraytop = context->count + namesp->attr_namelen + namelen + 1;
5130 if (arraytop > context->firstu) {
5131 context->count = -1; /* insufficient space */
5134 offset = (char *)context->alist + context->count;
5135 - strncpy(offset, nsp->name, nsp->namelen); /* namespace */
5136 - offset += nsp->namelen;
5137 + strncpy(offset, namesp->attr_name, namesp->attr_namelen);
5138 + offset += namesp->attr_namelen;
5139 strncpy(offset, name, namelen); /* real name */
5142 - context->count += nsp->namelen + namelen + 1;
5143 + context->count += namesp->attr_namelen + namelen + 1;
5147 diff -urN linux.org/fs/xfs/xfs_attr_leaf.h linux/fs/xfs/xfs_attr_leaf.h
5148 --- linux.org/fs/xfs/xfs_attr_leaf.h 2003-12-31 05:46:18.000000000 +0100
5149 +++ linux/fs/xfs/xfs_attr_leaf.h 2004-01-02 04:21:42.000000000 +0100
5152 - * Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved.
5153 + * Copyright (c) 2000, 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
5155 * This program is free software; you can redistribute it and/or modify it
5156 * under the terms of version 2 of the GNU General Public License as
5160 struct attrlist_cursor_kern;
5164 struct xfs_da_state;
5166 * on the system call, they are "or"ed together for various operations.
5168 #define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */
5169 -#define XFS_ATTR_ROOT_BIT 1 /* limit access to attr to userid 0 */
5170 +#define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */
5171 #define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
5172 #define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT)
5173 #define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT)
5176 int xfs_attr_leaf_entsize(struct xfs_attr_leafblock *leaf, int index);
5177 int xfs_attr_put_listent(struct xfs_attr_list_context *context,
5178 - int ns, char *name, int namelen, int valuelen);
5179 + struct attrnames *, char *name, int namelen,
5181 int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp);
5183 #endif /* __XFS_ATTR_LEAF_H__ */
5184 diff -urN linux.org/fs/xfs/xfs_attr_sf.h linux/fs/xfs/xfs_attr_sf.h
5185 --- linux.org/fs/xfs/xfs_attr_sf.h 2003-12-31 05:46:54.000000000 +0100
5186 +++ linux/fs/xfs/xfs_attr_sf.h 2004-01-02 04:21:42.000000000 +0100
5187 @@ -104,14 +104,7 @@
5188 (INT_GET(((xfs_attr_shortform_t *)((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT))
5191 -#ifdef XFS_ALL_TRACE
5192 -#define XFS_ATTR_TRACE
5195 -#if !defined(DEBUG)
5196 -#undef XFS_ATTR_TRACE
5199 +#if defined(XFS_ATTR_TRACE)
5201 * Kernel tracing support for attribute lists
5204 struct xfs_attr_leafblock;
5206 #define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */
5207 +extern ktrace_t *xfs_attr_trace_buf;
5210 * Trace record types.
5212 #define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */
5213 #define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */
5215 -#if defined(XFS_ATTR_TRACE)
5217 void xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context);
5218 void xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context,
5219 struct xfs_da_intnode *node);
5220 diff -urN linux.org/fs/xfs/xfs_bmap_btree.c linux/fs/xfs/xfs_bmap_btree.c
5221 --- linux.org/fs/xfs/xfs_bmap_btree.c 2003-12-31 05:47:31.000000000 +0100
5222 +++ linux/fs/xfs/xfs_bmap_btree.c 2004-01-02 04:21:42.000000000 +0100
5226 #if defined(XFS_BMBT_TRACE)
5228 +static char ARGS[] = "args";
5229 +static char ENTRY[] = "entry";
5230 +static char ERROR[] = "error";
5232 +static char EXIT[] = "exit";
5235 * Add a trace buffer entry for the arguments given to the routine,
5237 @@ -305,11 +312,6 @@
5238 xfs_bmbt_trace_argik(fname, c, i, k, __LINE__)
5239 #define XFS_BMBT_TRACE_CURSOR(c,s) \
5240 xfs_bmbt_trace_cursor(fname, c, s, __LINE__)
5241 -static char ARGS[] = "args";
5242 -static char ENTRY[] = "entry";
5243 -static char ERROR[] = "error";
5245 -static char EXIT[] = "exit";
5247 #define XFS_BMBT_TRACE_ARGBI(c,b,i)
5248 #define XFS_BMBT_TRACE_ARGBII(c,b,i,j)
5249 diff -urN linux.org/fs/xfs/xfs_bmap_btree.h linux/fs/xfs/xfs_bmap_btree.h
5250 --- linux.org/fs/xfs/xfs_bmap_btree.h 2003-12-31 05:47:25.000000000 +0100
5251 +++ linux/fs/xfs/xfs_bmap_btree.h 2004-01-02 04:21:43.000000000 +0100
5252 @@ -435,6 +435,10 @@
5253 INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0])
5259 +#if defined(XFS_BMBT_TRACE)
5261 * Trace buffer entry types.
5263 @@ -449,18 +453,9 @@
5265 #define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */
5266 #define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */
5268 -#if defined(XFS_ALL_TRACE)
5269 -#define XFS_BMBT_TRACE
5270 +extern ktrace_t *xfs_bmbt_trace_buf;
5273 -#if !defined(DEBUG)
5274 -#undef XFS_BMBT_TRACE
5281 * Prototypes for xfs_bmap.c to call.
5283 diff -urN linux.org/fs/xfs/xfs_bmap.c linux/fs/xfs/xfs_bmap.c
5284 --- linux.org/fs/xfs/xfs_bmap.c 2003-12-31 05:48:24.000000000 +0100
5285 +++ linux/fs/xfs/xfs_bmap.c 2004-01-02 04:21:42.000000000 +0100
5287 #include "xfs_trans_space.h"
5288 #include "xfs_buf_item.h"
5291 -ktrace_t *xfs_bmap_trace_buf;
5297 #define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
5300 -#if defined(DEBUG) && defined(XFS_RW_TRACE)
5301 +#if defined(XFS_RW_TRACE)
5308 #define xfs_bunmap_trace(ip, bno, len, flags, ra)
5309 -#endif /* DEBUG && XFS_RW_TRACE */
5310 +#endif /* XFS_RW_TRACE */
5313 xfs_bmap_count_tree(
5314 @@ -3543,6 +3540,8 @@
5317 #ifdef XFS_BMAP_TRACE
5318 +ktrace_t *xfs_bmap_trace_buf;
5321 * Add a bmap trace buffer entry. Base routine for the others.
5323 @@ -3575,14 +3574,14 @@
5324 (void *)(__psint_t)cnt,
5325 (void *)(__psunsigned_t)(ip->i_ino >> 32),
5326 (void *)(__psunsigned_t)(unsigned)ip->i_ino,
5327 - (void *)(__psunsigned_t)(INT_GET(r1->l0, ARCH_CONVERT) >> 32),
5328 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l0, ARCH_CONVERT)),
5329 - (void *)(__psunsigned_t)(INT_GET(r1->l1, ARCH_CONVERT) >> 32),
5330 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l1, ARCH_CONVERT)),
5331 - (void *)(__psunsigned_t)(INT_GET(r2->l0, ARCH_CONVERT) >> 32),
5332 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l0, ARCH_CONVERT)),
5333 - (void *)(__psunsigned_t)(INT_GET(r2->l1, ARCH_CONVERT) >> 32),
5334 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l1, ARCH_CONVERT))
5335 + (void *)(__psunsigned_t)(r1->l0 >> 32),
5336 + (void *)(__psunsigned_t)(unsigned)(r1->l0),
5337 + (void *)(__psunsigned_t)(r1->l1 >> 32),
5338 + (void *)(__psunsigned_t)(unsigned)(r1->l1),
5339 + (void *)(__psunsigned_t)(r2->l0 >> 32),
5340 + (void *)(__psunsigned_t)(unsigned)(r2->l0),
5341 + (void *)(__psunsigned_t)(r2->l1 >> 32),
5342 + (void *)(__psunsigned_t)(unsigned)(r2->l1)
5344 ASSERT(ip->i_xtrace);
5345 ktrace_enter(ip->i_xtrace,
5346 @@ -3592,14 +3591,14 @@
5347 (void *)(__psint_t)cnt,
5348 (void *)(__psunsigned_t)(ip->i_ino >> 32),
5349 (void *)(__psunsigned_t)(unsigned)ip->i_ino,
5350 - (void *)(__psunsigned_t)(INT_GET(r1->l0, ARCH_CONVERT) >> 32),
5351 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l0, ARCH_CONVERT)),
5352 - (void *)(__psunsigned_t)(INT_GET(r1->l1, ARCH_CONVERT) >> 32),
5353 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r1->l1, ARCH_CONVERT)),
5354 - (void *)(__psunsigned_t)(INT_GET(r2->l0, ARCH_CONVERT) >> 32),
5355 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l0, ARCH_CONVERT)),
5356 - (void *)(__psunsigned_t)(INT_GET(r2->l1, ARCH_CONVERT) >> 32),
5357 - (void *)(__psunsigned_t)(unsigned)(INT_GET(r2->l1, ARCH_CONVERT))
5358 + (void *)(__psunsigned_t)(r1->l0 >> 32),
5359 + (void *)(__psunsigned_t)(unsigned)(r1->l0),
5360 + (void *)(__psunsigned_t)(r1->l1 >> 32),
5361 + (void *)(__psunsigned_t)(unsigned)(r1->l1),
5362 + (void *)(__psunsigned_t)(r2->l0 >> 32),
5363 + (void *)(__psunsigned_t)(unsigned)(r2->l0),
5364 + (void *)(__psunsigned_t)(r2->l1 >> 32),
5365 + (void *)(__psunsigned_t)(unsigned)(r2->l1)
5369 @@ -3722,7 +3721,7 @@
5373 -#if defined(DEBUG) && defined(XFS_RW_TRACE)
5374 +#if defined(XFS_RW_TRACE)
5378 @@ -3742,7 +3741,7 @@
5379 (void *)(__psint_t)((xfs_dfiloff_t)bno & 0xffffffff),
5380 (void *)(__psint_t)len,
5381 (void *)(__psint_t)flags,
5382 - (void *)(__psint_t)private.p_cpuid,
5383 + (void *)(unsigned long)current_cpu(),
5387 diff -urN linux.org/fs/xfs/xfs_bmap.h linux/fs/xfs/xfs_bmap.h
5388 --- linux.org/fs/xfs/xfs_bmap.h 2003-12-31 05:46:44.000000000 +0100
5389 +++ linux/fs/xfs/xfs_bmap.h 2004-01-02 04:21:42.000000000 +0100
5391 #define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
5392 #define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
5395 - * Trace operations for bmap extent tracing
5397 -#define XFS_BMAP_KTRACE_DELETE 1
5398 -#define XFS_BMAP_KTRACE_INSERT 2
5399 -#define XFS_BMAP_KTRACE_PRE_UP 3
5400 -#define XFS_BMAP_KTRACE_POST_UP 4
5402 -#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
5403 -#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
5405 -#if defined(XFS_ALL_TRACE)
5406 -#define XFS_BMAP_TRACE
5409 -#if !defined(DEBUG)
5410 -#undef XFS_BMAP_TRACE
5414 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_INIT)
5415 void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp);
5416 #define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
5417 @@ -142,6 +122,33 @@
5422 +#if defined(XFS_BMAP_TRACE)
5424 + * Trace operations for bmap extent tracing
5426 +#define XFS_BMAP_KTRACE_DELETE 1
5427 +#define XFS_BMAP_KTRACE_INSERT 2
5428 +#define XFS_BMAP_KTRACE_PRE_UP 3
5429 +#define XFS_BMAP_KTRACE_POST_UP 4
5431 +#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
5432 +#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
5433 +extern ktrace_t *xfs_bmap_trace_buf;
5436 + * Add bmap trace insert entries for all the contents of the extent list.
5439 +xfs_bmap_trace_exlist(
5440 + char *fname, /* function name */
5441 + struct xfs_inode *ip, /* incore inode pointer */
5442 + xfs_extnum_t cnt, /* count of entries in list */
5443 + int whichfork); /* data or attr fork */
5445 +#define xfs_bmap_trace_exlist(f,ip,c,w)
5449 * Convert inode from non-attributed to attributed.
5450 * Must not be in a transaction, ip must not be locked.
5451 @@ -260,20 +267,6 @@
5452 struct xfs_inode *ip, /* incore inode */
5453 int whichfork); /* data or attr fork */
5455 -#if defined(XFS_BMAP_TRACE)
5457 - * Add bmap trace insert entries for all the contents of the extent list.
5460 -xfs_bmap_trace_exlist(
5461 - char *fname, /* function name */
5462 - struct xfs_inode *ip, /* incore inode pointer */
5463 - xfs_extnum_t cnt, /* count of entries in list */
5464 - int whichfork); /* data or attr fork */
5466 -#define xfs_bmap_trace_exlist(f,ip,c,w)
5470 * Map file blocks to filesystem blocks.
5471 * File range is given by the bno/len pair.
5474 xfs_bmap_count_blocks(
5477 + struct xfs_inode *ip,
5481 diff -urN linux.org/fs/xfs/xfs_buf.h linux/fs/xfs/xfs_buf.h
5482 --- linux.org/fs/xfs/xfs_buf.h 2003-12-31 05:48:37.000000000 +0100
5483 +++ linux/fs/xfs/xfs_buf.h 2004-01-02 04:21:43.000000000 +0100
5485 #define XFS_BUF_SET_VTYPE(bp, type)
5486 #define XFS_BUF_SET_REF(bp, ref)
5488 -#define XFS_BUF_ISPINNED(bp) pagebuf_ispin(bp)
5489 +#define XFS_BUF_ISPINNED(bp) pagebuf_ispin(bp)
5491 #define XFS_BUF_VALUSEMA(bp) pagebuf_lock_value(bp)
5492 #define XFS_BUF_CPSEMA(bp) (pagebuf_cond_lock(bp) == 0)
5493 @@ -191,13 +191,11 @@
5495 /* setup the buffer target from a buftarg structure */
5496 #define XFS_BUF_SET_TARGET(bp, target) \
5497 - (bp)->pb_target = (target)
5499 + (bp)->pb_target = (target)
5500 #define XFS_BUF_TARGET(bp) ((bp)->pb_target)
5501 +#define XFS_BUFTARG_NAME(target) \
5502 + pagebuf_target_name(target)
5504 -#define XFS_BUFTARG_NAME(target) \
5505 - ({ char __b[BDEVNAME_SIZE]; bdevname((target->pbr_bdev), __b); __b; })
5507 #define XFS_BUF_SET_VTYPE_REF(bp, type, ref)
5508 #define XFS_BUF_SET_VTYPE(bp, type)
5509 #define XFS_BUF_SET_REF(bp, ref)
5510 @@ -231,18 +229,11 @@
5515 #define xfs_bpin(bp) pagebuf_pin(bp)
5516 #define xfs_bunpin(bp) pagebuf_unpin(bp)
5518 -#ifdef PAGEBUF_TRACE
5519 -# define PB_DEFINE_TRACES
5520 -# include <pagebuf/page_buf_trace.h>
5521 -# define xfs_buftrace(id, bp) PB_TRACE(bp, PB_TRACE_REC(external), (void *)id)
5523 -# define xfs_buftrace(id, bp) do { } while (0)
5526 +#define xfs_buftrace(id, bp) \
5527 + pagebuf_trace(bp, id, NULL, (void *)__builtin_return_address(0))
5529 #define xfs_biodone(pb) \
5530 pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), 0)
5531 diff -urN linux.org/fs/xfs/xfs_buf_item.c linux/fs/xfs/xfs_buf_item.c
5532 --- linux.org/fs/xfs/xfs_buf_item.c 2003-12-31 05:46:23.000000000 +0100
5533 +++ linux/fs/xfs/xfs_buf_item.c 2004-01-02 04:21:43.000000000 +0100
5534 @@ -1207,13 +1207,14 @@
5535 (void *)((unsigned long)bip->bli_flags),
5536 (void *)((unsigned long)bip->bli_recur),
5537 (void *)((unsigned long)atomic_read(&bip->bli_refcount)),
5538 - (void *)XFS_BUF_ADDR(bp),
5539 + (void *)((unsigned long)
5540 + (0xFFFFFFFF & XFS_BUF_ADDR(bp) >> 32)),
5541 + (void *)((unsigned long)(0xFFFFFFFF & XFS_BUF_ADDR(bp))),
5542 (void *)((unsigned long)XFS_BUF_COUNT(bp)),
5543 - (void *)((unsigned long)(0xFFFFFFFF & (XFS_BFLAGS(bp) >> 32))),
5544 - (void *)((unsigned long)(0xFFFFFFFF & XFS_BFLAGS(bp))),
5545 + (void *)((unsigned long)XFS_BUF_BFLAGS(bp)),
5546 XFS_BUF_FSPRIVATE(bp, void *),
5547 XFS_BUF_FSPRIVATE2(bp, void *),
5548 - (void *)((unsigned long)bp->b_pincount),
5549 + (void *)(unsigned long)XFS_BUF_ISPINNED(bp),
5550 (void *)XFS_BUF_IODONE_FUNC(bp),
5551 (void *)((unsigned long)(XFS_BUF_VALUSEMA(bp))),
5552 (void *)bip->bli_item.li_desc,
5553 diff -urN linux.org/fs/xfs/xfs_buf_item.h linux/fs/xfs/xfs_buf_item.h
5554 --- linux.org/fs/xfs/xfs_buf_item.h 2003-12-31 05:48:00.000000000 +0100
5555 +++ linux/fs/xfs/xfs_buf_item.h 2004-01-02 04:21:43.000000000 +0100
5556 @@ -104,6 +104,15 @@
5560 +struct xfs_buf_log_item;
5562 +#if defined(XFS_BLI_TRACE)
5563 +#define XFS_BLI_TRACE_SIZE 32
5565 +void xfs_buf_item_trace(char *, struct xfs_buf_log_item *);
5567 +#define xfs_buf_item_trace(id, bip)
5571 * This is the in core log item structure used to track information
5573 unsigned int bli_flags; /* misc flags */
5574 unsigned int bli_recur; /* lock recursion count */
5575 atomic_t bli_refcount; /* cnt of tp refs */
5577 +#ifdef XFS_BLI_TRACE
5578 struct ktrace *bli_trace; /* event trace buf */
5580 #ifdef XFS_TRANS_DEBUG
5581 @@ -137,23 +146,6 @@
5582 struct xfs_buf_cancel *bc_next;
5585 -#define XFS_BLI_TRACE_SIZE 32
5588 -#if defined(XFS_ALL_TRACE)
5589 -#define XFS_BLI_TRACE
5592 -#if !defined(DEBUG)
5593 -#undef XFS_BLI_TRACE
5596 -#if defined(XFS_BLI_TRACE)
5597 -void xfs_buf_item_trace(char *, xfs_buf_log_item_t *);
5599 -#define xfs_buf_item_trace(id, bip)
5602 void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
5603 void xfs_buf_item_relse(struct xfs_buf *);
5604 void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint);
5605 diff -urN linux.org/fs/xfs/xfs_da_btree.c linux/fs/xfs/xfs_da_btree.c
5606 --- linux.org/fs/xfs/xfs_da_btree.c 2003-12-31 05:48:06.000000000 +0100
5607 +++ linux/fs/xfs/xfs_da_btree.c 2004-01-02 04:21:43.000000000 +0100
5609 #include "xfs_error.h"
5610 #include "xfs_bit.h"
5612 -#if defined(XFSDEBUG) && defined(CONFIG_KDB)
5613 -#undef xfs_buftrace
5614 -#define xfs_buftrace(A,B) \
5615 - printk(" xfs_buftrace : %s (0x%p)\n", A, B); \
5622 diff -urN linux.org/fs/xfs/xfs_dfrag.c linux/fs/xfs/xfs_dfrag.c
5623 --- linux.org/fs/xfs/xfs_dfrag.c 2003-12-31 05:46:28.000000000 +0100
5624 +++ linux/fs/xfs/xfs_dfrag.c 2004-01-02 04:21:43.000000000 +0100
5625 @@ -153,12 +153,12 @@
5626 if ((error = _MAC_XFS_IACCESS(tip, MACWRITE, NULL))) {
5629 - if ((current->fsuid != ip->i_d.di_uid) &&
5630 + if ((current_fsuid(cred) != ip->i_d.di_uid) &&
5631 (error = xfs_iaccess(ip, S_IWUSR, NULL)) &&
5632 !capable_cred(NULL, CAP_FOWNER)) {
5635 - if ((current->fsuid != tip->i_d.di_uid) &&
5636 + if ((current_fsuid(cred) != tip->i_d.di_uid) &&
5637 (error = xfs_iaccess(tip, S_IWUSR, NULL)) &&
5638 !capable_cred(NULL, CAP_FOWNER)) {
5640 diff -urN linux.org/fs/xfs/xfs_dir2_trace.c linux/fs/xfs/xfs_dir2_trace.c
5641 --- linux.org/fs/xfs/xfs_dir2_trace.c 2003-12-31 05:48:09.000000000 +0100
5642 +++ linux/fs/xfs/xfs_dir2_trace.c 2004-01-02 04:21:44.000000000 +0100
5645 - * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5646 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
5648 * This program is free software; you can redistribute it and/or modify it
5649 * under the terms of version 2 of the GNU General Public License as
5654 - __psunsigned_t a0,
5655 - __psunsigned_t a1,
5656 - __psunsigned_t a2,
5657 - __psunsigned_t a3,
5658 - __psunsigned_t a4,
5659 - __psunsigned_t a5,
5660 - __psunsigned_t a6)
5670 - __psunsigned_t n[6];
5673 ASSERT(xfs_dir2_trace_buf);
5674 ASSERT(dp->i_dir_trace);
5676 - memcpy(n, name, min(sizeof(n), namelen));
5677 + memcpy(n, name, min((int)sizeof(n), namelen));
5679 memset((char *)n, 0, sizeof(n));
5680 ktrace_enter(xfs_dir2_trace_buf,
5681 - (void *)(__psunsigned_t)type, (void *)where,
5682 + (void *)(long)type, (void *)where,
5683 (void *)a0, (void *)a1, (void *)a2, (void *)a3,
5684 - (void *)a4, (void *)a5, (void *)a6,
5685 - (void *)(__psunsigned_t)namelen,
5686 + (void *)a4, (void *)a5, (void *)a6, (void *)a7,
5687 + (void *)(long)namelen,
5688 (void *)n[0], (void *)n[1], (void *)n[2],
5689 - (void *)n[3], (void *)n[4], (void *)n[5]);
5690 + (void *)n[3], (void *)n[4]);
5691 ktrace_enter(dp->i_dir_trace,
5692 - (void *)(__psunsigned_t)type, (void *)where,
5693 + (void *)(long)type, (void *)where,
5694 (void *)a0, (void *)a1, (void *)a2, (void *)a3,
5695 - (void *)a4, (void *)a5, (void *)a6,
5696 - (void *)(__psunsigned_t)namelen,
5697 + (void *)a4, (void *)a5, (void *)a6, (void *)a7,
5698 + (void *)(long)namelen,
5699 (void *)n[0], (void *)n[1], (void *)n[2],
5700 - (void *)n[3], (void *)n[4], (void *)n[5]);
5701 + (void *)n[3], (void *)n[4]);
5705 @@ -103,9 +104,11 @@
5707 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS, where,
5708 (char *)args->name, (int)args->namelen,
5709 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5710 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5711 - (__psunsigned_t)args->justcheck, 0, 0);
5712 + (void *)(unsigned long)args->hashval,
5713 + (void *)((unsigned long)(args->inumber >> 32)),
5714 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5715 + (void *)args->dp, (void *)args->trans,
5716 + (void *)(unsigned long)args->justcheck, NULL, NULL);
5720 @@ -116,10 +119,12 @@
5722 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_B, where,
5723 (char *)args->name, (int)args->namelen,
5724 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5725 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5726 - (__psunsigned_t)args->justcheck,
5727 - (__psunsigned_t)(bp ? bp->bps[0] : NULL), 0);
5728 + (void *)(unsigned long)args->hashval,
5729 + (void *)((unsigned long)(args->inumber >> 32)),
5730 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5731 + (void *)args->dp, (void *)args->trans,
5732 + (void *)(unsigned long)args->justcheck,
5733 + (void *)(bp ? bp->bps[0] : NULL), NULL);
5737 @@ -131,11 +136,13 @@
5739 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BB, where,
5740 (char *)args->name, (int)args->namelen,
5741 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5742 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5743 - (__psunsigned_t)args->justcheck,
5744 - (__psunsigned_t)(lbp ? lbp->bps[0] : NULL),
5745 - (__psunsigned_t)(dbp ? dbp->bps[0] : NULL));
5746 + (void *)(unsigned long)args->hashval,
5747 + (void *)((unsigned long)(args->inumber >> 32)),
5748 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5749 + (void *)args->dp, (void *)args->trans,
5750 + (void *)(unsigned long)args->justcheck,
5751 + (void *)(lbp ? lbp->bps[0] : NULL),
5752 + (void *)(dbp ? dbp->bps[0] : NULL));
5756 @@ -148,12 +155,14 @@
5760 + xfs_buf_t *bpbs = bs ? bs->bps[0] : NULL;
5761 + xfs_buf_t *bpbd = bd ? bd->bps[0] : NULL;
5763 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BIBII, where,
5764 (char *)args->name, (int)args->namelen,
5765 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5766 - (__psunsigned_t)(bs ? bs->bps[0] : NULL), (__psunsigned_t)ss,
5767 - (__psunsigned_t)(bd ? bd->bps[0] : NULL), (__psunsigned_t)sd,
5768 - (__psunsigned_t)c);
5769 + (void *)args->dp, (void *)args->trans,
5770 + (void *)bpbs, (void *)(long)ss, (void *)bpbd, (void *)(long)sd,
5771 + (void *)(long)c, NULL);
5775 @@ -163,12 +172,16 @@
5779 + xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
5781 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_DB, where,
5782 (char *)args->name, (int)args->namelen,
5783 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5784 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5785 - (__psunsigned_t)args->justcheck, (__psunsigned_t)db,
5786 - (__psunsigned_t)(bp ? bp->bps[0] : NULL));
5787 + (void *)(unsigned long)args->hashval,
5788 + (void *)((unsigned long)(args->inumber >> 32)),
5789 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5790 + (void *)args->dp, (void *)args->trans,
5791 + (void *)(unsigned long)args->justcheck, (void *)(long)db,
5796 @@ -179,9 +192,13 @@
5798 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_I, where,
5799 (char *)args->name, (int)args->namelen,
5800 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5801 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5802 - (__psunsigned_t)args->justcheck, (__psunsigned_t)i, 0);
5803 + (void *)(unsigned long)args->hashval,
5804 + (void *)((unsigned long)(args->inumber >> 32)),
5805 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5806 + (void *)args->dp, (void *)args->trans,
5807 + (void *)(unsigned long)args->justcheck,
5808 + (void *)((unsigned long)(i >> 32)),
5809 + (void *)((unsigned long)(i & 0xFFFFFFFF)));
5813 @@ -192,9 +209,11 @@
5815 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_S, where,
5816 (char *)args->name, (int)args->namelen,
5817 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5818 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5819 - (__psunsigned_t)args->justcheck, (__psunsigned_t)s, 0);
5820 + (void *)(unsigned long)args->hashval,
5821 + (void *)((unsigned long)(args->inumber >> 32)),
5822 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5823 + (void *)args->dp, (void *)args->trans,
5824 + (void *)(unsigned long)args->justcheck, (void *)(long)s, 0);
5828 @@ -204,11 +223,15 @@
5832 + xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
5834 xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_SB, where,
5835 (char *)args->name, (int)args->namelen,
5836 - (__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber,
5837 - (__psunsigned_t)args->dp, (__psunsigned_t)args->trans,
5838 - (__psunsigned_t)args->justcheck, (__psunsigned_t)s,
5839 - (__psunsigned_t)(bp ? bp->bps[0] : NULL));
5840 + (void *)(unsigned long)args->hashval,
5841 + (void *)((unsigned long)(args->inumber >> 32)),
5842 + (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
5843 + (void *)args->dp, (void *)args->trans,
5844 + (void *)(unsigned long)args->justcheck, (void *)(long)s,
5847 #endif /* XFS_DIR2_TRACE */
5848 diff -urN linux.org/fs/xfs/xfs_dir2_trace.h linux/fs/xfs/xfs_dir2_trace.h
5849 --- linux.org/fs/xfs/xfs_dir2_trace.h 2003-12-31 05:46:56.000000000 +0100
5850 +++ linux/fs/xfs/xfs_dir2_trace.h 2004-01-02 04:21:44.000000000 +0100
5852 * Tracing for xfs v2 directories.
5855 +#if defined(XFS_DIR2_TRACE)
5861 -#ifdef XFS_ALL_TRACE
5862 -#define XFS_DIR2_TRACE
5863 -#endif /* XFS_ALL_TRACE */
5865 -#if !defined(DEBUG)
5866 -#undef XFS_DIR2_TRACE
5867 -#endif /* !DEBUG */
5869 #define XFS_DIR2_GTRACE_SIZE 4096 /* global buffer */
5870 #define XFS_DIR2_KTRACE_SIZE 32 /* per-inode buffer */
5871 +extern struct ktrace *xfs_dir2_trace_buf;
5873 #define XFS_DIR2_KTRACE_ARGS 1 /* args only */
5874 #define XFS_DIR2_KTRACE_ARGS_B 2 /* args + buffer */
5876 #define XFS_DIR2_KTRACE_ARGS_SB 7 /* args, int, buffer */
5877 #define XFS_DIR2_KTRACE_ARGS_BIBII 8 /* args, buf/int/buf/int/int */
5879 -#ifdef XFS_DIR2_TRACE
5881 void xfs_dir2_trace_args(char *where, struct xfs_da_args *args);
5882 void xfs_dir2_trace_args_b(char *where, struct xfs_da_args *args,
5883 struct xfs_dabuf *bp);
5886 #endif /* XFS_DIR2_TRACE */
5888 -extern struct ktrace *xfs_dir2_trace_buf;
5890 #endif /* __XFS_DIR2_TRACE_H__ */
5891 diff -urN linux.org/fs/xfs/xfs_dir.c linux/fs/xfs/xfs_dir.c
5892 --- linux.org/fs/xfs/xfs_dir.c 2003-12-31 05:46:43.000000000 +0100
5893 +++ linux/fs/xfs/xfs_dir.c 2004-01-02 04:21:43.000000000 +0100
5894 @@ -1093,10 +1093,10 @@
5895 xfs_dir_trace_g_du(char *where, xfs_inode_t *dp, uio_t *uio)
5897 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DU, where,
5898 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5899 - (__psunsigned_t)(uio->uio_offset >> 32),
5900 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5901 - (__psunsigned_t)uio->uio_resid,
5902 + (void *)dp, (void *)dp->i_mount,
5903 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5904 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5905 + (void *)(unsigned long)uio->uio_resid,
5906 NULL, NULL, NULL, NULL, NULL, NULL, NULL);
5909 @@ -1107,11 +1107,11 @@
5910 xfs_dir_trace_g_dub(char *where, xfs_inode_t *dp, uio_t *uio, xfs_dablk_t bno)
5912 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUB, where,
5913 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5914 - (__psunsigned_t)(uio->uio_offset >> 32),
5915 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5916 - (__psunsigned_t)uio->uio_resid,
5917 - (__psunsigned_t)bno,
5918 + (void *)dp, (void *)dp->i_mount,
5919 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5920 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5921 + (void *)(unsigned long)uio->uio_resid,
5922 + (void *)(unsigned long)bno,
5923 NULL, NULL, NULL, NULL, NULL, NULL);
5926 @@ -1122,15 +1122,21 @@
5927 xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio,
5928 xfs_da_intnode_t *node)
5930 + int last = INT_GET(node->hdr.count, ARCH_CONVERT) - 1;
5932 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUN, where,
5933 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5934 - (__psunsigned_t)(uio->uio_offset >> 32),
5935 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5936 - (__psunsigned_t)uio->uio_resid,
5937 - (__psunsigned_t)INT_GET(node->hdr.info.forw, ARCH_CONVERT),
5938 - (__psunsigned_t)INT_GET(node->hdr.count, ARCH_CONVERT),
5939 - (__psunsigned_t)INT_GET(node->btree[0].hashval, ARCH_CONVERT),
5940 - (__psunsigned_t)INT_GET(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval, ARCH_CONVERT),
5941 + (void *)dp, (void *)dp->i_mount,
5942 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5943 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5944 + (void *)(unsigned long)uio->uio_resid,
5945 + (void *)(unsigned long)
5946 + INT_GET(node->hdr.info.forw, ARCH_CONVERT),
5947 + (void *)(unsigned long)
5948 + INT_GET(node->hdr.count, ARCH_CONVERT),
5949 + (void *)(unsigned long)
5950 + INT_GET(node->btree[0].hashval, ARCH_CONVERT),
5951 + (void *)(unsigned long)
5952 + INT_GET(node->btree[last].hashval, ARCH_CONVERT),
5956 @@ -1141,15 +1147,21 @@
5957 xfs_dir_trace_g_dul(char *where, xfs_inode_t *dp, uio_t *uio,
5958 xfs_dir_leafblock_t *leaf)
5960 + int last = INT_GET(leaf->hdr.count, ARCH_CONVERT) - 1;
5962 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUL, where,
5963 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5964 - (__psunsigned_t)(uio->uio_offset >> 32),
5965 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5966 - (__psunsigned_t)uio->uio_resid,
5967 - (__psunsigned_t)INT_GET(leaf->hdr.info.forw, ARCH_CONVERT),
5968 - (__psunsigned_t)INT_GET(leaf->hdr.count, ARCH_CONVERT),
5969 - (__psunsigned_t)INT_GET(leaf->entries[0].hashval, ARCH_CONVERT),
5970 - (__psunsigned_t)INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT),
5971 + (void *)dp, (void *)dp->i_mount,
5972 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5973 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5974 + (void *)(unsigned long)uio->uio_resid,
5975 + (void *)(unsigned long)
5976 + INT_GET(leaf->hdr.info.forw, ARCH_CONVERT),
5977 + (void *)(unsigned long)
5978 + INT_GET(leaf->hdr.count, ARCH_CONVERT),
5979 + (void *)(unsigned long)
5980 + INT_GET(leaf->entries[0].hashval, ARCH_CONVERT),
5981 + (void *)(unsigned long)
5982 + INT_GET(leaf->entries[last].hashval, ARCH_CONVERT),
5986 @@ -1161,11 +1173,12 @@
5987 xfs_dir_leaf_entry_t *entry)
5989 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUE, where,
5990 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
5991 - (__psunsigned_t)(uio->uio_offset >> 32),
5992 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
5993 - (__psunsigned_t)uio->uio_resid,
5994 - (__psunsigned_t)INT_GET(entry->hashval, ARCH_CONVERT),
5995 + (void *)dp, (void *)dp->i_mount,
5996 + (void *)((unsigned long)(uio->uio_offset >> 32)),
5997 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
5998 + (void *)(unsigned long)uio->uio_resid,
5999 + (void *)(unsigned long)
6000 + INT_GET(entry->hashval, ARCH_CONVERT),
6001 NULL, NULL, NULL, NULL, NULL, NULL);
6004 @@ -1176,12 +1189,12 @@
6005 xfs_dir_trace_g_duc(char *where, xfs_inode_t *dp, uio_t *uio, xfs_off_t cookie)
6007 xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUC, where,
6008 - (__psunsigned_t)dp, (__psunsigned_t)dp->i_mount,
6009 - (__psunsigned_t)(uio->uio_offset >> 32),
6010 - (__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF),
6011 - (__psunsigned_t)uio->uio_resid,
6012 - (__psunsigned_t)(cookie >> 32),
6013 - (__psunsigned_t)(cookie & 0xFFFFFFFF),
6014 + (void *)dp, (void *)dp->i_mount,
6015 + (void *)((unsigned long)(uio->uio_offset >> 32)),
6016 + (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
6017 + (void *)(unsigned long)uio->uio_resid,
6018 + (void *)((unsigned long)(cookie >> 32)),
6019 + (void *)((unsigned long)(cookie & 0xFFFFFFFF)),
6020 NULL, NULL, NULL, NULL, NULL);
6023 @@ -1191,15 +1204,15 @@
6026 xfs_dir_trace_enter(int type, char *where,
6027 - __psunsigned_t a0, __psunsigned_t a1,
6028 - __psunsigned_t a2, __psunsigned_t a3,
6029 - __psunsigned_t a4, __psunsigned_t a5,
6030 - __psunsigned_t a6, __psunsigned_t a7,
6031 - __psunsigned_t a8, __psunsigned_t a9,
6032 - __psunsigned_t a10, __psunsigned_t a11)
6033 + void * a0, void * a1,
6034 + void * a2, void * a3,
6035 + void * a4, void * a5,
6036 + void * a6, void * a7,
6037 + void * a8, void * a9,
6038 + void * a10, void * a11)
6040 ASSERT(xfs_dir_trace_buf);
6041 - ktrace_enter(xfs_dir_trace_buf, (void *)((__psunsigned_t)type),
6042 + ktrace_enter(xfs_dir_trace_buf, (void *)(unsigned long)type,
6044 (void *)a0, (void *)a1, (void *)a2,
6045 (void *)a3, (void *)a4, (void *)a5,
6046 diff -urN linux.org/fs/xfs/xfs_dir.h linux/fs/xfs/xfs_dir.h
6047 --- linux.org/fs/xfs/xfs_dir.h 2003-12-31 05:46:52.000000000 +0100
6048 +++ linux/fs/xfs/xfs_dir.h 2004-01-02 04:21:43.000000000 +0100
6050 * as possible so as to fit into the literal area of the inode.
6053 -#ifdef XFS_ALL_TRACE
6054 -#define XFS_DIR_TRACE
6057 -#if !defined(DEBUG)
6058 -#undef XFS_DIR_TRACE
6061 /*========================================================================
6062 * Function prototypes for the kernel.
6063 *========================================================================*/
6064 diff -urN linux.org/fs/xfs/xfs_dir_sf.h linux/fs/xfs/xfs_dir_sf.h
6065 --- linux.org/fs/xfs/xfs_dir_sf.h 2003-12-31 05:47:55.000000000 +0100
6066 +++ linux/fs/xfs/xfs_dir_sf.h 2004-01-02 04:21:44.000000000 +0100
6067 @@ -126,13 +126,7 @@
6068 ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen))
6071 -#ifdef XFS_ALL_TRACE
6072 -#define XFS_DIR_TRACE
6075 -#if !defined(DEBUG)
6076 -#undef XFS_DIR_TRACE
6078 +#if defined(XFS_DIR_TRACE)
6081 * Kernel tracing support for directories.
6083 struct xfs_dir_leaf_entry;
6085 #define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */
6086 +extern ktrace_t *xfs_dir_trace_buf;
6089 * Trace record types.
6091 #define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */
6092 #define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */
6094 -#if defined(XFS_DIR_TRACE)
6096 void xfs_dir_trace_g_du(char *where, struct xfs_inode *dp, struct uio *uio);
6097 void xfs_dir_trace_g_dub(char *where, struct xfs_inode *dp, struct uio *uio,
6099 @@ -170,12 +163,9 @@
6100 void xfs_dir_trace_g_duc(char *where, struct xfs_inode *dp, struct uio *uio,
6102 void xfs_dir_trace_enter(int type, char *where,
6103 - __psunsigned_t a0, __psunsigned_t a1,
6104 - __psunsigned_t a2, __psunsigned_t a3,
6105 - __psunsigned_t a4, __psunsigned_t a5,
6106 - __psunsigned_t a6, __psunsigned_t a7,
6107 - __psunsigned_t a8, __psunsigned_t a9,
6108 - __psunsigned_t a10, __psunsigned_t a11);
6109 + void *a0, void *a1, void *a2, void *a3,
6110 + void *a4, void *a5, void *a6, void *a7,
6111 + void *a8, void *a9, void *a10, void *a11);
6113 #define xfs_dir_trace_g_du(w,d,u)
6114 #define xfs_dir_trace_g_dub(w,d,u,b)
6115 diff -urN linux.org/fs/xfs/xfs_dmapi.h linux/fs/xfs/xfs_dmapi.h
6116 --- linux.org/fs/xfs/xfs_dmapi.h 2003-12-31 05:48:36.000000000 +0100
6117 +++ linux/fs/xfs/xfs_dmapi.h 2004-01-02 04:21:44.000000000 +0100
6118 @@ -175,14 +175,6 @@
6119 DM_FLAGS_NDELAY : 0)
6120 #define AT_DELAY_FLAG(f) ((f&ATTR_NONBLOCK) ? DM_FLAGS_NDELAY : 0)
6123 - * Macros to turn caller specified delay/block flags into
6124 - * dm_send_xxxx_event flag DM_FLAGS_NDELAY.
6127 -#define FILP_DELAY_FLAG(filp) ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) ? \
6128 - DM_FLAGS_NDELAY : 0)
6131 extern struct bhv_vfsops xfs_dmops;
6133 diff -urN linux.org/fs/xfs/xfs_dmops.c linux/fs/xfs/xfs_dmops.c
6134 --- linux.org/fs/xfs/xfs_dmops.c 2003-12-31 05:48:36.000000000 +0100
6135 +++ linux/fs/xfs/xfs_dmops.c 2004-01-02 04:21:44.000000000 +0100
6137 #include "xfs_dmapi.h"
6138 #include "xfs_mount.h"
6141 -#ifndef CONFIG_XFS_DMAPI
6142 xfs_dmops_t xfs_dmcore_xfs = {
6143 .xfs_send_data = (xfs_send_data_t)fs_nosys,
6144 .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr,
6146 .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys,
6147 .xfs_send_unmount = (xfs_send_unmount_t)fs_noval,
6149 -#endif /* CONFIG_XFS_DMAPI */
6150 diff -urN linux.org/fs/xfs/xfs_error.c linux/fs/xfs/xfs_error.c
6151 --- linux.org/fs/xfs/xfs_error.c 2003-12-31 05:48:26.000000000 +0100
6152 +++ linux/fs/xfs/xfs_error.c 2004-01-02 04:21:44.000000000 +0100
6154 if (random() % randfactor)
6157 - memcpy(&fsid, fsidp, sizeof(fsid_t));
6158 + memcpy(&fsid, fsidp, sizeof(xfs_fsid_t));
6160 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
6161 if (xfs_etest[i] == error_tag && xfs_etest_fsid[i] == fsid) {
6166 - memcpy(&fsid, mp->m_fixedfsid, sizeof(fsid_t));
6167 + memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
6169 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
6170 if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {
6175 - memcpy(&fsid, mp->m_fixedfsid, sizeof(fsid_t));
6176 + memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
6178 for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
6179 if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {
6184 - memcpy(&fsid, mp->m_fixedfsid, sizeof(fsid_t));
6185 + memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));
6187 return xfs_errortag_clearall_umount(fsid, mp->m_fsname, 1);
6189 @@ -258,12 +258,6 @@
6193 -xfs_stack_trace(void)
6202 diff -urN linux.org/fs/xfs/xfs_fsops.c linux/fs/xfs/xfs_fsops.c
6203 --- linux.org/fs/xfs/xfs_fsops.c 2003-12-31 05:48:18.000000000 +0100
6204 +++ linux/fs/xfs/xfs_fsops.c 2004-01-02 04:21:42.000000000 +0100
6206 #include "xfs_fsops.h"
6207 #include "xfs_itable.h"
6209 +#include "xfs_refcache.h"
6210 #include "xfs_trans_space.h"
6211 #include "xfs_rtalloc.h"
6212 #include "xfs_dir2.h"
6214 /* Stop new writers */
6215 xfs_start_freeze(mp, XFS_FREEZE_WRITE);
6217 + /* Flush the refcache */
6218 + xfs_refcache_purge_mp(mp);
6220 /* Flush delalloc and delwri data */
6221 VFS_SYNC(vfsp, SYNC_DELWRI|SYNC_WAIT, NULL, error);
6223 diff -urN linux.org/fs/xfs/xfsidbg.c linux/fs/xfs/xfsidbg.c
6224 --- linux.org/fs/xfs/xfsidbg.c 2003-12-31 05:48:07.000000000 +0100
6225 +++ linux/fs/xfs/xfsidbg.c 2004-01-02 04:21:43.000000000 +0100
6230 -#include "pagebuf/page_buf_internal.h"
6232 #include <linux/ctype.h>
6233 #include <linux/kdb.h>
6235 #include "xfs_attr_sf.h"
6236 #include "xfs_dir_sf.h"
6237 #include "xfs_dir2_sf.h"
6238 +#include "xfs_dir2_trace.h"
6239 #include "xfs_dinode.h"
6240 -#include "xfs_inode.h"
6241 +#include "xfs_rw.h"
6242 #include "xfs_bmap.h"
6243 +#include "xfs_inode.h"
6244 #include "xfs_da_btree.h"
6245 #include "xfs_attr.h"
6246 #include "xfs_attr_leaf.h"
6248 #include "xfs_dir2_leaf.h"
6249 #include "xfs_dir2_block.h"
6250 #include "xfs_dir2_node.h"
6251 -#include "xfs_dir2_trace.h"
6252 #include "xfs_log_priv.h"
6253 #include "xfs_log_recover.h"
6254 -#include "xfs_rw.h"
6255 #include "xfs_bit.h"
6256 #include "xfs_quota.h"
6257 #include "quota/xfs_qm.h"
6258 +#include "xfs_iomap.h"
6260 MODULE_AUTHOR("Silicon Graphics, Inc.");
6261 MODULE_DESCRIPTION("Additional kdb commands for debugging XFS");
6262 MODULE_LICENSE("GPL");
6264 +#define qprintf kdb_printf
6267 + * Command table functions. (tracing)
6269 +#ifdef XFS_ALLOC_TRACE
6270 +static void xfsidbg_xalatrace(int);
6271 +static void xfsidbg_xalbtrace(xfs_agblock_t);
6272 +static void xfsidbg_xalgtrace(xfs_agnumber_t);
6273 +static void xfsidbg_xalmtrace(xfs_mount_t *);
6274 +static void xfsidbg_xalttrace(int);
6276 +#ifdef XFS_ATTR_TRACE
6277 +static void xfsidbg_xattrtrace(int);
6279 +#ifdef XFS_BLI_TRACE
6280 +static void xfsidbg_xblitrace(xfs_buf_log_item_t *);
6282 +#ifdef XFS_BMAP_TRACE
6283 +static void xfsidbg_xbmatrace(int);
6284 +static void xfsidbg_xbmitrace(xfs_inode_t *);
6285 +static void xfsidbg_xbmstrace(xfs_inode_t *);
6286 +static void xfsidbg_xbxatrace(int);
6287 +static void xfsidbg_xbxitrace(xfs_inode_t *);
6288 +static void xfsidbg_xbxstrace(xfs_inode_t *);
6290 +#ifdef XFS_ILOCK_TRACE
6291 +static void xfsidbg_xilock_trace(xfs_inode_t *);
6292 +static void xfsidbg_xailock_trace(int);
6294 +#ifdef XFS_DIR_TRACE
6295 +static void xfsidbg_xdirtrace(int);
6297 +#ifdef XFS_DIR2_TRACE
6298 +static void xfsidbg_xdir2atrace(int);
6299 +static void xfsidbg_xdir2itrace(xfs_inode_t *);
6301 +#ifdef XFS_LOG_TRACE
6302 +static void xfsidbg_xiclogtrace(xlog_in_core_t *);
6303 +static void xfsidbg_xlog_granttrace(xlog_t *);
6305 +#ifdef XFS_DQUOT_TRACE
6306 +static void xfsidbg_xqm_dqtrace(xfs_dquot_t *);
6308 +#ifdef XFS_RW_TRACE
6309 +static void xfsidbg_xrwtrace(xfs_inode_t *);
6314 * Command table functions.
6317 static void xfsidbg_xagi(xfs_agi_t *);
6318 static void xfsidbg_xaildump(xfs_mount_t *);
6319 static void xfsidbg_xalloc(xfs_alloc_arg_t *);
6321 -static void xfsidbg_xalmtrace(xfs_mount_t *);
6323 static void xfsidbg_xattrcontext(xfs_attr_list_context_t *);
6324 static void xfsidbg_xattrleaf(xfs_attr_leafblock_t *);
6325 static void xfsidbg_xattrsf(xfs_attr_shortform_t *);
6327 static void xfsidbg_xbtcur(xfs_btree_cur_t *);
6328 static void xfsidbg_xbuf(xfs_buf_t *);
6329 static void xfsidbg_xbuf_real(xfs_buf_t *, int);
6330 +static void xfsidbg_xarg(int);
6331 +static void xfsidbg_xchksum(uint *);
6332 static void xfsidbg_xchash(xfs_mount_t *mp);
6333 static void xfsidbg_xchashlist(xfs_chashlist_t *chl);
6334 static void xfsidbg_xdaargs(xfs_da_args_t *);
6335 @@ -144,13 +192,18 @@
6336 static void xfsidbg_xsb(xfs_sb_t *, int convert);
6337 static void xfsidbg_xtp(xfs_trans_t *);
6338 static void xfsidbg_xtrans_res(xfs_mount_t *);
6339 -#ifdef CONFIG_XFS_QUOTA
6340 +#ifdef CONFIG_XFS_QUOTA
6341 static void xfsidbg_xqm(void);
6342 static void xfsidbg_xqm_htab(void);
6343 static void xfsidbg_xqm_freelist_print(xfs_frlist_t *qlist, char *title);
6344 static void xfsidbg_xqm_freelist(void);
6347 +#ifdef XFS_BMAP_TRACE
6348 +static void xfs_convert_extent(xfs_bmbt_rec_32_t *, xfs_dfiloff_t *,
6349 + xfs_dfsbno_t *, xfs_dfilblks_t *, int *);
6354 static int kdbm_xfs_xagf(
6359 -static int kdbm_xfs_xalloc(
6360 +#ifdef XFS_ALLOC_TRACE
6361 +static int kdbm_xfs_xalatrace(
6365 @@ -226,19 +280,19 @@
6372 return KDB_ARGCOUNT;
6374 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6378 - xfsidbg_xalloc((xfs_alloc_arg_t *) addr);
6379 + xfsidbg_xalatrace((int) addr);
6384 -static int kdbm_xfs_xalmtrace(
6385 +static int kdbm_xfs_xalbtrace(
6389 @@ -251,16 +305,16 @@
6392 return KDB_ARGCOUNT;
6394 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6398 - xfsidbg_xalmtrace((xfs_mount_t *) addr);
6399 + xfsidbg_xalbtrace((xfs_agblock_t) addr);
6404 -static int kdbm_xfs_xattrcontext(
6405 +static int kdbm_xfs_xalgtrace(
6409 @@ -273,15 +327,18 @@
6412 return KDB_ARGCOUNT;
6414 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6418 - xfsidbg_xattrcontext((xfs_attr_list_context_t *) addr);
6419 + xfsidbg_xalgtrace((xfs_agnumber_t) addr);
6424 -static int kdbm_xfs_xattrleaf(
6425 +#ifdef XFS_ATTR_TRACE
6426 +static int kdbm_xfs_xattrtrace(
6430 @@ -294,15 +351,18 @@
6433 return KDB_ARGCOUNT;
6435 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6439 - xfsidbg_xattrleaf((xfs_attr_leafblock_t *) addr);
6440 + xfsidbg_xattrtrace((int) addr);
6445 -static int kdbm_xfs_xattrsf(
6446 +#ifdef XFS_BLI_TRACE
6447 +static int kdbm_xfs_xblitrace(
6451 @@ -315,15 +375,18 @@
6454 return KDB_ARGCOUNT;
6456 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6460 - xfsidbg_xattrsf((xfs_attr_shortform_t *) addr);
6461 + xfsidbg_xblitrace((xfs_buf_log_item_t *) addr);
6466 -static int kdbm_xfs_xbirec(
6467 +#ifdef XFS_BMAP_TRACE
6468 +static int kdbm_xfs_xbmatrace(
6472 @@ -336,15 +399,16 @@
6475 return KDB_ARGCOUNT;
6477 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6481 - xfsidbg_xbirec((xfs_bmbt_irec_t *) addr);
6482 + xfsidbg_xbmatrace((int) addr);
6486 -static int kdbm_xfs_xbmalla(
6487 +static int kdbm_xfs_xbmitrace(
6491 @@ -357,15 +421,16 @@
6494 return KDB_ARGCOUNT;
6496 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6500 - xfsidbg_xbmalla((xfs_bmalloca_t *)addr);
6501 + xfsidbg_xbmitrace((xfs_inode_t *) addr);
6505 -static int kdbm_xfs_xbrec(
6506 +static int kdbm_xfs_xbmstrace(
6510 @@ -378,15 +443,16 @@
6513 return KDB_ARGCOUNT;
6515 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6519 - xfsidbg_xbrec((xfs_bmbt_rec_64_t *) addr);
6520 + xfsidbg_xbmstrace((xfs_inode_t *) addr);
6524 -static int kdbm_xfs_xbroot(
6525 +static int kdbm_xfs_xbxatrace(
6529 @@ -399,15 +465,16 @@
6532 return KDB_ARGCOUNT;
6534 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6538 - xfsidbg_xbroot((xfs_inode_t *) addr);
6539 + xfsidbg_xbxatrace((int) addr);
6543 -static int kdbm_xfs_xbroota(
6544 +static int kdbm_xfs_xbxitrace(
6548 @@ -420,15 +487,16 @@
6551 return KDB_ARGCOUNT;
6553 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6557 - xfsidbg_xbroota((xfs_inode_t *) addr);
6558 + xfsidbg_xbxitrace((xfs_inode_t *) addr);
6562 -static int kdbm_xfs_xbtcur(
6563 +static int kdbm_xfs_xbxstrace(
6567 @@ -441,15 +509,18 @@
6570 return KDB_ARGCOUNT;
6572 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6576 - xfsidbg_xbtcur((xfs_btree_cur_t *) addr);
6577 + xfsidbg_xbxstrace((xfs_inode_t *) addr);
6582 -static int kdbm_xfs_xbuf(
6583 +#ifdef XFS_DIR2_TRACE
6584 +static int kdbm_xfs_xdir2atrace(
6588 @@ -462,16 +533,16 @@
6591 return KDB_ARGCOUNT;
6593 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6597 - xfsidbg_xbuf((xfs_buf_t *) addr);
6598 + xfsidbg_xdir2atrace((int) addr);
6603 -static int kdbm_xfs_xchash(
6604 +static int kdbm_xfs_xdir2itrace(
6608 @@ -484,15 +555,18 @@
6611 return KDB_ARGCOUNT;
6613 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6617 - xfsidbg_xchash((xfs_mount_t *) addr);
6618 + xfsidbg_xdir2itrace((xfs_inode_t *) addr);
6623 -static int kdbm_xfs_xchashlist(
6624 +#ifdef XFS_DIR_TRACE
6625 +static int kdbm_xfs_xdirtrace(
6629 @@ -505,16 +579,18 @@
6632 return KDB_ARGCOUNT;
6634 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6638 - xfsidbg_xchashlist((xfs_chashlist_t *) addr);
6639 + xfsidbg_xdirtrace((int) addr);
6645 -static int kdbm_xfs_xdaargs(
6646 +#ifdef XFS_LOG_TRACE
6647 +static int kdbm_xfs_xiclogtrace(
6651 @@ -527,15 +603,18 @@
6654 return KDB_ARGCOUNT;
6656 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6660 - xfsidbg_xdaargs((xfs_da_args_t *) addr);
6661 + xfsidbg_xiclogtrace((xlog_in_core_t *) addr);
6666 -static int kdbm_xfs_xdabuf(
6667 +#ifdef XFS_ILOCK_TRACE
6668 +static int kdbm_xfs_xilock_trace(
6672 @@ -548,15 +627,16 @@
6675 return KDB_ARGCOUNT;
6677 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6681 - xfsidbg_xdabuf((xfs_dabuf_t *) addr);
6682 + xfsidbg_xilock_trace((xfs_inode_t *) addr);
6686 -static int kdbm_xfs_xdanode(
6687 +static int kdbm_xfs_xailock_trace(
6691 @@ -569,15 +649,18 @@
6694 return KDB_ARGCOUNT;
6696 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6700 - xfsidbg_xdanode((xfs_da_intnode_t *) addr);
6701 + xfsidbg_xailock_trace((int) addr);
6706 -static int kdbm_xfs_xdastate(
6707 +#ifdef XFS_LOG_TRACE
6708 +static int kdbm_xfs_xlog_granttrace(
6712 @@ -590,15 +673,18 @@
6715 return KDB_ARGCOUNT;
6717 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6721 - xfsidbg_xdastate((xfs_da_state_t *) addr);
6722 + xfsidbg_xlog_granttrace((xlog_t *) addr);
6727 -static int kdbm_xfs_xdirleaf(
6728 +#ifdef XFS_DQUOT_TRACE
6729 +static int kdbm_xfs_xqm_dqtrace(
6733 @@ -611,15 +697,18 @@
6736 return KDB_ARGCOUNT;
6738 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6742 - xfsidbg_xdirleaf((xfs_dir_leafblock_t *) addr);
6743 + xfsidbg_xqm_dqtrace((xfs_dquot_t *) addr);
6748 -static int kdbm_xfs_xdirsf(
6749 +#ifdef XFS_RW_TRACE
6750 +static int kdbm_xfs_xrwtrace(
6754 @@ -632,15 +721,17 @@
6757 return KDB_ARGCOUNT;
6759 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6763 - xfsidbg_xdirsf((xfs_dir_shortform_t *) addr);
6764 + xfsidbg_xrwtrace((xfs_inode_t *) addr);
6769 -static int kdbm_xfs_xdir2free(
6770 +static int kdbm_xfs_xalloc(
6774 @@ -657,11 +748,12 @@
6778 - xfsidbg_xdir2free((xfs_dir2_free_t *) addr);
6779 + xfsidbg_xalloc((xfs_alloc_arg_t *) addr);
6783 -static int kdbm_xfs_xdir2sf(
6784 +#ifdef XFS_ALLOC_TRACE
6785 +static int kdbm_xfs_xalmtrace(
6789 @@ -678,11 +770,11 @@
6793 - xfsidbg_xdir2sf((xfs_dir2_sf_t *) addr);
6794 + xfsidbg_xalmtrace((xfs_mount_t *) addr);
6798 -static int kdbm_xfs_xexlist(
6799 +static int kdbm_xfs_xalttrace(
6803 @@ -699,11 +791,12 @@
6807 - xfsidbg_xexlist((xfs_inode_t *) addr);
6808 + xfsidbg_xalttrace((int) addr);
6811 +#endif /* XFS_ALLOC_TRACE */
6813 -static int kdbm_xfs_xflist(
6814 +static int kdbm_xfs_xattrcontext(
6818 @@ -720,24 +813,32 @@
6822 - xfsidbg_xflist((xfs_bmap_free_t *) addr);
6823 + xfsidbg_xattrcontext((xfs_attr_list_context_t *) addr);
6827 -static int kdbm_xfs_xhelp(
6828 +static int kdbm_xfs_xattrleaf(
6832 struct pt_regs *regs)
6835 + unsigned long addr;
6841 return KDB_ARGCOUNT;
6842 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
6847 + xfsidbg_xattrleaf((xfs_attr_leafblock_t *) addr);
6851 -static int kdbm_xfs_xiclog(
6852 +static int kdbm_xfs_xattrsf(
6856 @@ -754,11 +855,11 @@
6860 - xfsidbg_xiclog((xlog_in_core_t *) addr);
6861 + xfsidbg_xattrsf((xfs_attr_shortform_t *) addr);
6865 -static int kdbm_xfs_xiclogall(
6866 +static int kdbm_xfs_xbirec(
6870 @@ -775,11 +876,11 @@
6874 - xfsidbg_xiclogall((xlog_in_core_t *) addr);
6875 + xfsidbg_xbirec((xfs_bmbt_irec_t *) addr);
6879 -static int kdbm_xfs_xiclogcb(
6880 +static int kdbm_xfs_xbmalla(
6884 @@ -796,11 +897,11 @@
6888 - xfsidbg_xiclogcb((xlog_in_core_t *) addr);
6889 + xfsidbg_xbmalla((xfs_bmalloca_t *)addr);
6893 -static int kdbm_xfs_xihash(
6894 +static int kdbm_xfs_xbrec(
6898 @@ -817,11 +918,11 @@
6902 - xfsidbg_xihash((xfs_mount_t *) addr);
6903 + xfsidbg_xbrec((xfs_bmbt_rec_64_t *) addr);
6907 -static int kdbm_xfs_xinodes(
6908 +static int kdbm_xfs_xbroot(
6912 @@ -838,11 +939,11 @@
6916 - xfsidbg_xinodes((xfs_mount_t *) addr);
6917 + xfsidbg_xbroot((xfs_inode_t *) addr);
6921 -static int kdbm_xfs_delayed_blocks(
6922 +static int kdbm_xfs_xbroota(
6926 @@ -859,12 +960,11 @@
6930 - xfsidbg_delayed_blocks((xfs_mount_t *) addr);
6931 + xfsidbg_xbroota((xfs_inode_t *) addr);
6936 -static int kdbm_xfs_xinodes_quiesce(
6937 +static int kdbm_xfs_xbtcur(
6941 @@ -881,11 +981,11 @@
6945 - xfsidbg_xinodes_quiesce((xfs_mount_t *) addr);
6946 + xfsidbg_xbtcur((xfs_btree_cur_t *) addr);
6950 -static int kdbm_xfs_xlog(
6951 +static int kdbm_xfs_xbuf(
6955 @@ -902,11 +1002,12 @@
6959 - xfsidbg_xlog((xlog_t *) addr);
6960 + xfsidbg_xbuf((xfs_buf_t *) addr);
6964 -static int kdbm_xfs_xlog_ritem(
6966 +static int kdbm_xfs_xarg(
6970 @@ -923,11 +1024,11 @@
6974 - xfsidbg_xlog_ritem((xlog_recover_item_t *) addr);
6975 + xfsidbg_xarg((int) addr);
6979 -static int kdbm_xfs_xlog_rtrans(
6980 +static int kdbm_xfs_xchksum(
6984 @@ -944,11 +1045,12 @@
6988 - xfsidbg_xlog_rtrans((xlog_recover_t *) addr);
6989 + xfsidbg_xchksum((uint *) addr);
6993 -static int kdbm_xfs_xlog_rtrans_entire(
6995 +static int kdbm_xfs_xchash(
6999 @@ -965,11 +1067,11 @@
7003 - xfsidbg_xlog_rtrans_entire((xlog_recover_t *) addr);
7004 + xfsidbg_xchash((xfs_mount_t *) addr);
7008 -static int kdbm_xfs_xlog_tic(
7009 +static int kdbm_xfs_xchashlist(
7013 @@ -986,11 +1088,12 @@
7017 - xfsidbg_xlog_tic((xlog_ticket_t *) addr);
7018 + xfsidbg_xchashlist((xfs_chashlist_t *) addr);
7022 -static int kdbm_xfs_xlogitem(
7024 +static int kdbm_xfs_xdaargs(
7028 @@ -1007,11 +1110,11 @@
7032 - xfsidbg_xlogitem((xfs_log_item_t *) addr);
7033 + xfsidbg_xdaargs((xfs_da_args_t *) addr);
7037 -static int kdbm_xfs_xmount(
7038 +static int kdbm_xfs_xdabuf(
7042 @@ -1028,11 +1131,11 @@
7046 - xfsidbg_xmount((xfs_mount_t *) addr);
7047 + xfsidbg_xdabuf((xfs_dabuf_t *) addr);
7051 -static int kdbm_xfs_xnode(
7052 +static int kdbm_xfs_xdanode(
7056 @@ -1049,11 +1152,11 @@
7060 - xfsidbg_xnode((xfs_inode_t *) addr);
7061 + xfsidbg_xdanode((xfs_da_intnode_t *) addr);
7065 -static int kdbm_xfs_xcore(
7066 +static int kdbm_xfs_xdastate(
7070 @@ -1070,11 +1173,11 @@
7074 - xfsidbg_xcore((xfs_iocore_t *) addr);
7075 + xfsidbg_xdastate((xfs_da_state_t *) addr);
7079 -static int kdbm_xfs_xperag(
7080 +static int kdbm_xfs_xdirleaf(
7084 @@ -1091,11 +1194,11 @@
7088 - xfsidbg_xperag((xfs_mount_t *) addr);
7089 + xfsidbg_xdirleaf((xfs_dir_leafblock_t *) addr);
7093 -static int kdbm_xfs_xqm_diskdq(
7094 +static int kdbm_xfs_xdirsf(
7098 @@ -1112,11 +1215,11 @@
7102 - xfsidbg_xqm_diskdq((xfs_disk_dquot_t *) addr);
7103 + xfsidbg_xdirsf((xfs_dir_shortform_t *) addr);
7107 -static int kdbm_xfs_xqm_dqattached_inos(
7108 +static int kdbm_xfs_xdir2free(
7112 @@ -1133,11 +1236,11 @@
7116 - xfsidbg_xqm_dqattached_inos((xfs_mount_t *) addr);
7117 + xfsidbg_xdir2free((xfs_dir2_free_t *) addr);
7121 -static int kdbm_xfs_xqm_dquot(
7122 +static int kdbm_xfs_xdir2sf(
7126 @@ -1154,38 +1257,53 @@
7130 - xfsidbg_xqm_dquot((xfs_dquot_t *) addr);
7131 + xfsidbg_xdir2sf((xfs_dir2_sf_t *) addr);
7135 -#ifdef CONFIG_XFS_QUOTA
7136 -static int kdbm_xfs_xqm(
7137 +static int kdbm_xfs_xexlist(
7141 struct pt_regs *regs)
7144 + unsigned long addr;
7150 return KDB_ARGCOUNT;
7151 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7156 + xfsidbg_xexlist((xfs_inode_t *) addr);
7160 -static int kdbm_xfs_xqm_freelist(
7161 +static int kdbm_xfs_xflist(
7165 struct pt_regs *regs)
7168 + unsigned long addr;
7174 return KDB_ARGCOUNT;
7175 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7179 - xfsidbg_xqm_freelist();
7180 + xfsidbg_xflist((xfs_bmap_free_t *) addr);
7184 -static int kdbm_xfs_xqm_htab(
7185 +static int kdbm_xfs_xhelp(
7189 @@ -1194,12 +1312,11 @@
7191 return KDB_ARGCOUNT;
7193 - xfsidbg_xqm_htab();
7199 -static int kdbm_xfs_xqm_mplist(
7200 +static int kdbm_xfs_xiclog(
7204 @@ -1216,11 +1333,11 @@
7208 - xfsidbg_xqm_mplist((xfs_mount_t *) addr);
7209 + xfsidbg_xiclog((xlog_in_core_t *) addr);
7213 -static int kdbm_xfs_xqm_qinfo(
7214 +static int kdbm_xfs_xiclogall(
7218 @@ -1237,11 +1354,473 @@
7222 - xfsidbg_xqm_qinfo((xfs_mount_t *) addr);
7223 + xfsidbg_xiclogall((xlog_in_core_t *) addr);
7227 -static int kdbm_xfs_xqm_tpdqinfo(
7228 +static int kdbm_xfs_xiclogcb(
7230 + const char **argv,
7231 + const char **envp,
7232 + struct pt_regs *regs)
7234 + unsigned long addr;
7240 + return KDB_ARGCOUNT;
7241 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7245 + xfsidbg_xiclogcb((xlog_in_core_t *) addr);
7249 +static int kdbm_xfs_xihash(
7251 + const char **argv,
7252 + const char **envp,
7253 + struct pt_regs *regs)
7255 + unsigned long addr;
7261 + return KDB_ARGCOUNT;
7262 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7266 + xfsidbg_xihash((xfs_mount_t *) addr);
7270 +static int kdbm_xfs_xinodes(
7272 + const char **argv,
7273 + const char **envp,
7274 + struct pt_regs *regs)
7276 + unsigned long addr;
7282 + return KDB_ARGCOUNT;
7283 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7287 + xfsidbg_xinodes((xfs_mount_t *) addr);
7291 +static int kdbm_xfs_delayed_blocks(
7293 + const char **argv,
7294 + const char **envp,
7295 + struct pt_regs *regs)
7297 + unsigned long addr;
7303 + return KDB_ARGCOUNT;
7304 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7308 + xfsidbg_delayed_blocks((xfs_mount_t *) addr);
7313 +static int kdbm_xfs_xinodes_quiesce(
7315 + const char **argv,
7316 + const char **envp,
7317 + struct pt_regs *regs)
7319 + unsigned long addr;
7325 + return KDB_ARGCOUNT;
7326 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7330 + xfsidbg_xinodes_quiesce((xfs_mount_t *) addr);
7334 +static int kdbm_xfs_xlog(
7336 + const char **argv,
7337 + const char **envp,
7338 + struct pt_regs *regs)
7340 + unsigned long addr;
7346 + return KDB_ARGCOUNT;
7347 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7351 + xfsidbg_xlog((xlog_t *) addr);
7355 +static int kdbm_xfs_xlog_ritem(
7357 + const char **argv,
7358 + const char **envp,
7359 + struct pt_regs *regs)
7361 + unsigned long addr;
7367 + return KDB_ARGCOUNT;
7368 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7372 + xfsidbg_xlog_ritem((xlog_recover_item_t *) addr);
7376 +static int kdbm_xfs_xlog_rtrans(
7378 + const char **argv,
7379 + const char **envp,
7380 + struct pt_regs *regs)
7382 + unsigned long addr;
7388 + return KDB_ARGCOUNT;
7389 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7393 + xfsidbg_xlog_rtrans((xlog_recover_t *) addr);
7397 +static int kdbm_xfs_xlog_rtrans_entire(
7399 + const char **argv,
7400 + const char **envp,
7401 + struct pt_regs *regs)
7403 + unsigned long addr;
7409 + return KDB_ARGCOUNT;
7410 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7414 + xfsidbg_xlog_rtrans_entire((xlog_recover_t *) addr);
7418 +static int kdbm_xfs_xlog_tic(
7420 + const char **argv,
7421 + const char **envp,
7422 + struct pt_regs *regs)
7424 + unsigned long addr;
7430 + return KDB_ARGCOUNT;
7431 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7435 + xfsidbg_xlog_tic((xlog_ticket_t *) addr);
7439 +static int kdbm_xfs_xlogitem(
7441 + const char **argv,
7442 + const char **envp,
7443 + struct pt_regs *regs)
7445 + unsigned long addr;
7451 + return KDB_ARGCOUNT;
7452 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7456 + xfsidbg_xlogitem((xfs_log_item_t *) addr);
7460 +static int kdbm_xfs_xmount(
7462 + const char **argv,
7463 + const char **envp,
7464 + struct pt_regs *regs)
7466 + unsigned long addr;
7472 + return KDB_ARGCOUNT;
7473 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7477 + xfsidbg_xmount((xfs_mount_t *) addr);
7481 +static int kdbm_xfs_xnode(
7483 + const char **argv,
7484 + const char **envp,
7485 + struct pt_regs *regs)
7487 + unsigned long addr;
7493 + return KDB_ARGCOUNT;
7494 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7498 + xfsidbg_xnode((xfs_inode_t *) addr);
7502 +static int kdbm_xfs_xcore(
7504 + const char **argv,
7505 + const char **envp,
7506 + struct pt_regs *regs)
7508 + unsigned long addr;
7514 + return KDB_ARGCOUNT;
7515 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7519 + xfsidbg_xcore((xfs_iocore_t *) addr);
7523 +static int kdbm_xfs_xperag(
7525 + const char **argv,
7526 + const char **envp,
7527 + struct pt_regs *regs)
7529 + unsigned long addr;
7535 + return KDB_ARGCOUNT;
7536 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7540 + xfsidbg_xperag((xfs_mount_t *) addr);
7544 +static int kdbm_xfs_xqm_diskdq(
7546 + const char **argv,
7547 + const char **envp,
7548 + struct pt_regs *regs)
7550 + unsigned long addr;
7556 + return KDB_ARGCOUNT;
7557 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7561 + xfsidbg_xqm_diskdq((xfs_disk_dquot_t *) addr);
7565 +static int kdbm_xfs_xqm_dqattached_inos(
7567 + const char **argv,
7568 + const char **envp,
7569 + struct pt_regs *regs)
7571 + unsigned long addr;
7577 + return KDB_ARGCOUNT;
7578 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7582 + xfsidbg_xqm_dqattached_inos((xfs_mount_t *) addr);
7586 +static int kdbm_xfs_xqm_dquot(
7588 + const char **argv,
7589 + const char **envp,
7590 + struct pt_regs *regs)
7592 + unsigned long addr;
7598 + return KDB_ARGCOUNT;
7599 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7603 + xfsidbg_xqm_dquot((xfs_dquot_t *) addr);
7607 +#ifdef CONFIG_XFS_QUOTA
7608 +static int kdbm_xfs_xqm(
7610 + const char **argv,
7611 + const char **envp,
7612 + struct pt_regs *regs)
7615 + return KDB_ARGCOUNT;
7621 +static int kdbm_xfs_xqm_freelist(
7623 + const char **argv,
7624 + const char **envp,
7625 + struct pt_regs *regs)
7628 + return KDB_ARGCOUNT;
7630 + xfsidbg_xqm_freelist();
7634 +static int kdbm_xfs_xqm_htab(
7636 + const char **argv,
7637 + const char **envp,
7638 + struct pt_regs *regs)
7641 + return KDB_ARGCOUNT;
7643 + xfsidbg_xqm_htab();
7648 +static int kdbm_xfs_xqm_mplist(
7650 + const char **argv,
7651 + const char **envp,
7652 + struct pt_regs *regs)
7654 + unsigned long addr;
7660 + return KDB_ARGCOUNT;
7661 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7665 + xfsidbg_xqm_mplist((xfs_mount_t *) addr);
7669 +static int kdbm_xfs_xqm_qinfo(
7671 + const char **argv,
7672 + const char **envp,
7673 + struct pt_regs *regs)
7675 + unsigned long addr;
7681 + return KDB_ARGCOUNT;
7682 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7686 + xfsidbg_xqm_qinfo((xfs_mount_t *) addr);
7690 +static int kdbm_xfs_xqm_tpdqinfo(
7694 @@ -1404,45 +1983,52 @@
7698 -static void printvnode(vnode_t *vp)
7699 +static void printbhv(bhv_desc_t *bdp)
7702 kdb_symtab_t symtab;
7704 + if (bdp == NULL) {
7705 + kdb_printf("NULL bhv\n");
7709 + kdb_printf("bhv at 0x%p\n", bdp);
7711 + if (kdbnearsym((unsigned long)bdp->bd_ops, &symtab))
7712 + kdb_printf(" ops %s", symtab.sym_name);
7714 + kdb_printf(" ops %s/0x%p", "???", (void *)bdp->bd_ops);
7716 + kdb_printf(" vobj 0x%p pdata 0x%p next 0x%p\n",
7717 + bdp->bd_vobj, bdp->bd_pdata, bdp->bd_next);
7719 + bdp = bdp->bd_next;
7723 - kdb_printf("vnode: 0x%p type ", vp);
7725 +static void printvnode(vnode_t *vp, unsigned long addr)
7727 + kdb_printf("vnode: 0x%lx type ", addr);
7728 if ((size_t)vp->v_type >= sizeof(vnode_type)/sizeof(vnode_type[0]))
7729 kdb_printf("out of range 0x%x", vp->v_type);
7731 kdb_printf("%s", vnode_type[vp->v_type]);
7732 - kdb_printf(" v_bh %p\n", &vp->v_bh);
7733 + kdb_printf(" v_bh 0x%p\n", &vp->v_bh);
7735 - if ((bh = vp->v_bh.bh_first)) {
7736 - kdb_printf(" v_inode 0x%p v_bh->bh_first 0x%p pobj 0x%p\n",
7737 - LINVFS_GET_IP(vp), bh, bh->bd_pdata);
7739 - if (kdbnearsym((unsigned long)bh->bd_ops, &symtab))
7740 - kdb_printf(" ops %s ", symtab.sym_name);
7742 - kdb_printf(" ops %s/0x%p ",
7743 - "???", (void *)bh->bd_ops);
7745 - kdb_printf(" v_inode 0x%p v_bh->bh_first = NULLBHV ",
7746 - LINVFS_GET_IP(vp));
7748 + printbhv(vp->v_fbhv);
7750 printflags((__psunsigned_t)vp->v_flag, tab_vflags, "flag =");
7753 -#ifdef CONFIG_XFS_VNODE_TRACING
7754 +#ifdef XFS_VNODE_TRACE
7755 kdb_printf(" v_trace 0x%p\n", vp->v_trace);
7756 -#endif /* CONFIG_XFS_VNODE_TRACING */
7757 +#endif /* XFS_VNODE_TRACE */
7759 - kdb_printf(" v_vfsp 0x%p v_number %Lx\n",
7760 - vp->v_vfsp, vp->v_number);
7761 + kdb_printf(" v_vfsp 0x%p v_number 0x%llx\n",
7762 + vp->v_vfsp, (unsigned long long)vp->v_number);
7766 static int kdbm_vnode(
7769 @@ -1453,9 +2039,7 @@
7774 -/* bhv_desc_t *bh; */
7775 -/* kdb_symtab_t symtab;*/
7779 return KDB_ARGCOUNT;
7780 @@ -1465,14 +2049,82 @@
7784 - vp = (vnode_t *)addr;
7785 + if ((diag = kdb_getarea(vp, addr)))
7788 + printvnode(&vp, addr);
7794 +print_vfs(vfs_t *vfs, unsigned long addr)
7796 + kdb_printf("vfsp at 0x%lx", addr);
7797 + kdb_printf(" vfs_flag 0x%x\n", vfs->vfs_flag);
7798 + kdb_printf(" vfs_super 0x%p", vfs->vfs_super);
7799 + kdb_printf(" vfs_bh 0x%p\n", &vfs->vfs_bh);
7801 + printbhv(vfs->vfs_fbhv);
7804 +static int kdbm_bhv(
7806 + const char **argv,
7807 + const char **envp,
7808 + struct pt_regs *regs)
7810 + unsigned long addr;
7817 + return KDB_ARGCOUNT;
7819 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7824 + bh = (bhv_desc_t *)addr;
7831 +static int kdbm_vfs(
7833 + const char **argv,
7834 + const char **envp,
7835 + struct pt_regs *regs)
7837 + unsigned long addr;
7844 + return KDB_ARGCOUNT;
7846 + diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7851 + if ((diag = kdb_getarea(vfs, addr)))
7855 + print_vfs(&vfs, addr);
7860 -#ifdef CONFIG_XFS_VNODE_TRACING
7862 +#ifdef XFS_VNODE_TRACE
7864 * Print a vnode trace entry.
7866 @@ -1668,7 +2320,7 @@
7870 -#endif /* CONFIG_XFS_VNODE_TRACING */
7871 +#endif /* XFS_VNODE_TRACE */
7874 static void printinode(struct inode *ip)
7875 @@ -1682,16 +2334,21 @@
7876 kdb_printf(" i_ino = %lu i_count = %u i_size %Ld\n",
7877 ip->i_ino, atomic_read(&ip->i_count),
7880 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
7882 - " i_mode = 0x%x i_nlink = %d i_rdev = %u:%u i_state = 0x%lx\n",
7883 + " i_mode = 0x%x i_nlink = %d i_rdev = 0x%x i_state = 0x%lx\n",
7884 ip->i_mode, ip->i_nlink,
7885 - MAJOR(ip->i_rdev),
7886 - MINOR(ip->i_rdev),
7889 - kdb_printf(" i_hash.nxt = 0x%p i_hash.prv = 0x%p\n",
7890 - ip->i_hash.next, ip->i_hash.prev);
7891 + kdev_t_to_nr(ip->i_rdev), ip->i_state);
7892 + kdb_printf(" i_hash.nxt = 0x%p i_hash.pprv = 0x%p\n",
7893 + ip->i_hash.next, ip->i_hash.prev);
7896 + " i_mode = 0x%x i_nlink = %d i_rdev = 0x%x i_state = 0x%lx\n",
7897 + ip->i_mode, ip->i_nlink,
7898 + ip->i_rdev, ip->i_state);
7899 + kdb_printf(" i_hash.nxt = 0x%p i_hash.pprv = 0x%p\n",
7900 + ip->i_hash.next, ip->i_hash.pprev);
7902 kdb_printf(" i_list.nxt = 0x%p i_list.prv = 0x%p\n",
7903 ip->i_list.next, ip->i_list.prev);
7904 kdb_printf(" i_dentry.nxt = 0x%p i_dentry.prv = 0x%p\n",
7905 @@ -1717,52 +2374,44 @@
7909 -/* char *symname; */
7913 -/* bhv_desc_t *bh; */
7914 -#ifdef CONFIG_XFS_VNODE_TRACING
7916 +#ifdef XFS_VNODE_TRACE
7917 ktrace_entry_t *ktep;
7923 return KDB_ARGCOUNT;
7925 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
7930 - vp = (vnode_t *)addr;
7932 - ip = LINVFS_GET_IP(vp);
7933 + if ((diag = kdb_getarea(vp, addr)))
7936 + ip = LINVFS_GET_IP((vnode_t *)addr);
7937 kdb_printf("--> Inode @ 0x%p\n", ip);
7940 - kdb_printf("--> Vnode @ 0x%p\n", vp);
7943 -#ifdef CONFIG_XFS_VNODE_TRACING
7944 + kdb_printf("--> Vnode @ 0x%lx\n", addr);
7945 + printvnode(&vp, addr);
7947 - kdb_printf("--> Vntrace @ 0x%p/0x%p\n", vp, vp->v_trace);
7949 - if (vp->v_trace == NULL)
7950 +#ifdef XFS_VNODE_TRACE
7951 + kdb_printf("--> Vntrace @ 0x%lx/0x%p\n", addr, vp.v_trace);
7952 + if (vp.v_trace == NULL)
7955 - ktep = ktrace_first(vp->v_trace, &kts);
7957 + ktep = ktrace_first(vp.v_trace, &kts);
7958 while (ktep != NULL) {
7959 if (vn_trace_pr_entry(ktep))
7962 - ktep = ktrace_next(vp->v_trace, &kts);
7963 + ktep = ktrace_next(vp.v_trace, &kts);
7965 -#endif /* CONFIG_XFS_VNODE_TRACING */
7967 +#endif /* XFS_VNODE_TRACE */
7971 @@ -1772,15 +2421,15 @@
7972 static char *pb_flag_vals[] = {
7973 /* 0 */ "READ", "WRITE", "MAPPED", "PARTIAL", "ASYNC",
7974 /* 5 */ "NONE", "DELWRI", "FREED", "SYNC", "MAPPABLE",
7975 -/* 10 */ "STALE", "FS_MANAGED", "INVALID12", "LOCK", "TRYLOCK",
7976 +/* 10 */ "STALE", "FS_MANAGED", "FS_DATAIOD", "LOCK", "TRYLOCK",
7977 /* 15 */ "DONT_BLOCK", "LOCKABLE", "PRIVATE_BH", "ALL_PAGES_MAPPED",
7979 /* 20 */ "MEM_ALLOCATED", "FORCEIO", "FLUSH", "READ_AHEAD",
7982 -static char *pbm_flag_vals[] = {
7983 +static char *iomap_flag_vals[] = {
7984 "EOF", "HOLE", "DELAY", "INVALID0x08",
7985 - "INVALID0x10", "UNWRITTEN", "INVALID0x40", "INVALID0x80",
7986 + "INVALID0x10", "UNWRITTEN", "NEW", "INVALID0x80",
7990 @@ -1795,7 +2444,7 @@
7991 for (index = 0; flags && mapping[index]; flags >>= 1, index++) {
7993 if ((offset + strlen(mapping[index]) + 1) >= 80) {
7994 - strcat(buffer, "\n ");
7995 + strcat(buffer, "\n ");
7997 } else if (offset > 12) {
7998 strcat(buffer, " ");
7999 @@ -1832,6 +2481,48 @@
8006 + unsigned long addr)
8008 + kdb_printf("page_buf_t at 0x%lx\n", addr);
8009 + kdb_printf(" pb_flags %s\n", pb_flags(pb->pb_flags));
8010 + kdb_printf(" pb_target 0x%p pb_hold %d pb_next 0x%p pb_prev 0x%p\n",
8011 + pb->pb_target, pb->pb_hold.counter,
8012 + list_entry(pb->pb_list.next, page_buf_t, pb_list),
8013 + list_entry(pb->pb_list.prev, page_buf_t, pb_list));
8014 + kdb_printf(" pb_hash_index %d pb_hash_next 0x%p pb_hash_prev 0x%p\n",
8015 + pb->pb_hash_index,
8016 + list_entry(pb->pb_hash_list.next, page_buf_t, pb_hash_list),
8017 + list_entry(pb->pb_hash_list.prev, page_buf_t, pb_hash_list));
8018 + kdb_printf(" pb_file_offset 0x%llx pb_buffer_length 0x%llx pb_addr 0x%p\n",
8019 + (unsigned long long) pb->pb_file_offset,
8020 + (unsigned long long) pb->pb_buffer_length,
8022 + kdb_printf(" pb_bn 0x%Lx pb_count_desired 0x%lx pb_locked %d\n",
8024 + (unsigned long) pb->pb_count_desired, (int)pb->pb_locked);
8025 + kdb_printf(" pb_flushtime %ld (%ld) pb_io_remaining %d pb_error %u\n",
8026 + pb->pb_flushtime, pb->pb_flushtime - jiffies,
8027 + pb->pb_io_remaining.counter, pb->pb_error);
8028 + kdb_printf(" pb_page_count %u pb_offset 0x%x pb_pages 0x%p\n",
8029 + pb->pb_page_count, pb->pb_offset,
8031 + kdb_printf(" pb_iodonesema (%d,%d) pb_sema (%d,%d) pincount (%d)\n",
8032 + pb->pb_iodonesema.count.counter,
8033 + pb->pb_iodonesema.sleepers,
8034 + pb->pb_sema.count.counter, pb->pb_sema.sleepers,
8035 + pb->pb_pin_count.counter);
8036 +#ifdef PAGEBUF_LOCK_TRACKING
8037 + kdb_printf(" last holder %d\n", pb->pb_last_holder);
8039 + if (pb->pb_fspriv || pb->pb_fspriv2) {
8040 + kdb_printf( " pb_fspriv 0x%p pb_fspriv2 0x%p\n",
8041 + pb->pb_fspriv, pb->pb_fspriv2);
8046 kdbm_pb(int argc, const char **argv, const char **envp, struct pt_regs *regs)
8048 @@ -1849,109 +2540,64 @@
8049 (diag = kdb_getarea(bp, addr)))
8052 - kdb_printf("page_buf_t at 0x%lx\n", addr);
8053 - kdb_printf(" pb_flags %s\n", pb_flags(bp.pb_flags));
8054 - kdb_printf(" pb_target 0x%p pb_hold %d pb_next 0x%p pb_prev 0x%p\n",
8055 - bp.pb_target, bp.pb_hold.counter,
8056 - bp.pb_list.next, bp.pb_list.prev);
8057 - kdb_printf(" pb_hash_index %d pb_hash_next 0x%p pb_hash_prev 0x%p\n",
8059 - bp.pb_hash_list.next,
8060 - bp.pb_hash_list.prev);
8061 - kdb_printf(" pb_file_offset 0x%llx pb_buffer_length 0x%llx pb_addr 0x%p\n",
8062 - (unsigned long long) bp.pb_file_offset,
8063 - (unsigned long long) bp.pb_buffer_length,
8065 - kdb_printf(" pb_bn 0x%Lx pb_count_desired 0x%lx\n",
8067 - (unsigned long) bp.pb_count_desired);
8068 - kdb_printf(" pb_io_remaining %d pb_error %u\n",
8069 - bp.pb_io_remaining.counter,
8071 - kdb_printf(" pb_page_count %u pb_offset 0x%x pb_pages 0x%p\n",
8072 - bp.pb_page_count, bp.pb_offset,
8074 -#ifdef PAGEBUF_LOCK_TRACKING
8075 - kdb_printf(" pb_iodonesema (%d,%d) pb_sema (%d,%d) pincount (%d) last holder %d\n",
8076 - bp.pb_iodonesema.count.counter,
8077 - bp.pb_iodonesema.sleepers,
8078 - bp.pb_sema.count.counter, bp.pb_sema.sleepers,
8079 - bp.pb_pin_count.counter, bp.pb_last_holder);
8081 - kdb_printf(" pb_iodonesema (%d,%d) pb_sema (%d,%d) pincount (%d)\n",
8082 - bp.pb_iodonesema.count.counter,
8083 - bp.pb_iodonesema.sleepers,
8084 - bp.pb_sema.count.counter, bp.pb_sema.sleepers,
8085 - bp.pb_pin_count.counter);
8087 - if (bp.pb_fspriv || bp.pb_fspriv2) {
8088 - kdb_printf( "pb_fspriv 0x%p pb_fspriv2 0x%p\n",
8089 - bp.pb_fspriv, bp.pb_fspriv2);
8091 + print_pagebuf(&bp, addr);
8096 -/* XXXXXXXXXXXXXXXXXXXXXX */
8097 -/* The start of this deliberately looks like a read_descriptor_t in layout */
8099 - read_descriptor_t io_rdesc;
8102 - page_buf_rw_t io_dir; /* read or write */
8103 - loff_t io_offset; /* Starting offset of I/O */
8104 - int io_iovec_nr; /* Number of entries in iovec */
8107 - struct iovec **io_iovec; /* iovec list indexed by iovec_index */
8108 - loff_t io_iovec_offset; /* offset into current iovec. */
8109 - int io_iovec_index; /* current iovec being processed */
8110 - unsigned int io_sshift; /* sector bit shift */
8111 - loff_t io_i_size; /* size of the file */
8115 -kdbm_pbiodesc(int argc, const char **argv, const char **envp,
8116 +kdbm_pbdelay(int argc, const char **argv, const char **envp,
8117 struct pt_regs *regs)
8119 - pb_io_desc_t pbio;
8121 + unsigned long verbose = 0;
8123 + struct list_head *curr, *next;
8129 + extern struct list_head pbd_delwrite_queue;
8133 return KDB_ARGCOUNT;
8136 - if ((diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs)) ||
8137 - (diag = kdb_getarea(pbio, addr)))
8139 - kdb_printf("pb_io_desc_t at 0x%lx\n", addr);
8140 - kdb_printf(" io_rdesc [ written 0x%lx count 0x%lx buf 0x%p error %d ]\n",
8141 - (unsigned long) pbio.io_rdesc.written,
8142 - (unsigned long) pbio.io_rdesc.count,
8143 - pbio.io_rdesc.buf, pbio.io_rdesc.error);
8145 - kdb_printf(" io_dir %d io_offset 0x%Lx io_iovec_nr 0x%d\n",
8146 - pbio.io_dir, pbio.io_offset, pbio.io_iovec_nr);
8148 + if ((diag = kdbgetularg(argv[1], &verbose))) {
8153 - kdb_printf(" io_iovec 0x%p io_iovec_offset 0x%Lx io_iovec_index 0x%d\n",
8154 - pbio.io_iovec, pbio.io_iovec_offset, pbio.io_iovec_index);
8156 + kdb_printf("index pb pin flushtime\n");
8159 - kdb_printf(" io_sshift 0x%d io_i_size 0x%Lx\n",
8160 - pbio.io_sshift, pbio.io_i_size);
8161 + list_for_each_safe(curr, next, &pbd_delwrite_queue) {
8162 + addr = (unsigned long)list_entry(curr, page_buf_t, pb_list);
8163 + if ((diag = kdb_getarea(bp, addr)))
8167 + print_pagebuf(&bp, addr);
8169 + kdb_printf("%4d 0x%lx %d %ld\n",
8171 + bp.pb_pin_count.counter,
8172 + bp.pb_flushtime - jiffies);
8176 + kdb_printf("pbd_delwrite_queue inaccessible (non-debug)\n");
8182 -kdbm_pbmap(int argc, const char **argv, const char **envp,
8183 +kdbm_iomap(int argc, const char **argv, const char **envp,
8184 struct pt_regs *regs)
8186 - page_buf_bmap_t pbm;
8187 + xfs_iomap_t iomap;
8194 @@ -1960,113 +2606,49 @@
8197 if ((diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs)) ||
8198 - (diag = kdb_getarea(pbm, addr)))
8199 + (diag = kdb_getarea(iomap, addr)))
8201 - kdb_printf("page_buf_bmap_t at 0x%lx\n", addr);
8202 - kdb_printf(" pbm_bn 0x%llx pbm_offset 0x%Lx pbm_delta 0x%lx pbm_bsize 0x%lx\n",
8203 - (long long) pbm.pbm_bn, pbm.pbm_offset,
8204 - (unsigned long) pbm.pbm_delta, (unsigned long) pbm.pbm_bsize);
8205 + kdb_printf("iomap_t at 0x%lx\n", addr);
8206 + kdb_printf(" iomap_bn 0x%llx iomap_offset 0x%Lx iomap_delta 0x%lx iomap_bsize 0x%lx\n",
8207 + (long long) iomap.iomap_bn, iomap.iomap_offset,
8208 + (unsigned long) iomap.iomap_delta, (unsigned long) iomap.iomap_bsize);
8210 - kdb_printf(" pbm_flags %s\n", map_flags(pbm.pbm_flags, pbm_flag_vals));
8211 + kdb_printf(" iomap_flags %s\n", map_flags(iomap.iomap_flags, iomap_flag_vals));
8216 #ifdef PAGEBUF_TRACE
8217 -# ifdef __PAGEBUF_TRACE__
8218 -# undef __PAGEBUF_TRACE__
8219 -# undef PB_DEFINE_TRACES
8220 -# undef PB_TRACE_START
8221 -# undef PB_TRACE_REC
8222 -# undef PB_TRACE_END
8224 -#include "pagebuf/page_buf_trace.h"
8226 -#define EV_SIZE (sizeof(event_names)/sizeof(char *))
8230 - unsigned long match,
8231 - char *event_match,
8232 - unsigned long long offset,
8235 - extern struct pagebuf_trace_buf pb_trace;
8236 - int i, total, end;
8237 - pagebuf_trace_t *trace;
8241 - end = pb_trace.start - 1;
8243 - end = PB_TRACE_BUFSIZE - 1;
8245 - if (match && (match < PB_TRACE_BUFSIZE)) {
8246 - for (i = pb_trace.start, total = 0; i != end; i = CIRC_INC(i)) {
8247 - trace = &pb_trace.buf[i];
8248 - if (trace->pb == 0)
8252 - total = total - match;
8253 - for (i = pb_trace.start; i != end && total; i = CIRC_INC(i)) {
8254 - trace = &pb_trace.buf[i];
8255 - if (trace->pb == 0)
8261 - i = pb_trace.start;
8262 - for ( ; i != end; i = CIRC_INC(i)) {
8263 - trace = &pb_trace.buf[i];
8266 - if ((trace->offset & ~mask) != offset)
8270 - if (trace->pb == 0)
8273 - if ((match != 0) && (trace->pb != match))
8276 - if ((trace->event < EV_SIZE-1) && event_names[trace->event]) {
8277 - event = event_names[trace->event];
8278 - } else if (trace->event == EV_SIZE-1) {
8279 - event = (char *)trace->misc;
8282 - sprintf(value, "%8d", trace->event);
8285 - if (event_match && strcmp(event, event_match)) {
8288 +static int pagebuf_trace_entry(ktrace_entry_t *ktep)
8290 + unsigned long long daddr;
8292 + daddr = ((unsigned long long)(unsigned long)ktep->val[8] << 32)
8293 + | ((unsigned long long)(unsigned long)ktep->val[9]);
8295 - kdb_printf("pb 0x%lx [%s] (hold %u lock %d) misc 0x%p",
8297 - trace->hold, trace->lock_value,
8299 - kdb_symbol_print((unsigned int)trace->ra, NULL,
8300 - KDB_SP_SPACEB|KDB_SP_PAREN|KDB_SP_NEWLINE);
8301 - kdb_printf(" offset 0x%Lx size 0x%x task 0x%p\n",
8302 - trace->offset, trace->size, trace->task);
8303 - kdb_printf(" flags: %s\n",
8304 - pb_flags(trace->flags));
8306 + kdb_printf("pb 0x%p [%s] (hold %lu lock %ld) data 0x%p",
8308 + (char *)ktep->val[1],
8309 + (unsigned long)ktep->val[3],
8310 + (long)ktep->val[4],
8312 + kdb_symbol_print((unsigned long)ktep->val[7], NULL,
8313 + KDB_SP_SPACEB|KDB_SP_PAREN|KDB_SP_NEWLINE);
8314 + kdb_printf(" offset 0x%llx size 0x%lx task 0x%p\n",
8315 + daddr, (long)ktep->val[10], ktep->val[5]);
8316 + kdb_printf(" flags: %s\n", pb_flags((int)(long)ktep->val[2]));
8322 kdbm_pbtrace_offset(int argc, const char **argv, const char **envp,
8323 struct pt_regs *regs)
8326 - unsigned long offset = 0;
8329 + unsigned long offset = 0;
8331 + ktrace_entry_t *ktep;
8332 + ktrace_snap_t kts;
8335 return KDB_ARGCOUNT;
8336 @@ -2078,13 +2660,23 @@
8340 - diag = kdbgetularg(argv[1], &mask);
8341 + diag = kdbgetularg(argv[1], &mask); /* sign extent mask */
8346 - pb_trace_core(0, NULL, (unsigned long long)offset,
8347 - (long long)mask); /* sign extent mask */
8348 + ktep = ktrace_first(pagebuf_trace_buf, &kts);
8349 + while (ktep != NULL) {
8350 + unsigned long long daddr;
8352 + daddr = ((unsigned long long)(unsigned long)ktep->val[8] << 32)
8353 + | ((unsigned long long)(unsigned long)ktep->val[9]);
8354 + if (offset && ((daddr & ~mask) != offset))
8356 + if (pagebuf_trace_entry(ktep))
8358 + ktep = ktrace_next(pagebuf_trace_buf, &kts);
8363 @@ -2092,10 +2684,12 @@
8364 kdbm_pbtrace(int argc, const char **argv, const char **envp,
8365 struct pt_regs *regs)
8367 - unsigned long addr = 0;
8368 - int diag, nextarg;
8370 - char *event_match = NULL;
8371 + unsigned long addr = 0;
8372 + int diag, nextarg;
8374 + char *event_match = NULL;
8375 + ktrace_entry_t *ktep;
8376 + ktrace_snap_t kts;
8379 return KDB_ARGCOUNT;
8380 @@ -2103,69 +2697,102 @@
8382 if (isupper(argv[1][0]) || islower(argv[1][0])) {
8383 event_match = (char *)argv[1];
8384 - printk("event match on \"%s\"\n", event_match);
8385 + kdb_printf("event match on \"%s\"\n", event_match);
8389 - diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs);
8390 + diag = kdbgetaddrarg(argc, argv,
8391 + &nextarg, &addr, &offset, NULL, regs);
8393 - printk("failed to parse %s as a number\n",
8395 + kdb_printf("non-numeric arg: %s\n", argv[1]);
8401 - pb_trace_core(addr, event_match, 0LL, 0LL);
8405 -#else /* PAGEBUF_TRACE */
8407 -kdbm_pbtrace(int argc, const char **argv, const char **envp,
8408 - struct pt_regs *regs)
8410 - kdb_printf("pagebuf tracing not compiled in\n");
8412 + ktep = ktrace_first(pagebuf_trace_buf, &kts);
8413 + while (ktep != NULL) {
8414 + if (addr && (ktep->val[0] != (void *)addr))
8416 + if (event_match && strcmp((char *)ktep->val[1], event_match))
8418 + if (pagebuf_trace_entry(ktep))
8420 + ktep = ktrace_next(pagebuf_trace_buf, &kts);
8424 -#endif /* PAGEBUF_TRACE */
8427 -static struct xif {
8430 int (*func)(int, const char **, const char **, struct pt_regs *);
8433 -} xfsidbg_funcs[] = {
8436 +static struct xif xfsidbg_funcs[] = {
8437 + { "bhv", kdbm_bhv, "<bhv>", "Dump bhv chain"},
8438 { "vn", kdbm_vn, "<vnode>", "Dump inode/vnode/trace"},
8439 { "vnode", kdbm_vnode, "<vnode>", "Dump vnode"},
8440 -#ifdef CONFIG_XFS_VNODE_TRACING
8441 + { "vfs", kdbm_vfs, "<vfs>", "Dump vfs"},
8442 +#ifdef XFS_VNODE_TRACE
8443 { "vntrace", kdbm_vntrace, "<vntrace>", "Dump vnode Trace"},
8444 - { "vntraceaddr", kdbm_vntraceaddr, "<vntrace>", "Dump vnode Trace by Address"},
8445 -#endif /* CONFIG_XFS_VNODE_TRACING */
8446 + { "vntraceaddr", kdbm_vntraceaddr, "<vntrace>",
8447 + "Dump vnode Trace by Address"},
8449 { "xagf", kdbm_xfs_xagf, "<agf>",
8450 "Dump XFS allocation group freespace" },
8451 { "xagi", kdbm_xfs_xagi, "<agi>",
8452 "Dump XFS allocation group inode" },
8453 { "xail", kdbm_xfs_xaildump, "<xfs_mount_t>",
8454 "Dump XFS AIL for a mountpoint" },
8455 +#ifdef XFS_ALLOC_TRACE
8456 + { "xalatrc", kdbm_xfs_xalatrace, "<count>",
8457 + "Dump XFS alloc count trace" },
8458 + { "xalbtrc", kdbm_xfs_xalbtrace, "<xfs_agblock_t>",
8459 + "Dump XFS alloc block trace" },
8460 + { "xalgtrc", kdbm_xfs_xalgtrace, "<xfs_agnumber_t>",
8461 + "Dump XFS alloc alloc-group trace" },
8464 { "xalloc", kdbm_xfs_xalloc, "<xfs_alloc_arg_t>",
8465 "Dump XFS allocation args structure" },
8467 +#ifdef XFS_ALLOC_TRACE
8468 { "xalmtrc", kdbm_xfs_xalmtrace, "<xfs_mount_t>",
8469 "Dump XFS alloc mount-point trace" },
8470 + { "xalttrc", kdbm_xfs_xalttrace, "<tag>",
8471 + "Dump XFS alloc trace by tag number" },
8473 + { "xarg", kdbm_xfs_xarg, "<value>",
8474 + "Input XFS argument for next function" },
8475 { "xattrcx", kdbm_xfs_xattrcontext, "<xfs_attr_list_context_t>",
8476 "Dump XFS attr_list context struct"},
8477 { "xattrlf", kdbm_xfs_xattrleaf, "<xfs_attr_leafblock_t>",
8478 "Dump XFS attribute leaf block"},
8479 { "xattrsf", kdbm_xfs_xattrsf, "<xfs_attr_shortform_t>",
8480 "Dump XFS attribute shortform"},
8481 +#ifdef XFS_ATTR_TRACE
8482 + { "xattrtr", kdbm_xfs_xattrtrace, "<count>",
8483 + "Dump XFS attribute attr_list() trace" },
8485 { "xbirec", kdbm_xfs_xbirec, "<xfs_bmbt_irec_t",
8486 "Dump XFS bmap incore record"},
8487 +#ifdef XFS_BLI_TRACE
8488 + { "xblitrc", kdbm_xfs_xblitrace, "<xfs_buf_log_item_t>",
8489 + "Dump XFS buf log item trace" },
8491 { "xbmalla", kdbm_xfs_xbmalla, "<xfs_bmalloca_t>",
8492 "Dump XFS bmalloc args structure"},
8493 - { "xbrec", kdbm_xfs_xbrec, "<xfs_bmbt_rec_64_t",
8494 +#ifdef XFS_BMAP_TRACE
8495 + { "xbmatrc", kdbm_xfs_xbmatrace, "<count>",
8496 + "Dump XFS bmap btree count trace" },
8497 + { "xbmitrc", kdbm_xfs_xbmitrace, "<xfs_inode_t>",
8498 + "Dump XFS bmap btree per-inode trace" },
8499 + { "xbmstrc", kdbm_xfs_xbmstrace, "<xfs_inode_t>",
8500 + "Dump XFS bmap btree inode trace" },
8502 + { "xbrec", kdbm_xfs_xbrec, "<xfs_bmbt_rec_64_t>",
8503 "Dump XFS bmap record"},
8504 { "xbroot", kdbm_xfs_xbroot, "<xfs_inode_t>",
8505 "Dump XFS bmap btree root (data)"},
8506 @@ -2175,12 +2802,29 @@
8507 "Dump XFS btree cursor"},
8508 { "xbuf", kdbm_xfs_xbuf, "<xfs_buf_t>",
8509 "Dump XFS data from a buffer"},
8510 +#ifdef XFS_BMAP_TRACE
8511 + { "xbxatrc", kdbm_xfs_xbxatrace, "<count>",
8512 + "Dump XFS bmap extent count trace" },
8513 + { "xbxitrc", kdbm_xfs_xbxitrace, "<xfs_inode_t>",
8514 + "Dump XFS bmap extent per-inode trace" },
8515 + { "xbxstrc", kdbm_xfs_xbxstrace, "<xfs_inode_t>",
8516 + "Dump XFS bmap extent inode trace" },
8518 { "xchash", kdbm_xfs_xchash, "<xfs_mount_t>",
8519 "Dump XFS cluster hash"},
8520 { "xchlist", kdbm_xfs_xchashlist, "<xfs_chashlist_t>",
8521 "Dump XFS cluster hash list"},
8522 + { "xchksum", kdbm_xfs_xchksum, "<addr>", "Dump chksum" },
8523 +#ifdef XFS_DIR2_TRACE
8524 + { "xd2atrc", kdbm_xfs_xdir2atrace, "<count>",
8525 + "Dump XFS directory v2 count trace" },
8527 { "xd2free", kdbm_xfs_xdir2free, "<xfs_dir2_free_t>",
8528 "Dump XFS directory v2 freemap"},
8529 +#ifdef XFS_DIR2_TRACE
8530 + { "xd2itrc", kdbm_xfs_xdir2itrace, "<xfs_inode_t>",
8531 + "Dump XFS directory v2 per-inode trace" },
8533 { "xdaargs", kdbm_xfs_xdaargs, "<xfs_da_args_t>",
8534 "Dump XFS dir/attr args structure"},
8535 { "xdabuf", kdbm_xfs_xdabuf, "<xfs_dabuf_t>",
8536 @@ -2197,12 +2841,20 @@
8537 "Dump XFS directory shortform"},
8538 { "xdir2sf", kdbm_xfs_xdir2sf, "<xfs_dir2_sf_t>",
8539 "Dump XFS directory v2 shortform"},
8540 +#ifdef XFS_DIR_TRACE
8541 + { "xdirtrc", kdbm_xfs_xdirtrace, "<count>",
8542 + "Dump XFS directory getdents() trace" },
8544 { "xdiskdq", kdbm_xfs_xqm_diskdq, "<xfs_disk_dquot_t>",
8545 "Dump XFS ondisk dquot (quota) struct"},
8546 { "xdqatt", kdbm_xfs_xqm_dqattached_inos, "<xfs_mount_t>",
8547 "All incore inodes with dquots"},
8548 { "xdqinfo", kdbm_xfs_xqm_tpdqinfo, "<xfs_trans_t>",
8549 "Dump dqinfo structure of a trans"},
8550 +#ifdef XFS_DQUOT_TRACE
8551 + { "xdqtrace",kdbm_xfs_xqm_dqtrace, "<xfs_dquot_t>",
8552 + "Dump trace of a given dquot" },
8554 { "xdquot", kdbm_xfs_xqm_dquot, "<xfs_dquot_t>",
8555 "Dump XFS dquot (quota) structure"},
8556 { "xexlist", kdbm_xfs_xexlist, "<xfs_inode_t>",
8557 @@ -2215,12 +2867,26 @@
8558 "Dump All XFS in-core logs"},
8559 { "xiclog", kdbm_xfs_xiclog, "<xlog_in_core_t>",
8560 "Dump XFS in-core log"},
8561 +#ifdef XFS_LOG_TRACE
8562 + { "xictrc", kdbm_xfs_xiclogtrace, "<xlog_in_core_t>",
8563 + "Dump XFS in-core log trace" },
8565 { "xihash", kdbm_xfs_xihash, "<xfs_mount_t>",
8566 "Dump XFS inode hash statistics"},
8567 +#ifdef XFS_ILOCK_TRACE
8568 + { "xilocktrc",kdbm_xfs_xilock_trace, "<xfs_inode_t>",
8569 + "Dump XFS ilock trace" },
8570 + { "xailcktrc",kdbm_xfs_xailock_trace,"<count>",
8571 + "Dump XFS global ilock trace" },
8573 { "xinodes", kdbm_xfs_xinodes, "<xfs_mount_t>",
8574 "Dump XFS inodes per mount"},
8575 { "xquiesce",kdbm_xfs_xinodes_quiesce, "<xfs_mount_t>",
8576 "Dump non-quiesced XFS inodes per mount"},
8577 +#ifdef XFS_LOG_TRACE
8578 + { "xl_grtr", kdbm_xfs_xlog_granttrace, "<xlog_t>",
8579 + "Dump XFS log grant trace" },
8581 { "xl_rcit", kdbm_xfs_xlog_ritem, "<xlog_recover_item_t>",
8582 "Dump XFS recovery item"},
8583 { "xl_rctr", kdbm_xfs_xlog_rtrans, "<xlog_recover_t>",
8584 @@ -2255,6 +2921,10 @@
8585 #endif /* CONFIG_XFS_QUOTA */
8586 { "xqmplist",kdbm_xfs_xqm_mplist, "<xfs_mount_t>",
8587 "Dump XFS all dquots of a f/s"},
8588 +#ifdef XFS_RW_TRACE
8589 + { "xrwtrc", kdbm_xfs_xrwtrace, "<xfs_inode_t>",
8590 + "Dump XFS inode read/write trace" },
8592 { "xsb", kdbm_xfs_xsb, "<xfs_sb_t> <cnv>",
8593 "Dump XFS superblock"},
8594 { "xtp", kdbm_xfs_xtp, "<xfs_trans_t>",
8595 @@ -2264,6 +2934,18 @@
8599 +static struct xif pb_funcs[] = {
8600 + { "pb", kdbm_pb, "<vaddr>", "Display page_buf_t" },
8601 + { "pbflags", kdbm_pb_flags, "<flags>", "Display page_buf flags" },
8602 + { "iomapap", kdbm_iomap, "<iomap_t *>", "Display IOmap" },
8603 + { "pbdelay", kdbm_pbdelay, "0|1", "Display delwri pagebufs" },
8604 +#ifdef PAGEBUF_TRACE
8605 + { "pbtrace", kdbm_pbtrace, "<vaddr>|<count>", "page_buf_t trace" },
8606 + { "pboffset",kdbm_pbtrace_offset, "<daddr> [<mask>]","page_buf_t trace" },
8612 __init xfsidbg_init(void)
8614 @@ -2271,20 +2953,8 @@
8616 for (p = xfsidbg_funcs; p->name; p++)
8617 kdb_register(p->name, p->func, p->args, p->help, 0);
8619 - kdb_register("pb", kdbm_pb, "<vaddr>", "Display page_buf_t", 0);
8620 - kdb_register("pbflags", kdbm_pb_flags, "<flags>",
8621 - "Display page buf flags", 0);
8622 - kdb_register("pbiodesc", kdbm_pbiodesc, "<pb_io_desc_t *>",
8623 - "Display I/O Descriptor", 0);
8624 - kdb_register("pbmap", kdbm_pbmap, "<page_buf_bmap_t *>",
8625 - "Display Bmap", 0);
8626 - kdb_register("pbtrace", kdbm_pbtrace, "<vaddr>|<count>",
8627 - "page_buf_t trace", 0);
8628 -#ifdef PAGEBUF_TRACE
8629 - kdb_register("pboffset", kdbm_pbtrace_offset, "<addr> [<mask>]",
8630 - "page_buf_t trace", 0);
8632 + for (p = pb_funcs; p->name; p++)
8633 + kdb_register(p->name, p->func, p->args, p->help, 0);
8637 @@ -2295,16 +2965,8 @@
8639 for (p = xfsidbg_funcs; p->name; p++)
8640 kdb_unregister(p->name);
8642 - kdb_unregister("pb");
8643 - kdb_unregister("pbflags");
8644 - kdb_unregister("pbmap");
8645 - kdb_unregister("pbiodesc");
8646 - kdb_unregister("pbtrace");
8647 -#ifdef PAGEBUF_TRACE
8648 - kdb_unregister("pboffset");
8651 + for (p = pb_funcs; p->name; p++)
8652 + kdb_unregister(p->name);
8656 @@ -2315,19 +2977,35 @@
8657 "start_bno", "near_bno", "this_bno"
8660 +static int xargument = 0;
8663 * Prototypes for static functions.
8666 +#ifdef XFS_ALLOC_TRACE
8667 static int xfs_alloc_trace_entry(ktrace_entry_t *ktep);
8669 +#ifdef XFS_ATTR_TRACE
8670 +static int xfs_attr_trace_entry(ktrace_entry_t *ktep);
8672 +#ifdef XFS_BMAP_TRACE
8673 +static int xfs_bmap_trace_entry(ktrace_entry_t *ktep);
8675 +#ifdef XFS_BMAP_TRACE
8676 +static int xfs_bmbt_trace_entry(ktrace_entry_t *ktep);
8678 static void xfs_broot(xfs_inode_t *ip, xfs_ifork_t *f);
8679 static void xfs_btalloc(xfs_alloc_block_t *bt, int bsz);
8680 static void xfs_btbmap(xfs_bmbt_block_t *bt, int bsz);
8681 static void xfs_btino(xfs_inobt_block_t *bt, int bsz);
8682 static void xfs_buf_item_print(xfs_buf_log_item_t *blip, int summary);
8683 static void xfs_dastate_path(xfs_da_state_path_t *p);
8684 +#ifdef XFS_DIR_TRACE
8685 +static int xfs_dir_trace_entry(ktrace_entry_t *ktep);
8687 +#ifdef XFS_DIR2_TRACE
8688 +static int xfs_dir2_trace_entry(ktrace_entry_t *ktep);
8690 static void xfs_dir2data(void *addr, int size);
8691 static void xfs_dir2leaf(xfs_dir2_leaf_t *leaf, int size);
8692 static void xfs_dquot_item_print(xfs_dq_logitem_t *lip, int summary);
8693 @@ -2345,6 +3023,10 @@
8694 static void xfs_prdinode(xfs_dinode_t *di, int coreonly, int convert);
8695 static void xfs_prdinode_core(xfs_dinode_core_t *dip, int convert);
8696 static void xfs_qoff_item_print(xfs_qoff_logitem_t *lip, int summary);
8697 +#ifdef XFS_RW_TRACE
8698 +static void xfs_rw_enter_trace_entry(ktrace_entry_t *ktep);
8699 +static int xfs_rw_trace_entry(ktrace_entry_t *ktep);
8701 static void xfs_xexlist_fork(xfs_inode_t *ip, int whichfork);
8702 static void xfs_xnode_fork(char *name, xfs_ifork_t *f);
8704 @@ -2352,7 +3034,7 @@
8709 +#ifdef XFS_ALLOC_TRACE
8711 * Print xfs alloc trace buffer entry.
8713 @@ -2378,24 +3060,24 @@
8715 switch ((long)ktep->val[0] & 0xffffL) {
8716 case XFS_ALLOC_KTRACE_ALLOC:
8717 - kdb_printf("alloc %s[%s %d] mp 0x%p\n",
8718 + kdb_printf("alloc %s[%s %ld] mp 0x%p\n",
8719 (char *)ktep->val[1],
8720 ktep->val[2] ? (char *)ktep->val[2] : "",
8721 - (__psint_t)ktep->val[0] >> 16,
8722 + (long)ktep->val[0] >> 16,
8723 (xfs_mount_t *)ktep->val[3]);
8725 - "agno %d agbno %d minlen %d maxlen %d mod %d prod %d minleft %d\n",
8726 - (__psunsigned_t)ktep->val[4],
8727 - (__psunsigned_t)ktep->val[5],
8728 - (__psunsigned_t)ktep->val[6],
8729 - (__psunsigned_t)ktep->val[7],
8730 - (__psunsigned_t)ktep->val[8],
8731 - (__psunsigned_t)ktep->val[9],
8732 - (__psunsigned_t)ktep->val[10]);
8733 - kdb_printf("total %d alignment %d len %d type %s otype %s\n",
8734 - (__psunsigned_t)ktep->val[11],
8735 - (__psunsigned_t)ktep->val[12],
8736 - (__psunsigned_t)ktep->val[13],
8737 + "agno %ld agbno %ld minlen %ld maxlen %ld mod %ld prod %ld minleft %ld\n",
8738 + (long)ktep->val[4],
8739 + (long)ktep->val[5],
8740 + (long)ktep->val[6],
8741 + (long)ktep->val[7],
8742 + (long)ktep->val[8],
8743 + (long)ktep->val[9],
8744 + (long)ktep->val[10]);
8745 + kdb_printf("total %ld alignment %ld len %ld type %s otype %s\n",
8746 + (long)ktep->val[11],
8747 + (long)ktep->val[12],
8748 + (long)ktep->val[13],
8749 xfs_alloctype[((__psint_t)ktep->val[14]) >> 16],
8750 xfs_alloctype[((__psint_t)ktep->val[14]) & 0xffff]);
8751 kdb_printf("wasdel %d wasfromfl %d isfl %d userdata %d\n",
8752 @@ -2405,76 +3087,76 @@
8753 ((__psint_t)ktep->val[15] & (1 << 0)) != 0);
8755 case XFS_ALLOC_KTRACE_FREE:
8756 - kdb_printf("free %s[%s %d] mp 0x%p\n",
8757 + kdb_printf("free %s[%s %ld] mp 0x%p\n",
8758 (char *)ktep->val[1],
8759 ktep->val[2] ? (char *)ktep->val[2] : "",
8760 - (__psint_t)ktep->val[0] >> 16,
8761 + (long)ktep->val[0] >> 16,
8762 (xfs_mount_t *)ktep->val[3]);
8763 - kdb_printf("agno %d agbno %d len %d isfl %d\n",
8764 - (__psunsigned_t)ktep->val[4],
8765 - (__psunsigned_t)ktep->val[5],
8766 - (__psunsigned_t)ktep->val[6],
8767 - (__psint_t)ktep->val[7]);
8768 + kdb_printf("agno %ld agbno %ld len %ld isfl %d\n",
8769 + (long)ktep->val[4],
8770 + (long)ktep->val[5],
8771 + (long)ktep->val[6],
8772 + (__psint_t)ktep->val[7] != 0);
8774 case XFS_ALLOC_KTRACE_MODAGF:
8775 - kdb_printf("modagf %s[%s %d] mp 0x%p\n",
8776 + kdb_printf("modagf %s[%s %ld] mp 0x%p\n",
8777 (char *)ktep->val[1],
8778 ktep->val[2] ? (char *)ktep->val[2] : "",
8779 - (__psint_t)ktep->val[0] >> 16,
8780 + (long)ktep->val[0] >> 16,
8781 (xfs_mount_t *)ktep->val[3]);
8782 printflags((__psint_t)ktep->val[4], modagf_flags, "modified");
8783 - kdb_printf("seqno %d length %d roots b %d c %d\n",
8784 - (__psunsigned_t)ktep->val[5],
8785 - (__psunsigned_t)ktep->val[6],
8786 - (__psunsigned_t)ktep->val[7],
8787 - (__psunsigned_t)ktep->val[8]);
8788 - kdb_printf("levels b %d c %d flfirst %d fllast %d flcount %d\n",
8789 - (__psunsigned_t)ktep->val[9],
8790 - (__psunsigned_t)ktep->val[10],
8791 - (__psunsigned_t)ktep->val[11],
8792 - (__psunsigned_t)ktep->val[12],
8793 - (__psunsigned_t)ktep->val[13]);
8794 - kdb_printf("freeblks %d longest %d\n",
8795 - (__psunsigned_t)ktep->val[14],
8796 - (__psunsigned_t)ktep->val[15]);
8797 + kdb_printf("seqno %lu length %lu roots b %lu c %lu\n",
8798 + (unsigned long)ktep->val[5],
8799 + (unsigned long)ktep->val[6],
8800 + (unsigned long)ktep->val[7],
8801 + (unsigned long)ktep->val[8]);
8802 + kdb_printf("levels b %lu c %lu flfirst %lu fllast %lu flcount %lu\n",
8803 + (unsigned long)ktep->val[9],
8804 + (unsigned long)ktep->val[10],
8805 + (unsigned long)ktep->val[11],
8806 + (unsigned long)ktep->val[12],
8807 + (unsigned long)ktep->val[13]);
8808 + kdb_printf("freeblks %lu longest %lu\n",
8809 + (unsigned long)ktep->val[14],
8810 + (unsigned long)ktep->val[15]);
8813 case XFS_ALLOC_KTRACE_UNBUSY:
8814 - kdb_printf("unbusy %s [%s %d] mp 0x%p\n",
8815 + kdb_printf("unbusy %s [%s %ld] mp 0x%p\n",
8816 (char *)ktep->val[1],
8817 ktep->val[2] ? (char *)ktep->val[2] : "",
8818 - (__psint_t)ktep->val[0] >> 16,
8819 + (long)ktep->val[0] >> 16,
8820 (xfs_mount_t *)ktep->val[3]);
8821 - kdb_printf(" agno %d slot %d tp 0x%x\n",
8822 - (__psunsigned_t)ktep->val[4],
8823 - (__psunsigned_t)ktep->val[7],
8824 - (__psunsigned_t)ktep->val[8]);
8825 + kdb_printf(" agno %lu slot %lu tp 0x%p\n",
8826 + (unsigned long)ktep->val[4],
8827 + (unsigned long)ktep->val[7],
8828 + (xfs_trans_t *)ktep->val[8]);
8830 case XFS_ALLOC_KTRACE_BUSY:
8831 - kdb_printf("busy %s [%s %d] mp 0x%p\n",
8832 + kdb_printf("busy %s [%s %ld] mp 0x%p\n",
8833 (char *)ktep->val[1],
8834 ktep->val[2] ? (char *)ktep->val[2] : "",
8835 - (__psint_t)ktep->val[0] >> 16,
8836 + (long)ktep->val[0] >> 16,
8837 (xfs_mount_t *)ktep->val[3]);
8838 - kdb_printf(" agno %d agbno %d len %d slot %d tp 0x%x\n",
8839 - (__psunsigned_t)ktep->val[4],
8840 - (__psunsigned_t)ktep->val[5],
8841 - (__psunsigned_t)ktep->val[6],
8842 - (__psunsigned_t)ktep->val[7],
8843 - (__psunsigned_t)ktep->val[8]);
8844 + kdb_printf(" agno %lu agbno %lu len %lu slot %lu tp 0x%p\n",
8845 + (unsigned long)ktep->val[4],
8846 + (unsigned long)ktep->val[5],
8847 + (unsigned long)ktep->val[6],
8848 + (unsigned long)ktep->val[7],
8849 + (xfs_trans_t *)ktep->val[8]);
8851 case XFS_ALLOC_KTRACE_BUSYSEARCH:
8852 - kdb_printf("busy-search %s [%s %d] mp 0x%p\n",
8853 + kdb_printf("busy-search %s [%s %ld] mp 0x%p\n",
8854 (char *)ktep->val[1],
8855 ktep->val[2] ? (char *)ktep->val[2] : "",
8856 - (__psint_t)ktep->val[0] >> 16,
8857 + (long)ktep->val[0] >> 16,
8858 (xfs_mount_t *)ktep->val[3]);
8859 - kdb_printf(" agno %d agbno %d len %d slot %d tp 0x%x\n",
8860 - (__psunsigned_t)ktep->val[4],
8861 - (__psunsigned_t)ktep->val[5],
8862 - (__psunsigned_t)ktep->val[6],
8863 - (__psunsigned_t)ktep->val[7],
8864 - (__psunsigned_t)ktep->val[8]);
8865 + kdb_printf(" agno %ld agbno %ld len %ld slot %ld tp 0x%p\n",
8866 + (unsigned long)ktep->val[4],
8867 + (unsigned long)ktep->val[5],
8868 + (unsigned long)ktep->val[6],
8869 + (unsigned long)ktep->val[7],
8870 + (xfs_trans_t *)ktep->val[8]);
8873 kdb_printf("unknown alloc trace record\n");
8874 @@ -2482,7 +3164,242 @@
8879 +#endif /* XFS_ALLOC_TRACE */
8881 +#ifdef XFS_ATTR_TRACE
8883 + * Print an attribute trace buffer entry.
8886 +xfs_attr_trace_entry(ktrace_entry_t *ktep)
8888 + static char *attr_arg_flags[] = {
8889 + "DONTFOLLOW", /* 0x0001 */
8890 + "ROOT", /* 0x0002 */
8891 + "TRUSTED", /* 0x0004 */
8893 + "CREATE", /* 0x0010 */
8894 + "REPLACE", /* 0x0020 */
8897 + "SYSTEM", /* 0x0100 */
8901 + "KERNOTIME", /* 0x1000 */
8902 + "KERNOVAL", /* 0x2000 */
8903 + "KERNAMELS", /* 0x4000 */
8904 + "KERNFULLS", /* 0x8000 */
8908 + if (!ktep->val[0])
8911 + qprintf("-- %s: cursor h/b/o 0x%lx/0x%lx/%lu, dupcnt %lu, dp 0x%p\n",
8912 + (char *)ktep->val[1],
8913 + (unsigned long)ktep->val[3],
8914 + (unsigned long)ktep->val[4],
8915 + (unsigned long)ktep->val[5],
8916 + (unsigned long)ktep->val[11],
8917 + (xfs_inode_t *)ktep->val[2]);
8918 + qprintf(" alist 0x%p, size %lu, count %lu, firstu %lu, Llen %lu",
8919 + (attrlist_t *)ktep->val[6],
8920 + (unsigned long)ktep->val[7],
8921 + (unsigned long)ktep->val[8],
8922 + (unsigned long)ktep->val[9],
8923 + (unsigned long)ktep->val[10]);
8924 + printflags((__psunsigned_t)(ktep->val[12]), attr_arg_flags, ", flags");
8927 + switch ((__psint_t)ktep->val[0]) {
8928 + case XFS_ATTR_KTRACE_L_C:
8930 + case XFS_ATTR_KTRACE_L_CN:
8931 + qprintf(" node: count %lu, 1st hash 0x%lx, last hash 0x%lx\n",
8932 + (unsigned long)ktep->val[13],
8933 + (unsigned long)ktep->val[14],
8934 + (unsigned long)ktep->val[15]);
8936 + case XFS_ATTR_KTRACE_L_CB:
8937 + qprintf(" btree: hash 0x%lx, blkno 0x%lx\n",
8938 + (unsigned long)ktep->val[13],
8939 + (unsigned long)ktep->val[14]);
8941 + case XFS_ATTR_KTRACE_L_CL:
8942 + qprintf(" leaf: count %ld, 1st hash 0x%lx, last hash 0x%lx\n",
8943 + (unsigned long)ktep->val[13],
8944 + (unsigned long)ktep->val[14],
8945 + (unsigned long)ktep->val[15]);
8948 + qprintf(" unknown attr trace record format\n");
8953 +#endif /* XFS_ATTR_TRACE */
8955 +#ifdef XFS_BMAP_TRACE
8957 + * Print xfs bmap extent trace buffer entry.
8960 +xfs_bmap_trace_entry(ktrace_entry_t *ktep)
8969 + static char *ops[] = { "del", "ins", "pre", "post" };
8970 + xfs_bmbt_rec_32_t r;
8973 + opcode = ((__psint_t)ktep->val[0]) & 0xffff;
8976 + whichfork = ((__psint_t)ktep->val[0]) >> 16;
8977 + ip = (xfs_inode_t *)ktep->val[3];
8978 + ino = ((xfs_ino_t)(unsigned long)ktep->val[6] << 32) |
8979 + ((xfs_ino_t)(unsigned long)ktep->val[7]);
8980 + qprintf("%s %s:%s ip %p ino %s %cf\n",
8981 + ops[opcode - 1], (char *)ktep->val[1],
8982 + (char *)ktep->val[2], ip, xfs_fmtino(ino, ip->i_mount),
8984 + r.l0 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[8];
8985 + r.l1 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[9];
8986 + r.l2 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[10];
8987 + r.l3 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[11];
8988 + xfs_convert_extent(&r, &o, &b, &c, &flag);
8989 + qprintf(" idx %ld offset %lld block %s",
8990 + (long)ktep->val[4], o,
8991 + xfs_fmtfsblock((xfs_fsblock_t)b, ip->i_mount));
8992 + qprintf(" count %lld flag %d\n", c, flag);
8993 + if ((__psint_t)ktep->val[5] != 2)
8995 + r.l0 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[12];
8996 + r.l1 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[13];
8997 + r.l2 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[14];
8998 + r.l3 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[15];
8999 + xfs_convert_extent(&r, &o, &b, &c, &flag);
9000 + qprintf(" offset %lld block %s", o,
9001 + xfs_fmtfsblock((xfs_fsblock_t)b, ip->i_mount));
9002 + qprintf(" count %lld flag %d\n", c, flag);
9007 + * Print xfs bmap btree trace buffer entry.
9010 +xfs_bmbt_trace_entry(
9011 + ktrace_entry_t *ktep)
9014 + xfs_bmbt_rec_32_t r;
9015 + xfs_bmbt_irec_t s;
9019 + type = (__psint_t)ktep->val[0] & 0xff;
9022 + whichfork = ((__psint_t)ktep->val[0] >> 8) & 0xff;
9023 + line = ((__psint_t)ktep->val[0] >> 16) & 0xffff;
9024 + qprintf("%s[%s@%d] ip 0x%p %cf cur 0x%p\n",
9025 + (char *)ktep->val[1],
9026 + (char *)ktep->val[2],
9028 + (xfs_inode_t *)ktep->val[3],
9030 + (xfs_btree_cur_t *)ktep->val[4]);
9032 + case XFS_BMBT_KTRACE_ARGBI:
9033 + qprintf(" buf 0x%p i %ld\n",
9034 + (xfs_buf_t *)ktep->val[5],
9035 + (long)ktep->val[6]);
9037 + case XFS_BMBT_KTRACE_ARGBII:
9038 + qprintf(" buf 0x%p i0 %ld i1 %ld\n",
9039 + (xfs_buf_t *)ktep->val[5],
9040 + (long)ktep->val[6],
9041 + (long)ktep->val[7]);
9043 + case XFS_BMBT_KTRACE_ARGFFFI:
9044 + qprintf(" o 0x%x%08x b 0x%x%08x i 0x%x%08x j %ld\n",
9045 + (unsigned int)(long)ktep->val[5],
9046 + (unsigned int)(long)ktep->val[6],
9047 + (unsigned int)(long)ktep->val[7],
9048 + (unsigned int)(long)ktep->val[8],
9049 + (unsigned int)(long)ktep->val[9],
9050 + (unsigned int)(long)ktep->val[10],
9051 + (long)ktep->val[11]);
9053 + case XFS_BMBT_KTRACE_ARGI:
9054 + qprintf(" i 0x%lx\n",
9055 + (long)ktep->val[5]);
9057 + case XFS_BMBT_KTRACE_ARGIFK:
9058 + qprintf(" i 0x%lx f 0x%x%08x o 0x%x%08x\n",
9059 + (long)ktep->val[5],
9060 + (unsigned int)(long)ktep->val[6],
9061 + (unsigned int)(long)ktep->val[7],
9062 + (unsigned int)(long)ktep->val[8],
9063 + (unsigned int)(long)ktep->val[9]);
9065 + case XFS_BMBT_KTRACE_ARGIFR:
9066 + qprintf(" i 0x%lx f 0x%x%08x ",
9067 + (long)ktep->val[5],
9068 + (unsigned int)(long)ktep->val[6],
9069 + (unsigned int)(long)ktep->val[7]);
9070 + s.br_startoff = (xfs_fileoff_t)
9071 + (((xfs_dfiloff_t)(unsigned long)ktep->val[8] << 32) |
9072 + (xfs_dfiloff_t)(unsigned long)ktep->val[9]);
9073 + s.br_startblock = (xfs_fsblock_t)
9074 + (((xfs_dfsbno_t)(unsigned long)ktep->val[10] << 32) |
9075 + (xfs_dfsbno_t)(unsigned long)ktep->val[11]);
9076 + s.br_blockcount = (xfs_filblks_t)
9077 + (((xfs_dfilblks_t)(unsigned long)ktep->val[12] << 32) |
9078 + (xfs_dfilblks_t)(unsigned long)ktep->val[13]);
9079 + xfsidbg_xbirec(&s);
9081 + case XFS_BMBT_KTRACE_ARGIK:
9082 + qprintf(" i 0x%lx o 0x%x%08x\n",
9083 + (long)ktep->val[5],
9084 + (unsigned int)(long)ktep->val[6],
9085 + (unsigned int)(long)ktep->val[7]);
9087 + case XFS_BMBT_KTRACE_CUR:
9088 + qprintf(" nlevels %ld flags %ld allocated %ld ",
9089 + ((long)ktep->val[5] >> 24) & 0xff,
9090 + ((long)ktep->val[5] >> 16) & 0xff,
9091 + (long)ktep->val[5] & 0xffff);
9092 + r.l0 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[6];
9093 + r.l1 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[7];
9094 + r.l2 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[8];
9095 + r.l3 = (xfs_bmbt_rec_base_t)(unsigned long)ktep->val[9];
9096 + xfsidbg_xbrec((xfs_bmbt_rec_64_t *)&r);
9097 + qprintf(" bufs 0x%p 0x%p 0x%p 0x%p ",
9098 + (xfs_buf_t *)ktep->val[10],
9099 + (xfs_buf_t *)ktep->val[11],
9100 + (xfs_buf_t *)ktep->val[12],
9101 + (xfs_buf_t *)ktep->val[13]);
9102 + qprintf("ptrs %ld %ld %ld %ld\n",
9103 + (long)ktep->val[14] >> 16,
9104 + (long)ktep->val[14] & 0xffff,
9105 + (long)ktep->val[15] >> 16,
9106 + (long)ktep->val[15] & 0xffff);
9109 + qprintf("unknown bmbt trace record\n");
9117 * Print an xfs in-inode bmap btree root.
9118 @@ -2603,8 +3520,11 @@
9121 kdb_printf("magic 0x%x level %d numrecs %d leftsib 0x%x rightsib 0x%x\n",
9122 - INT_GET(bt->bb_magic, ARCH_CONVERT), INT_GET(bt->bb_level, ARCH_CONVERT), INT_GET(bt->bb_numrecs, ARCH_CONVERT),
9123 - INT_GET(bt->bb_leftsib, ARCH_CONVERT), INT_GET(bt->bb_rightsib, ARCH_CONVERT));
9124 + INT_GET(bt->bb_magic, ARCH_CONVERT),
9125 + INT_GET(bt->bb_level, ARCH_CONVERT),
9126 + INT_GET(bt->bb_numrecs, ARCH_CONVERT),
9127 + INT_GET(bt->bb_leftsib, ARCH_CONVERT),
9128 + INT_GET(bt->bb_rightsib, ARCH_CONVERT));
9129 if (INT_ISZERO(bt->bb_level, ARCH_CONVERT)) {
9131 for (i = 1; i <= INT_GET(bt->bb_numrecs, ARCH_CONVERT); i++) {
9132 @@ -2612,7 +3532,8 @@
9134 r = XFS_BTREE_REC_ADDR(bsz, xfs_inobt, bt, i, 0);
9135 kdb_printf("rec %d startino 0x%x freecount %d, free %Lx\n",
9136 - i, INT_GET(r->ir_startino, ARCH_CONVERT), INT_GET(r->ir_freecount, ARCH_CONVERT),
9137 + i, INT_GET(r->ir_startino, ARCH_CONVERT),
9138 + INT_GET(r->ir_freecount, ARCH_CONVERT),
9139 INT_GET(r->ir_free, ARCH_CONVERT));
9142 @@ -2626,7 +3547,8 @@
9143 k = XFS_BTREE_KEY_ADDR(bsz, xfs_inobt, bt, i, mxr);
9144 p = XFS_BTREE_PTR_ADDR(bsz, xfs_inobt, bt, i, mxr);
9145 kdb_printf("key %d startino 0x%x ptr 0x%x\n",
9146 - i, INT_GET(k->ir_startino, ARCH_CONVERT), INT_GET(*p, ARCH_CONVERT));
9147 + i, INT_GET(k->ir_startino, ARCH_CONVERT),
9148 + INT_GET(*p, ARCH_CONVERT));
9152 @@ -2678,30 +3600,199 @@
9156 +#ifdef XFS_BMAP_TRACE
9158 + * Convert an external extent descriptor to internal form.
9161 +xfs_convert_extent(xfs_bmbt_rec_32_t *rp, xfs_dfiloff_t *op, xfs_dfsbno_t *sp,
9162 + xfs_dfilblks_t *cp, int *fp)
9169 + flag = (((xfs_dfiloff_t)rp->l0) >> 31) & 1;
9170 + o = ((((xfs_dfiloff_t)rp->l0) & 0x7fffffff) << 23) |
9171 + (((xfs_dfiloff_t)rp->l1) >> 9);
9172 + s = (((xfs_dfsbno_t)(rp->l1 & 0x000001ff)) << 43) |
9173 + (((xfs_dfsbno_t)rp->l2) << 11) |
9174 + (((xfs_dfsbno_t)rp->l3) >> 21);
9175 + c = (xfs_dfilblks_t)(rp->l3 & 0x001fffff);
9183 +#ifdef XFS_RW_TRACE
9185 + * Print itrunc entry trace.
9188 +xfs_ctrunc_trace_entry(ktrace_entry_t *ktep)
9190 + qprintf("ip 0x%p cpu %ld\n",
9191 + (xfs_inode_t *)(unsigned long)ktep->val[1], (long)ktep->val[2]);
9196 + * Print an xfs_da_state_path structure.
9199 +xfs_dastate_path(xfs_da_state_path_t *p)
9203 + kdb_printf("active %d\n", p->active);
9204 + for (i = 0; i < XFS_DA_NODE_MAXDEPTH; i++) {
9205 + kdb_printf(" blk %d bp 0x%p blkno 0x%x",
9206 + i, p->blk[i].bp, p->blk[i].blkno);
9207 + kdb_printf(" index %d hashval 0x%x ",
9208 + p->blk[i].index, (uint_t)p->blk[i].hashval);
9209 + switch(p->blk[i].magic) {
9210 + case XFS_DA_NODE_MAGIC: kdb_printf("NODE\n"); break;
9211 + case XFS_DIR_LEAF_MAGIC: kdb_printf("DIR\n"); break;
9212 + case XFS_ATTR_LEAF_MAGIC: kdb_printf("ATTR\n"); break;
9213 + case XFS_DIR2_LEAFN_MAGIC: kdb_printf("DIR2\n"); break;
9214 + default: kdb_printf("type ?\n"); break;
9219 +#ifdef XFS_DIR_TRACE
9221 + * Print a xfs directory trace buffer entry.
9224 +xfs_dir_trace_entry(ktrace_entry_t *ktep)
9230 + if (!ktep->val[0] || !ktep->val[1])
9233 + mp = (xfs_mount_t *)ktep->val[3];
9234 + cookie = (__psunsigned_t)ktep->val[4];
9236 + cookie |= (__psunsigned_t)ktep->val[5];
9237 + qprintf("%s -- dp=0x%p b/e/h=%ld/%ld/0x%08lx resid=0x%lx ",
9238 + (char *)ktep->val[1],
9239 + (xfs_inode_t *)ktep->val[2],
9240 + (long)XFS_DA_COOKIE_BNO(mp, cookie),
9241 + (long)XFS_DA_COOKIE_ENTRY(mp, cookie),
9242 + (unsigned long)XFS_DA_COOKIE_HASH(mp, cookie),
9243 + (long)ktep->val[6]);
9245 + switch ((__psint_t)ktep->val[0]) {
9246 + case XFS_DIR_KTRACE_G_DU:
9248 + case XFS_DIR_KTRACE_G_DUB:
9249 + qprintf("bno=%ld", (long)ktep->val[7]);
9251 + case XFS_DIR_KTRACE_G_DUN:
9252 + qprintf("forw=%ld, cnt=%ld, 0x%08lx - 0x%08lx",
9253 + (long)ktep->val[7],
9254 + (long)ktep->val[8],
9255 + (unsigned long)ktep->val[9],
9256 + (unsigned long)ktep->val[10]);
9258 + case XFS_DIR_KTRACE_G_DUL:
9259 + qprintf("forw=%ld, cnt=%ld, 0x%08lx - 0x%08lx",
9260 + (long)ktep->val[7],
9261 + (long)ktep->val[8],
9262 + (unsigned long)ktep->val[9],
9263 + (unsigned long)ktep->val[10]);
9265 + case XFS_DIR_KTRACE_G_DUE:
9266 + qprintf("entry hashval 0x%08lx", (unsigned long)ktep->val[7]);
9268 + case XFS_DIR_KTRACE_G_DUC:
9269 + cookie = (__psunsigned_t)ktep->val[7];
9271 + cookie |= (__psunsigned_t)ktep->val[8];
9272 + hash = XFS_DA_COOKIE_HASH(mp, cookie);
9273 + qprintf("b/e/h=%ld/%ld/0x%08x",
9274 + (long)XFS_DA_COOKIE_BNO(mp, cookie),
9275 + (long)XFS_DA_COOKIE_ENTRY(mp, cookie),
9279 + qprintf("unknown dir trace record format");
9286 +#ifdef XFS_DIR2_TRACE
9288 - * Print an xfs_da_state_path structure.
9289 + * Print a xfs v2 directory trace buffer entry.
9292 -xfs_dastate_path(xfs_da_state_path_t *p)
9294 +xfs_dir2_trace_entry(ktrace_entry_t *ktep)
9301 - kdb_printf("active %d\n", p->active);
9302 - for (i = 0; i < XFS_DA_NODE_MAXDEPTH; i++) {
9303 - kdb_printf(" blk %d bp 0x%p blkno 0x%x",
9304 - i, p->blk[i].bp, p->blk[i].blkno);
9305 - kdb_printf(" index %d hashval 0x%x ",
9306 - p->blk[i].index, (uint_t)p->blk[i].hashval);
9307 - switch(p->blk[i].magic) {
9308 - case XFS_DA_NODE_MAGIC: kdb_printf("NODE\n"); break;
9309 - case XFS_DIR_LEAF_MAGIC: kdb_printf("DIR\n"); break;
9310 - case XFS_ATTR_LEAF_MAGIC: kdb_printf("ATTR\n"); break;
9311 - case XFS_DIR2_LEAFN_MAGIC: kdb_printf("DIR2\n"); break;
9312 - default: kdb_printf("type ??\n"); break;
9314 + if (!ktep->val[0])
9316 + cp = (char *)&ktep->val[10];
9317 + qprintf("%s: '", (char *)ktep->val[1]);
9318 + len = min((__psint_t)ktep->val[9], (__psint_t)sizeof(ktep->val[10])*6);
9319 + for (i = 0; i < len; i++)
9320 + qprintf("%c", cp[i]);
9321 + qprintf("'(%ld)", (long)ktep->val[9]);
9322 + if ((__psunsigned_t)ktep->val[0] != XFS_DIR2_KTRACE_ARGS_BIBII)
9323 + qprintf(" hashval 0x%llx inumber %lld dp 0x%p tp 0x%p check %d",
9324 + (__uint64_t)(unsigned long)ktep->val[2],
9325 + (__int64_t)(unsigned long)ktep->val[3],
9326 + ktep->val[4], ktep->val[5],
9327 + (int)(__psint_t)ktep->val[6]);
9328 + switch ((__psunsigned_t)ktep->val[0]) {
9329 + case XFS_DIR2_KTRACE_ARGS:
9331 + case XFS_DIR2_KTRACE_ARGS_B:
9332 + qprintf(" bp 0x%p", ktep->val[7]);
9334 + case XFS_DIR2_KTRACE_ARGS_BB:
9335 + qprintf(" lbp 0x%p dbp 0x%p", ktep->val[7], ktep->val[8]);
9337 + case XFS_DIR2_KTRACE_ARGS_BIBII:
9338 + qprintf(" dp 0x%p tp 0x%p srcbp 0x%p srci %d dstbp 0x%p dsti %d count %d",
9339 + ktep->val[2], ktep->val[3], ktep->val[4],
9340 + (int)(__psint_t)ktep->val[5], ktep->val[6],
9341 + (int)(__psint_t)ktep->val[7],
9342 + (int)(__psint_t)ktep->val[8]);
9344 + case XFS_DIR2_KTRACE_ARGS_DB:
9345 + qprintf(" db 0x%x bp 0x%p",
9346 + (xfs_dir2_db_t)(unsigned long)ktep->val[7],
9349 + case XFS_DIR2_KTRACE_ARGS_I:
9350 + qprintf(" i 0x%lx", (unsigned long)ktep->val[7]);
9352 + case XFS_DIR2_KTRACE_ARGS_S:
9353 + qprintf(" s 0x%x", (int)(__psint_t)ktep->val[7]);
9355 + case XFS_DIR2_KTRACE_ARGS_SB:
9356 + qprintf(" s 0x%x bp 0x%p", (int)(__psint_t)ktep->val[7],
9360 + qprintf("unknown dirv2 trace record format");
9369 * Print an efd log item.
9370 @@ -2847,19 +3938,19 @@
9371 static char rval[16];
9373 sprintf(rval, "%c%c%c%c%c%c%c%c%c%c%c%c%c",
9374 - "?fc?dxb?r?l?S?m?"[(m & IFMT) >> 12],
9375 - m & ISUID ? 'u' : '-',
9376 - m & ISGID ? 'g' : '-',
9377 - m & ISVTX ? 'v' : '-',
9378 - m & IREAD ? 'r' : '-',
9379 - m & IWRITE ? 'w' : '-',
9380 - m & IEXEC ? 'x' : '-',
9381 - m & (IREAD >> 3) ? 'r' : '-',
9382 - m & (IWRITE >> 3) ? 'w' : '-',
9383 - m & (IEXEC >> 3) ? 'x' : '-',
9384 - m & (IREAD >> 6) ? 'r' : '-',
9385 - m & (IWRITE >> 6) ? 'w' : '-',
9386 - m & (IEXEC >> 6) ? 'x' : '-');
9387 + "?fc?dxb?r?l?S?m?"[(m & S_IFMT) >> 12],
9388 + m & S_ISUID ? 'u' : '-',
9389 + m & S_ISGID ? 'g' : '-',
9390 + m & S_ISVTX ? 'v' : '-',
9391 + m & S_IRUSR ? 'r' : '-',
9392 + m & S_IWUSR ? 'w' : '-',
9393 + m & S_IXUSR ? 'x' : '-',
9394 + m & S_IRGRP ? 'r' : '-',
9395 + m & S_IWGRP ? 'w' : '-',
9396 + m & S_IXGRP ? 'x' : '-',
9397 + m & S_IROTH ? 'r' : '-',
9398 + m & S_IWOTH ? 'w' : '-',
9399 + m & S_IXOTH ? 'x' : '-');
9403 @@ -2883,9 +3974,9 @@
9404 xfs_fmtuuid(uuid_t *uu)
9406 static char rval[40];
9408 - char *i = (unsigned char*)uu;
9411 + char *i = (unsigned char*)uu;
9414 for (b=0;b<16;b++) {
9415 o+=sprintf(o, "%02x", *i++);
9416 @@ -2930,9 +4021,9 @@
9420 - kdb_printf("inode 0x%p ino 0x%llu logged %d flags: ",
9421 + kdb_printf("inode 0x%p ino 0x%llu pushbuf %d logged %d flags: ",
9422 ilip->ili_inode, (unsigned long long) ilip->ili_format.ilf_ino,
9423 - ilip->ili_logged);
9424 + ilip->ili_pushbuf_flag, ilip->ili_logged);
9425 printflags(ilip->ili_flags, ili_flags, NULL);
9427 kdb_printf("ilock recur %d iolock recur %d ext buf 0x%p\n",
9428 @@ -2942,10 +4033,9 @@
9429 kdb_printf("root bytes %d root orig 0x%x\n",
9430 ilip->ili_root_size, ilip->ili_orig_root);
9432 - kdb_printf("size %d fields: ", ilip->ili_format.ilf_size);
9433 - printflags(ilip->ili_format.ilf_fields, ilf_fields, "formatfield");
9434 - kdb_printf(" last fields: ");
9435 - printflags(ilip->ili_last_fields, ilf_fields, "lastfield");
9436 + kdb_printf("size %d ", ilip->ili_format.ilf_size);
9437 + printflags(ilip->ili_format.ilf_fields, ilf_fields, "fields:");
9438 + printflags(ilip->ili_last_fields, ilf_fields, " last fields: ");
9440 kdb_printf(" flush lsn %s last lsn %s\n",
9441 xfs_fmtlsn(&(ilip->ili_flush_lsn)),
9442 @@ -3001,6 +4091,129 @@
9446 +#ifdef XFS_RW_TRACE
9448 + * Print iomap entry trace.
9451 +xfs_iomap_enter_trace_entry(ktrace_entry_t *ktep)
9453 + qprintf("ip 0x%p size 0x%x%x offset 0x%x%x count 0x%x\n",
9455 + (unsigned int)(long)ktep->val[2],
9456 + (unsigned int)(long)ktep->val[3],
9457 + (unsigned int)(long)ktep->val[4],
9458 + (unsigned int)(long)ktep->val[5],
9459 + (unsigned int)(long)ktep->val[6]);
9460 + qprintf("next offset 0x%x%x io offset 0x%x%x\n",
9461 + (unsigned int)(long)ktep->val[7],
9462 + (unsigned int)(long)ktep->val[8],
9463 + (unsigned int)(long)ktep->val[9],
9464 + (unsigned int)(long)ktep->val[10]);
9465 + qprintf("io size 0x%x last req sz 0x%x new size 0x%x%x\n",
9466 + (unsigned int)(long)ktep->val[11],
9467 + (unsigned int)(long)ktep->val[12],
9468 + (unsigned int)(long)ktep->val[13],
9469 + (unsigned int)(long)ktep->val[14]);
9473 + * Print iomap map trace.
9476 +xfs_iomap_map_trace_entry(ktrace_entry_t *ktep)
9478 + qprintf("ip 0x%p size 0x%x%x offset 0x%x%x count 0x%x\n",
9480 + (unsigned int)(long)ktep->val[2],
9481 + (unsigned int)(long)ktep->val[3],
9482 + (unsigned int)(long)ktep->val[4],
9483 + (unsigned int)(long)ktep->val[5],
9484 + (unsigned int)(long)ktep->val[6]);
9485 + qprintf("bmap off 0x%x%x len 0x%x pboff 0x%x pbsize 0x%x bno 0x%x\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 + (unsigned int)(long)ktep->val[11],
9491 + (unsigned int)(long)ktep->val[12]);
9492 + qprintf("imap off 0x%x count 0x%x block 0x%x\n",
9493 + (unsigned int)(long)ktep->val[13],
9494 + (unsigned int)(long)ktep->val[14],
9495 + (unsigned int)(long)ktep->val[15]);
9499 + * Print itrunc entry trace.
9502 +xfs_itrunc_trace_entry(ktrace_entry_t *ktep)
9504 + qprintf("ip 0x%p size 0x%x%x flag %ld new size 0x%x%x\n",
9506 + (unsigned int)(long)ktep->val[2],
9507 + (unsigned int)(long)ktep->val[3],
9508 + (long)ktep->val[4],
9509 + (unsigned int)(long)ktep->val[5],
9510 + (unsigned int)(long)ktep->val[6]);
9511 + qprintf("toss start 0x%x%x toss finish 0x%x%x cpu id %ld\n",
9512 + (unsigned int)(long)ktep->val[7],
9513 + (unsigned int)(long)ktep->val[8],
9514 + (unsigned int)(long)ktep->val[9],
9515 + (unsigned int)(long)ktep->val[10],
9516 + (long)ktep->val[11]);
9520 + * Print bunmap entry trace.
9523 +xfs_bunmap_trace_entry(ktrace_entry_t *ktep)
9525 + static char *bunmapi_flags[] = {
9526 + "write", /* 0x01 */
9527 + "delay", /* 0x02 */
9528 + "entire", /* 0x04 */
9529 + "metadata", /* 0x08 */
9530 + "exact", /* 0x10 */
9531 + "attrfork", /* 0x20 */
9532 + "async", /* 0x40 */
9533 + "rsvblocks", /* 0x80 */
9537 + qprintf("ip 0x%p size 0x%x%x bno 0x%x%x len 0x%x cpu id %ld\n",
9539 + (unsigned int)(long)ktep->val[2],
9540 + (unsigned int)(long)ktep->val[3],
9541 + (unsigned int)(long)ktep->val[4],
9542 + (unsigned int)(long)ktep->val[5],
9543 + (unsigned int)(long)ktep->val[6],
9544 + (long)ktep->val[8]);
9545 + qprintf("ra 0x%p ", ktep->val[9]);
9546 + printflags((__psint_t)ktep->val[7], bunmapi_flags, "flags");
9551 + * Print inval_cached_pages entry trace.
9554 +xfs_inval_cached_trace_entry(ktrace_entry_t *ktep)
9556 + qprintf("ip 0x%p offset 0x%x%x len 0x%x%x first 0x%x%x last 0x%x%x\n",
9558 + (unsigned int)(long)ktep->val[2],
9559 + (unsigned int)(long)ktep->val[3],
9560 + (unsigned int)(long)ktep->val[4],
9561 + (unsigned int)(long)ktep->val[5],
9562 + (unsigned int)(long)ktep->val[6],
9563 + (unsigned int)(long)ktep->val[7],
9564 + (unsigned int)(long)ktep->val[8],
9565 + (unsigned int)(long)ktep->val[9]);
9572 @@ -3047,14 +4260,14 @@
9573 INT_GET(dip->di_gid, convert),
9574 (uint)INT_GET(dip->di_projid, convert),
9575 (uint)INT_GET(dip->di_flushiter, convert));
9576 - kdb_printf("atime 0x%x:%x mtime 0x%x:%x ctime 0x%x:%x\n",
9577 + kdb_printf("atime %u:%u mtime %ud:%u ctime %u:%u\n",
9578 INT_GET(dip->di_atime.t_sec, convert),
9579 INT_GET(dip->di_atime.t_nsec, convert),
9580 INT_GET(dip->di_mtime.t_sec, convert),
9581 INT_GET(dip->di_mtime.t_nsec, convert),
9582 INT_GET(dip->di_ctime.t_sec, convert),
9583 INT_GET(dip->di_ctime.t_nsec, convert));
9584 - kdb_printf("size 0x%Lx ", INT_GET(dip->di_size, convert));
9585 + kdb_printf("size %Ld ", INT_GET(dip->di_size, convert));
9586 kdb_printf("nblocks %Ld extsize 0x%x nextents 0x%x anextents 0x%x\n",
9587 INT_GET(dip->di_nblocks, convert),
9588 INT_GET(dip->di_extsize, convert),
9589 @@ -3071,6 +4284,129 @@
9590 kdb_printf("gen 0x%x\n", INT_GET(dip->di_gen, convert));
9593 +#ifdef XFS_RW_TRACE
9595 + * Print read/write entry trace.
9598 +xfs_rw_enter_trace_entry(ktrace_entry_t *ktep)
9600 + qprintf("ip 0x%p size 0x%x%x uio offset 0x%x%x uio count 0x%x\n",
9602 + (unsigned int)(long)ktep->val[2],
9603 + (unsigned int)(long)ktep->val[3],
9604 + (unsigned int)(long)ktep->val[4],
9605 + (unsigned int)(long)ktep->val[5],
9606 + (unsigned int)(long)ktep->val[6]);
9607 + qprintf("ioflags 0x%x next offset 0x%x%x io offset 0x%x%x\n",
9608 + (unsigned int)(long)ktep->val[7],
9609 + (unsigned int)(long)ktep->val[8],
9610 + (unsigned int)(long)ktep->val[9],
9611 + (unsigned int)(long)ktep->val[10],
9612 + (unsigned int)(long)ktep->val[11]);
9613 + qprintf("io size 0x%x last req sz 0x%x new size 0x%x%x\n",
9614 + (unsigned int)(long)ktep->val[12],
9615 + (unsigned int)(long)ktep->val[13],
9616 + (unsigned int)(long)ktep->val[14],
9617 + (unsigned int)(long)ktep->val[15]);
9621 + * Print read/write trace entry.
9624 +xfs_rw_trace_entry(ktrace_entry_t *ktep)
9626 + switch ( (long)ktep->val[0] ) {
9627 + case XFS_READ_ENTER:
9628 + qprintf("READ ENTER:\n");
9629 + xfs_rw_enter_trace_entry(ktep);
9631 + case XFS_WRITE_ENTER:
9632 + qprintf("WRITE ENTER:\n");
9633 + xfs_rw_enter_trace_entry(ktep);
9635 + case XFS_IOMAP_READ_ENTER:
9636 + qprintf("IOMAP READ ENTER:\n");
9637 + xfs_iomap_enter_trace_entry(ktep);
9639 + case XFS_IOMAP_WRITE_ENTER:
9640 + qprintf("IOMAP WRITE ENTER:\n");
9641 + xfs_iomap_enter_trace_entry(ktep);
9643 + case XFS_IOMAP_WRITE_NOSPACE:
9644 + qprintf("IOMAP WRITE NOSPACE:\n");
9645 + xfs_iomap_enter_trace_entry(ktep);
9647 + case XFS_IOMAP_READ_MAP:
9648 + qprintf("IOMAP READ MAP:\n");
9649 + xfs_iomap_map_trace_entry(ktep);
9651 + case XFS_IOMAP_WRITE_MAP:
9652 + qprintf("IOMAP WRITE MAP:\n");
9653 + xfs_iomap_map_trace_entry(ktep);
9655 + case XFS_ITRUNC_START:
9656 + qprintf("ITRUNC START:\n");
9657 + xfs_itrunc_trace_entry(ktep);
9659 + case XFS_ITRUNC_FINISH1:
9660 + qprintf("ITRUNC FINISH1:\n");
9661 + xfs_itrunc_trace_entry(ktep);
9663 + case XFS_ITRUNC_FINISH2:
9664 + qprintf("ITRUNC FINISH2:\n");
9665 + xfs_itrunc_trace_entry(ktep);
9668 + qprintf("CTRUNC1:\n");
9669 + xfs_ctrunc_trace_entry(ktep);
9672 + qprintf("CTRUNC2:\n");
9673 + xfs_ctrunc_trace_entry(ktep);
9676 + qprintf("CTRUNC3:\n");
9677 + xfs_ctrunc_trace_entry(ktep);
9680 + qprintf("CTRUNC4:\n");
9681 + xfs_ctrunc_trace_entry(ktep);
9684 + qprintf("CTRUNC5:\n");
9685 + xfs_ctrunc_trace_entry(ktep);
9688 + qprintf("CTRUNC6:\n");
9689 + xfs_ctrunc_trace_entry(ktep);
9692 + qprintf("BUNMAPI:\n");
9693 + xfs_bunmap_trace_entry(ktep);
9695 + case XFS_INVAL_CACHED:
9696 + qprintf("INVAL CACHED:\n");
9697 + xfs_inval_cached_trace_entry(ktep);
9699 + case XFS_DIORD_ENTER:
9700 + qprintf("DIORD ENTER:\n");
9701 + xfs_rw_enter_trace_entry(ktep);
9703 + case XFS_DIOWR_ENTER:
9704 + qprintf("DIOWR ENTER:\n");
9705 + xfs_rw_enter_trace_entry(ktep);
9717 * Print xfs extent list for a fork.
9719 @@ -3194,6 +4530,109 @@
9723 +#ifdef XFS_ALLOC_TRACE
9725 + * Print out the last "count" entries in the allocation trace buffer.
9728 +xfsidbg_xalatrace(int count)
9730 + ktrace_entry_t *ktep;
9731 + ktrace_snap_t kts;
9735 + if (xfs_alloc_trace_buf == NULL) {
9736 + qprintf("The xfs alloc trace buffer is not initialized\n");
9739 + nentries = ktrace_nentries(xfs_alloc_trace_buf);
9740 + if (count == -1) {
9743 + if ((count <= 0) || (count > nentries)) {
9744 + qprintf("Invalid count. There are %d entries.\n", nentries);
9748 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9749 + if (count != nentries) {
9751 + * Skip the total minus the number to look at minus one
9752 + * for the entry returned by ktrace_first().
9754 + skip_entries = nentries - count - 1;
9755 + ktep = ktrace_skip(xfs_alloc_trace_buf, skip_entries, &kts);
9756 + if (ktep == NULL) {
9757 + qprintf("Skipped them all\n");
9761 + while (ktep != NULL) {
9762 + if (xfs_alloc_trace_entry(ktep))
9764 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9769 + * Print out all the entries in the alloc trace buf corresponding
9770 + * to the given block number.
9773 +xfsidbg_xalbtrace(xfs_agblock_t bno)
9775 + ktrace_entry_t *ktep;
9776 + ktrace_snap_t kts;
9778 + if (xfs_alloc_trace_buf == NULL) {
9779 + qprintf("The xfs alloc trace buffer is not initialized\n");
9783 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9784 + while (ktep != NULL) {
9785 + switch ((__psint_t)ktep->val[0]) {
9786 + case XFS_ALLOC_KTRACE_ALLOC:
9787 + case XFS_ALLOC_KTRACE_FREE:
9788 + if (bno >= (xfs_agblock_t)((__psint_t)ktep->val[5]) &&
9789 + bno < (xfs_agblock_t)((__psint_t)ktep->val[5]) +
9790 + (xfs_extlen_t)((__psint_t)ktep->val[13])) {
9791 + (void)xfs_alloc_trace_entry(ktep);
9796 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9801 + * Print out all the entries in the alloc trace buf corresponding
9802 + * to the given allocation group.
9805 +xfsidbg_xalgtrace(xfs_agnumber_t agno)
9807 + ktrace_entry_t *ktep;
9808 + ktrace_snap_t kts;
9810 + if (xfs_alloc_trace_buf == NULL) {
9811 + qprintf("The xfs alloc trace buffer is not initialized\n");
9815 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9816 + while (ktep != NULL) {
9817 + if ( (__psint_t)ktep->val[0] &&
9818 + ((xfs_agnumber_t)((__psint_t)ktep->val[4])) == agno ) {
9819 + (void)xfs_alloc_trace_entry(ktep);
9822 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9828 * Print an allocation argument structure for XFS.
9829 @@ -3215,7 +4654,7 @@
9830 args->wasfromfl, args->isfl, args->userdata);
9834 +#ifdef XFS_ALLOC_TRACE
9836 * Print out all the entries in the alloc trace buf corresponding
9837 * to the given mount point.
9838 @@ -3225,7 +4664,6 @@
9840 ktrace_entry_t *ktep;
9842 - extern ktrace_t *xfs_alloc_trace_buf;
9844 if (xfs_alloc_trace_buf == NULL) {
9845 kdb_printf("The xfs alloc trace buffer is not initialized\n");
9846 @@ -3234,14 +4672,53 @@
9848 ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9849 while (ktep != NULL) {
9850 - if ((__psint_t)ktep->val[0] && (xfs_mount_t *)ktep->val[3] == mp) {
9851 + if ((__psint_t)ktep->val[0] &&
9852 + (xfs_mount_t *)ktep->val[3] == mp) {
9853 (void)xfs_alloc_trace_entry(ktep);
9856 ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9862 + * Print out all the entries in the alloc trace buf corresponding
9863 + * to the given entry type.
9866 +xfsidbg_xalttrace(int tag)
9868 + ktrace_entry_t *ktep;
9869 + ktrace_snap_t kts;
9871 + if (xfs_alloc_trace_buf == NULL) {
9872 + qprintf("The xfs alloc trace buffer is not initialized\n");
9876 + ktep = ktrace_first(xfs_alloc_trace_buf, &kts);
9877 + while (ktep != NULL) {
9878 + if ((__psint_t)ktep->val[0] &&
9879 + ((long)ktep->val[0] & 0xffffL) == (long)tag) {
9880 + (void)xfs_alloc_trace_entry(ktep);
9883 + ktep = ktrace_next(xfs_alloc_trace_buf, &kts);
9889 + * Set xtra argument, used by xchksum.
9892 +xfsidbg_xarg(int xarg)
9895 + qprintf("xargument: %d\n", xargument);
9898 +} /* xfsidbg_xarg */
9901 * Print an attr_list() context structure.
9902 @@ -3368,41 +4845,232 @@
9907 +#ifdef XFS_ATTR_TRACE
9909 + * Print out the last "count" entries in the attribute trace buffer.
9912 +xfsidbg_xattrtrace(int count)
9914 + ktrace_entry_t *ktep;
9915 + ktrace_snap_t kts;
9919 + if (xfs_attr_trace_buf == NULL) {
9920 + qprintf("The xfs attribute trace buffer is not initialized\n");
9923 + nentries = ktrace_nentries(xfs_attr_trace_buf);
9924 + if (count == -1) {
9927 + if ((count <= 0) || (count > nentries)) {
9928 + qprintf("Invalid count. There are %d entries.\n", nentries);
9932 + ktep = ktrace_first(xfs_attr_trace_buf, &kts);
9933 + if (count != nentries) {
9935 + * Skip the total minus the number to look at minus one
9936 + * for the entry returned by ktrace_first().
9938 + skip_entries = nentries - count - 1;
9939 + ktep = ktrace_skip(xfs_attr_trace_buf, skip_entries, &kts);
9940 + if (ktep == NULL) {
9941 + qprintf("Skipped them all\n");
9945 + while (ktep != NULL) {
9946 + xfs_attr_trace_entry(ktep);
9947 + ktep = ktrace_next(xfs_attr_trace_buf, &kts);
9953 + * Print xfs bmap internal record
9956 +xfsidbg_xbirec(xfs_bmbt_irec_t *r)
9959 + "startoff %Ld startblock %Lx blockcount %Ld state %Ld\n",
9960 + (__uint64_t)r->br_startoff,
9961 + (__uint64_t)r->br_startblock,
9962 + (__uint64_t)r->br_blockcount,
9963 + (__uint64_t)r->br_state);
9966 +#ifdef XFS_BLI_TRACE
9968 + * Print out the buf log item trace for the given buf log item.
9971 +xfsidbg_xblitrace(xfs_buf_log_item_t *bip)
9973 + ktrace_entry_t *ktep;
9974 + ktrace_snap_t kts;
9976 + static char *xbli_flags[] = {
9977 + "hold", /* 0x01 */
9978 + "dirty", /* 0x02 */
9979 + "stale", /* 0x04 */
9980 + "logged", /* 0x08 */
9983 + static char *xli_flags[] = {
9984 + "in ail", /* 0x1 */
9988 + if (bip->bli_trace == NULL) {
9989 + qprintf("The bli trace buffer is not initialized\n");
9993 + ktep = ktrace_first(bip->bli_trace, &kts);
9994 + while (ktep != NULL) {
9995 + qprintf("%s bp 0x%p flags ",
9996 + (char *)ktep->val[0], ktep->val[1]);
9997 + printflags((__psint_t)(ktep->val[2]), xbli_flags, "xbli");
9999 + qprintf("recur %ld refcount %ld blkno 0x%lx bcount 0x%lx\n",
10000 + (long)ktep->val[3], (long)ktep->val[4],
10001 + (unsigned long)ktep->val[5],
10002 + (unsigned long)ktep->val[6]);
10003 + flags = (((uint64_t)(unsigned long)ktep->val[7] << 32) &
10004 + 0xFFFFFFFF00000000ULL) |
10005 + (((uint64_t)(unsigned long)ktep->val[8]) &
10006 + 0x00000000FFFFFFFFULL);
10007 + qprintf("bp flags ");
10008 + printflags(flags, pb_flag_vals, 0);
10010 + qprintf("fspriv 0x%p fspriv2 0x%p pincount %ld iodone 0x%p\n",
10011 + ktep->val[9], ktep->val[10],
10012 + (long)ktep->val[11], ktep->val[12]);
10013 + qprintf("lockval %ld lid 0x%lx log item flags ",
10014 + (long)ktep->val[13], (unsigned long)ktep->val[14]);
10015 + printflags((__psint_t)(ktep->val[15]), xli_flags, "xli");
10018 + ktep = ktrace_next(bip->bli_trace, &kts);
10024 + * Print a bmap alloc argument structure for XFS.
10027 +xfsidbg_xbmalla(xfs_bmalloca_t *a)
10029 + kdb_printf("tp 0x%p ip 0x%p eof %d prevp 0x%p\n",
10030 + a->tp, a->ip, a->eof, a->prevp);
10031 + kdb_printf("gotp 0x%p firstblock %s alen %d total %d\n",
10032 + a->gotp, xfs_fmtfsblock(a->firstblock, a->ip->i_mount),
10033 + a->alen, a->total);
10034 + kdb_printf("off %s wasdel %d userdata %d minlen %d\n",
10035 + xfs_fmtfsblock(a->off, a->ip->i_mount), a->wasdel,
10036 + a->userdata, a->minlen);
10037 + kdb_printf("minleft %d low %d rval %s aeof %d\n",
10038 + a->minleft, a->low, xfs_fmtfsblock(a->rval, a->ip->i_mount),
10042 +#ifdef XFS_BMAP_TRACE
10044 + * Print out the last "count" entries in the bmap btree trace buffer.
10045 + * The "a" is for "all" inodes.
10048 +xfsidbg_xbmatrace(int count)
10050 + ktrace_entry_t *ktep;
10051 + ktrace_snap_t kts;
10053 + int skip_entries;
10055 + if (xfs_bmbt_trace_buf == NULL) {
10056 + qprintf("The xfs bmap btree trace buffer is not initialized\n"); return;
10058 + nentries = ktrace_nentries(xfs_bmbt_trace_buf);
10059 + if (count == -1) {
10060 + count = nentries;
10062 + if ((count <= 0) || (count > nentries)) {
10063 + qprintf("Invalid count. There are %d entries.\n", nentries);
10067 + ktep = ktrace_first(xfs_bmbt_trace_buf, &kts);
10068 + if (count != nentries) {
10070 + * Skip the total minus the number to look at minus one
10071 + * for the entry returned by ktrace_first().
10073 + skip_entries = nentries - count - 1;
10074 + ktep = ktrace_skip(xfs_bmbt_trace_buf, skip_entries, &kts);
10075 + if (ktep == NULL) {
10076 + qprintf("Skipped them all\n");
10080 + while (ktep != NULL) {
10081 + if (xfs_bmbt_trace_entry(ktep))
10083 + ktep = ktrace_next(xfs_bmbt_trace_buf, &kts);
10088 - * Print xfs bmap internal record
10089 + * Print out the bmap btree trace buffer attached to the given inode.
10092 -xfsidbg_xbirec(xfs_bmbt_irec_t *r)
10093 +xfsidbg_xbmitrace(xfs_inode_t *ip)
10096 - "startoff %Ld startblock %Lx blockcount %Ld state %Ld\n",
10097 - (__uint64_t)r->br_startoff,
10098 - (__uint64_t)r->br_startblock,
10099 - (__uint64_t)r->br_blockcount,
10100 - (__uint64_t)r->br_state);
10102 + ktrace_entry_t *ktep;
10103 + ktrace_snap_t kts;
10105 + if (ip->i_btrace == NULL) {
10106 + qprintf("The inode trace buffer is not initialized\n");
10110 + ktep = ktrace_first(ip->i_btrace, &kts);
10111 + while (ktep != NULL) {
10112 + if (xfs_bmbt_trace_entry(ktep))
10114 + ktep = ktrace_next(ip->i_btrace, &kts);
10119 - * Print a bmap alloc argument structure for XFS.
10120 + * Print out all the entries in the bmap btree trace buf corresponding
10121 + * to the given inode. The "s" is for "single" inode.
10124 -xfsidbg_xbmalla(xfs_bmalloca_t *a)
10125 +xfsidbg_xbmstrace(xfs_inode_t *ip)
10127 - kdb_printf("tp 0x%p ip 0x%p eof %d prevp 0x%p\n",
10128 - a->tp, a->ip, a->eof, a->prevp);
10129 - kdb_printf("gotp 0x%p firstblock %s alen %d total %d\n",
10130 - a->gotp, xfs_fmtfsblock(a->firstblock, a->ip->i_mount),
10131 - a->alen, a->total);
10132 - kdb_printf("off %s wasdel %d userdata %d minlen %d\n",
10133 - xfs_fmtfsblock(a->off, a->ip->i_mount), a->wasdel,
10134 - a->userdata, a->minlen);
10135 - kdb_printf("minleft %d low %d rval %s aeof %d\n",
10136 - a->minleft, a->low, xfs_fmtfsblock(a->rval, a->ip->i_mount),
10139 + ktrace_entry_t *ktep;
10140 + ktrace_snap_t kts;
10142 + if (xfs_bmbt_trace_buf == NULL) {
10143 + qprintf("The xfs bmap btree trace buffer is not initialized\n"); return;
10146 + ktep = ktrace_first(xfs_bmbt_trace_buf, &kts);
10147 + while (ktep != NULL) {
10148 + if ((xfs_inode_t *)(ktep->val[2]) == ip) {
10149 + if (xfs_bmbt_trace_entry(ktep))
10152 + ktep = ktrace_next(xfs_bmbt_trace_buf, &kts);
10158 * Print xfs bmap record
10159 @@ -3667,6 +5335,286 @@
10163 +#ifdef XFS_BMAP_TRACE
10165 + * Print out the last "count" entries in the bmap extent trace buffer.
10166 + * The "a" is for "all" inodes.
10169 +xfsidbg_xbxatrace(int count)
10171 + ktrace_entry_t *ktep;
10172 + ktrace_snap_t kts;
10174 + int skip_entries;
10176 + if (xfs_bmap_trace_buf == NULL) {
10177 + qprintf("The xfs bmap extent trace buffer is not initialized\n");
10180 + nentries = ktrace_nentries(xfs_bmap_trace_buf);
10181 + if (count == -1) {
10182 + count = nentries;
10184 + if ((count <= 0) || (count > nentries)) {
10185 + qprintf("Invalid count. There are %d entries.\n", nentries);
10189 + ktep = ktrace_first(xfs_bmap_trace_buf, &kts);
10190 + if (count != nentries) {
10192 + * Skip the total minus the number to look at minus one
10193 + * for the entry returned by ktrace_first().
10195 + skip_entries = nentries - count - 1;
10196 + ktep = ktrace_skip(xfs_bmap_trace_buf, skip_entries, &kts);
10197 + if (ktep == NULL) {
10198 + qprintf("Skipped them all\n");
10202 + while (ktep != NULL) {
10203 + if (xfs_bmap_trace_entry(ktep))
10205 + ktep = ktrace_next(xfs_bmap_trace_buf, &kts);
10210 + * Print out the bmap extent trace buffer attached to the given inode.
10213 +xfsidbg_xbxitrace(xfs_inode_t *ip)
10215 + ktrace_entry_t *ktep;
10216 + ktrace_snap_t kts;
10217 + if (ip->i_xtrace == NULL) {
10218 + qprintf("The inode trace buffer is not initialized\n");
10222 + ktep = ktrace_first(ip->i_xtrace, &kts);
10223 + while (ktep != NULL) {
10224 + if (xfs_bmap_trace_entry(ktep))
10226 + ktep = ktrace_next(ip->i_xtrace, &kts);
10231 + * Print out all the entries in the bmap extent trace buf corresponding
10232 + * to the given inode. The "s" is for "single" inode.
10235 +xfsidbg_xbxstrace(xfs_inode_t *ip)
10237 + ktrace_entry_t *ktep;
10238 + ktrace_snap_t kts;
10240 + if (xfs_bmap_trace_buf == NULL) {
10241 + qprintf("The xfs bmap extent trace buffer is not initialized\n");
10245 + ktep = ktrace_first(xfs_bmap_trace_buf, &kts);
10246 + while (ktep != NULL) {
10247 + if ((xfs_inode_t *)(ktep->val[3]) == ip) {
10248 + if (xfs_bmap_trace_entry(ktep))
10251 + ktep = ktrace_next(xfs_bmap_trace_buf, &kts);
10256 +#ifdef XFS_ILOCK_TRACE
10258 + * Print out the ilock trace buffer attached to the given inode.
10261 +xfsidbg_xilock_trace_entry(ktrace_entry_t *ktep)
10263 + static char *xiflags[] = {
10272 + if ((__psint_t)ktep->val[0] &&
10273 + (__psint_t)ktep->val[7] == 0) {
10274 + printflags((__psint_t)ktep->val[2], xiflags,"Flags ");
10275 + if ((__psint_t)ktep->val[1] == 1)
10276 + qprintf("LOCK\n");
10277 + else if ((__psint_t)ktep->val[1] == 2)
10278 + qprintf("LOCK SHARED\n");
10279 + else if ((__psint_t)ktep->val[1] == 3)
10280 + qprintf("UNLOCK\n");
10281 + qprintf("ip 0x%p %llx %ld\n",
10283 + (unsigned long long)((xfs_inode_t*)ktep->val[0])->i_ino,
10284 + (long)ktep->val[6]);
10285 + qprintf("raddr 0x%p\n", ktep->val[3]);
10286 + qprintf(" Pid %ld, cpu %ld\n",
10287 + (long)ktep->val[5],
10288 + (long)ktep->val[4]);
10289 + qprintf("-----------------------\n");
10291 + } else if ((__psint_t)ktep->val[7] == 1) {
10292 + if ((__psint_t)ktep->val[1] == 1)
10293 + qprintf("FlushLOCK ");
10294 + else if ((__psint_t)ktep->val[1] == 2)
10295 + qprintf("FlushTRYLOCK %ld ",
10296 + (long)ktep->val[2]);
10297 + else if ((__psint_t)ktep->val[1] == 3)
10298 + qprintf("FlushUNLOCK ");
10299 + else if ((__psint_t)ktep->val[1] == 4)
10300 + qprintf("FlushInode 0x%p",
10302 + else if ((__psint_t)ktep->val[1] == 5)
10303 + qprintf("FlushInodeInt ");
10304 + else qprintf("FlushUNKNOWN ");
10305 + qprintf("ip 0x%p ino %llx @ %ld\n",
10307 + (unsigned long long)((xfs_inode_t*)ktep->val[0])->i_ino,
10308 + (long)ktep->val[6]);
10309 + qprintf("raddr 0x%p\n", ktep->val[3]);
10310 + qprintf(" Pid %ld, cpu %ld\n",
10311 + (long)ktep->val[5],
10312 + (long)ktep->val[4]);
10313 + qprintf("-----------------------\n");
10318 +xfsidbg_xilock_trace(xfs_inode_t *ip)
10320 + static char *xiflags[] = {
10329 + ktrace_entry_t *ktep;
10330 + ktrace_snap_t kts;
10331 + if (ip->i_lock_trace == NULL) {
10332 + qprintf("The inode ilock trace buffer is not initialized\n");
10336 + ktep = ktrace_first(ip->i_lock_trace, &kts);
10337 + while (ktep != NULL) {
10338 + if ((__psint_t)ktep->val[0] &&
10339 + (__psint_t)ktep->val[7] == 0) {
10340 + printflags((__psint_t)ktep->val[2], xiflags,"Flags ");
10341 + if ((__psint_t)ktep->val[1] == 1)
10342 + qprintf("LOCK\n");
10343 + else if ((__psint_t)ktep->val[1] == 2)
10344 + qprintf("LOCK SHARED\n");
10345 + else if ((__psint_t)ktep->val[1] == 3)
10346 + qprintf("UNLOCK\n");
10347 + qprintf("ip 0x%p %lld %ld\n",
10348 + ktep->val[0], (unsigned long long)
10349 + ((xfs_inode_t*)ktep->val[0])->i_ino,
10350 + (long)ktep->val[6]);
10351 + qprintf("raddr 0x%p\n", ktep->val[3]);
10352 + qprintf(" Pid %ld, cpu %ld\n",
10353 + (long)ktep->val[5],
10354 + (long)ktep->val[4]);
10355 + qprintf("-----------------------\n");
10356 + } else if ((__psint_t)ktep->val[7] == 1) {
10357 + if ((__psint_t)ktep->val[1] == 1)
10358 + qprintf("LOCK ");
10359 + else if ((__psint_t)ktep->val[1] == 2)
10360 + qprintf("TRYLOCK %ld ",
10361 + (long)ktep->val[2]);
10362 + else if ((__psint_t)ktep->val[1] == 3)
10363 + qprintf("UNLOCK ");
10364 + else qprintf("UNKNOWN ");
10365 + qprintf("ip 0x%p %lld %ld\n",
10366 + ktep->val[0], (unsigned long long)
10367 + ((xfs_inode_t*)ktep->val[0])->i_ino,
10368 + (long)ktep->val[6]);
10369 + qprintf("raddr 0x%p\n", ktep->val[3]);
10370 + qprintf(" Pid %ld, cpu %ld\n",
10371 + (long)ktep->val[5],
10372 + (long)ktep->val[4]);
10373 + qprintf("-----------------------\n");
10376 + ktep = ktrace_next(ip->i_lock_trace, &kts);
10381 + * Print out the last "count" entries in the inode lock trace buffer.
10382 + * The "a" is for "all" entries.
10385 +xfsidbg_xailock_trace(int count)
10387 + ktrace_entry_t *ktep;
10388 + ktrace_snap_t kts;
10390 + int skip_entries;
10392 + if (xfs_ilock_trace_buf == NULL) {
10393 + qprintf("The xfs inode lock trace buffer is not initialized\n"); return;
10395 + nentries = ktrace_nentries(xfs_ilock_trace_buf);
10396 + if (count == -1) {
10397 + count = nentries;
10399 + if ((count <= 0) || (count > nentries)) {
10400 + qprintf("Invalid count. There are %d entries.\n", nentries);
10404 + ktep = ktrace_first(xfs_ilock_trace_buf, &kts);
10405 + if (count != nentries) {
10407 + * Skip the total minus the number to look at minus one
10408 + * for the entry returned by ktrace_first().
10410 + skip_entries = nentries - count - 1;
10411 + ktep = ktrace_skip(xfs_ilock_trace_buf, skip_entries, &kts);
10412 + if (ktep == NULL) {
10413 + qprintf("Skipped them all\n");
10417 + while (ktep != NULL) {
10418 + xfsidbg_xilock_trace_entry(ktep);
10419 + ktep = ktrace_next(xfs_ilock_trace_buf, &kts);
10425 + * Compute & print buffer's checksum.
10428 +xfsidbg_xchksum(uint *addr)
10430 + uint i, chksum = 0;
10432 + if (((__psint_t)addr) == ((__psint_t)-1)) {
10433 + qprintf("USAGE xchksum <address>\n");
10434 + qprintf(" length is set with xarg\n");
10436 + for (i=0; i<xargument; i++) {
10440 + qprintf("chksum (0x%x) length (%d)\n", chksum, xargument);
10442 +} /* xfsidbg_xchksum */
10445 * Print an xfs_da_args structure.
10446 @@ -3740,9 +5688,8 @@
10447 kdb_printf(" %d:0x%p", i, dabuf->bps[i]);
10449 #ifdef XFS_DABUF_DEBUG
10450 - kdb_printf(" ra 0x%x prev 0x%x next 0x%x dev %s blkno 0x%x\n",
10451 - dabuf->ra, dabuf->prev, dabuf->next,
10452 - XFS_BUFTARG_NAME(dabuf->dev), dabuf->blkno);
10453 + kdb_printf(" ra 0x%x prev 0x%x next 0x%x dev 0x%x blkno 0x%x\n",
10454 + dabuf->ra, dabuf->prev, dabuf->next, dabuf->dev, dabuf->blkno);
10458 @@ -4012,6 +5959,119 @@
10462 +#ifdef XFS_DIR_TRACE
10464 + * Print out the last "count" entries in the directory trace buffer.
10467 +xfsidbg_xdirtrace(int count)
10469 + ktrace_entry_t *ktep;
10470 + ktrace_snap_t kts;
10472 + int skip_entries;
10474 + if (xfs_dir_trace_buf == NULL) {
10475 + qprintf("The xfs directory trace buffer is not initialized\n");
10478 + nentries = ktrace_nentries(xfs_dir_trace_buf);
10479 + if (count == -1) {
10480 + count = nentries;
10482 + if ((count <= 0) || (count > nentries)) {
10483 + qprintf("Invalid count. There are %d entries.\n", nentries);
10487 + ktep = ktrace_first(xfs_dir_trace_buf, &kts);
10488 + if (count != nentries) {
10490 + * Skip the total minus the number to look at minus one
10491 + * for the entry returned by ktrace_first().
10493 + skip_entries = nentries - count - 1;
10494 + ktep = ktrace_skip(xfs_dir_trace_buf, skip_entries, &kts);
10495 + if (ktep == NULL) {
10496 + qprintf("Skipped them all\n");
10500 + while (ktep != NULL) {
10501 + if (xfs_dir_trace_entry(ktep))
10503 + ktep = ktrace_next(xfs_dir_trace_buf, &kts);
10508 +#ifdef XFS_DIR2_TRACE
10510 + * Print out the last "count" entries in the directory v2 trace buffer.
10513 +xfsidbg_xdir2atrace(int count)
10515 + ktrace_entry_t *ktep;
10516 + ktrace_snap_t kts;
10518 + int skip_entries;
10520 + if (xfs_dir2_trace_buf == NULL) {
10521 + qprintf("The xfs dirv2 trace buffer is not initialized\n");
10524 + nentries = ktrace_nentries(xfs_dir2_trace_buf);
10525 + if (count == -1) {
10526 + count = nentries;
10528 + if ((count <= 0) || (count > nentries)) {
10529 + qprintf("Invalid count. There are %d entries.\n", nentries);
10533 + ktep = ktrace_first(xfs_dir2_trace_buf, &kts);
10534 + if (count != nentries) {
10536 + * Skip the total minus the number to look at minus one
10537 + * for the entry returned by ktrace_first().
10539 + skip_entries = nentries - count - 1;
10540 + ktep = ktrace_skip(xfs_dir2_trace_buf, skip_entries, &kts);
10541 + if (ktep == NULL) {
10542 + qprintf("Skipped them all\n");
10546 + while (ktep != NULL) {
10547 + if (xfs_dir2_trace_entry(ktep))
10549 + ktep = ktrace_next(xfs_dir2_trace_buf, &kts);
10554 + * Print out the directory v2 trace buffer attached to the given inode.
10557 +xfsidbg_xdir2itrace(xfs_inode_t *ip)
10559 + ktrace_entry_t *ktep;
10560 + ktrace_snap_t kts;
10562 + if (ip->i_dir_trace == NULL) {
10563 + qprintf("The inode trace buffer is not initialized\n");
10567 + ktep = ktrace_first(ip->i_dir_trace, &kts);
10568 + while (ktep != NULL) {
10569 + if (xfs_dir2_trace_entry(ktep))
10571 + ktep = ktrace_next(ip->i_dir_trace, &kts);
10577 * Print xfs extent list.
10578 @@ -4095,13 +6155,18 @@
10579 kdb_printf("log: 0x%p callb: 0x%p callb_tail: 0x%p roundoff: %d\n",
10580 iclog->ic_log, iclog->ic_callback, iclog->ic_callback_tail,
10581 iclog->ic_roundoff);
10582 - kdb_printf("size: %d (OFFSET: %d) refcnt: %d bwritecnt: %d",
10583 + kdb_printf("size: %d (OFFSET: %d) trace: 0x%p refcnt: %d bwritecnt: %d",
10584 iclog->ic_size, iclog->ic_offset,
10585 +#ifdef XFS_LOG_TRACE
10590 iclog->ic_refcnt, iclog->ic_bwritecnt);
10591 if (iclog->ic_state & XLOG_STATE_ALL)
10592 - printflags(iclog->ic_state, ic_flags, "state:");
10593 + printflags(iclog->ic_state, ic_flags, " state:");
10595 - kdb_printf("state: INVALID 0x%x", iclog->ic_state);
10596 + kdb_printf(" state: INVALID 0x%x", iclog->ic_state);
10598 } /* xfsidbg_xiclog */
10600 @@ -4150,6 +6215,44 @@
10604 +#ifdef XFS_LOG_TRACE
10606 + * Print trace from incore log.
10609 +xfsidbg_xiclogtrace(xlog_in_core_t *iclog)
10611 + ktrace_entry_t *ktep;
10612 + ktrace_snap_t kts;
10613 + ktrace_t *kt = iclog->ic_trace;
10615 + qprintf("iclog->ic_trace 0x%p\n", kt);
10616 + ktep = ktrace_first(kt, &kts);
10617 + while (ktep != NULL) {
10618 + switch ((__psint_t)ktep->val[0]) {
10619 + case XLOG_TRACE_GRAB_FLUSH: {
10620 + qprintf("grabbing semaphore\n");
10623 + case XLOG_TRACE_REL_FLUSH: {
10624 + qprintf("releasing semaphore\n");
10627 + case XLOG_TRACE_SLEEP_FLUSH: {
10628 + qprintf("sleeping on semaphore\n");
10631 + case XLOG_TRACE_WAKE_FLUSH: {
10632 + qprintf("waking up on semaphore\n");
10638 + ktep = ktrace_next(kt, &kts);
10640 +} /* xfsidbg_xiclogtrace */
10644 * Print all of the inodes attached to the given mount structure.
10645 @@ -4270,8 +6373,8 @@
10646 xfsidbg_get_cstate(log->l_covered_state));
10647 kdb_printf("flags: ");
10648 printflags(log->l_flags, t_flags,"log");
10649 - kdb_printf(" dev: %s logBBstart: %lld logsize: %d logBBsize: %d\n",
10650 - XFS_BUFTARG_NAME(log->l_targ), (long long) log->l_logBBstart,
10651 + kdb_printf(" logBBstart: %lld logsize: %d logBBsize: %d\n",
10652 + (long long) log->l_logBBstart,
10653 log->l_logsize,log->l_logBBsize);
10654 kdb_printf("curr_cycle: %d prev_cycle: %d curr_block: %d prev_block: %d\n",
10655 log->l_curr_cycle, log->l_prev_cycle, log->l_curr_block,
10656 @@ -4290,11 +6393,50 @@
10657 log->l_grant_write_cycle, log->l_grant_write_bytes);
10658 rbytes = log->l_grant_reserve_bytes + log->l_roundoff;
10659 wbytes = log->l_grant_write_bytes + log->l_roundoff;
10660 - kdb_printf("GResBlocks: %d GResRemain: %d GWrBlocks: %d GWrRemain: %d\n",
10661 + qprintf("GResBlocks: %d GResRemain: %d GWrBlocks: %d GWrRemain: %d\n",
10662 rbytes / BBSIZE, rbytes % BBSIZE,
10663 wbytes / BBSIZE, wbytes % BBSIZE);
10664 +#ifdef XFS_LOG_TRACE
10665 + qprintf("trace: 0x%p grant_trace: use xlog value\n", log->l_trace);
10667 } /* xfsidbg_xlog */
10669 +#ifdef XFS_LOG_TRACE
10671 + * Print grant trace for a log.
10674 +xfsidbg_xlog_granttrace(xlog_t *log)
10676 + ktrace_entry_t *ktep;
10677 + ktrace_snap_t kts;
10680 + if (((__psint_t)log) == ((__psint_t)-1)) {
10681 + qprintf("Usage: xl_grtr <log>\n");
10684 + if ((kt = log->l_grant_trace))
10685 + qprintf("log->l_grant_trace 0x%p\n", kt);
10687 + qprintf("log->l_grant_trace is empty!\n");
10690 + ktep = ktrace_first(kt, &kts);
10691 + while (ktep != NULL) {
10692 + qprintf("%s\n", (char *)ktep->val[11]);
10693 + qprintf(" tic:0x%p resQ:0x%p wrQ:0x%p ",
10694 + ktep->val[0], ktep->val[1], ktep->val[2]);
10695 + qprintf(" GrResC:%ld GrResB:%ld GrWrC:%ld GrWrB:%ld \n",
10696 + (long)ktep->val[3], (long)ktep->val[4],
10697 + (long)ktep->val[5], (long)ktep->val[6]);
10698 + qprintf(" HeadC:%ld HeadB:%ld TailC:%ld TailB:%ld\n",
10699 + (long)ktep->val[7], (long)ktep->val[8],
10700 + (long)ktep->val[9], (long)ktep->val[10]);
10701 + ktep = ktrace_next(kt, &kts);
10703 +} /* xfsidbg_xlog_granttrace */
10707 * Print out an XFS recovery transaction
10708 @@ -4488,10 +6630,10 @@
10710 printflags((uint)(lip->li_flags), li_flags,"log");
10712 - kdb_printf("ail forw 0x%p ail back 0x%p lsn %s desc %p ops 0x%p\n",
10713 + kdb_printf("ail forw 0x%p ail back 0x%p lsn %s\ndesc %p ops 0x%p",
10714 lip->li_ail.ail_forw, lip->li_ail.ail_back,
10715 xfs_fmtlsn(&(lip->li_lsn)), lip->li_desc, lip->li_ops);
10716 - kdb_printf("iodonefunc &0x%p\n", lip->li_cb);
10717 + kdb_printf(" iodonefunc &0x%p\n", lip->li_cb);
10718 if (lip->li_type == XFS_LI_BUF) {
10719 bio_lip = lip->li_bio_list;
10720 if (bio_lip != NULL) {
10721 @@ -4547,7 +6689,7 @@
10725 - "dquot", /* 10 */
10726 + "dquot", /* 10 */
10729 static char *li_flags[] = {
10730 @@ -4609,7 +6751,7 @@
10731 static char *xmount_flags[] = {
10732 "WSYNC", /* 0x0001 */
10733 "INO64", /* 0x0002 */
10734 - "RQCHK", /* 0x0004 */
10735 + "RQCHK", /* 0x0004 */
10736 "FSCLEAN", /* 0x0008 */
10737 "FSSHUTDN", /* 0x0010 */
10738 "NOATIME", /* 0x0020 */
10739 @@ -4646,14 +6788,11 @@
10740 XFS_MTOVFS(mp), mp->m_tid, &mp->m_ail_lock, &mp->m_ail);
10741 kdb_printf("ail_gen 0x%x &sb 0x%p\n",
10742 mp->m_ail_gen, &mp->m_sb);
10743 - kdb_printf("sb_lock 0x%p sb_bp 0x%p dev %s logdev %s rtdev %s\n",
10744 + kdb_printf("sb_lock 0x%p sb_bp 0x%p dev 0x%x logdev 0x%x rtdev 0x%x\n",
10745 &mp->m_sb_lock, mp->m_sb_bp,
10746 - mp->m_ddev_targp ?
10747 - XFS_BUFTARG_NAME(mp->m_ddev_targp) : "none",
10748 - mp->m_logdev_targp ?
10749 - XFS_BUFTARG_NAME(mp->m_logdev_targp) : "none",
10750 - mp->m_rtdev_targp ?
10751 - XFS_BUFTARG_NAME(mp->m_rtdev_targp) : "none");
10752 + mp->m_ddev_targp ? mp->m_ddev_targp->pbr_dev : 0,
10753 + mp->m_logdev_targp ? mp->m_logdev_targp->pbr_dev : 0,
10754 + mp->m_rtdev_targp ? mp->m_rtdev_targp->pbr_dev : 0);
10755 kdb_printf("bsize %d agfrotor %d agirotor %d ihash 0x%p ihsize %d\n",
10756 mp->m_bsize, mp->m_agfrotor, mp->m_agirotor,
10757 mp->m_ihash, mp->m_ihsize);
10758 @@ -4825,8 +6964,8 @@
10761 XFS_ITOV_NULL(ip));
10762 - kdb_printf("dev %s ino %s\n",
10763 - XFS_BUFTARG_NAME(ip->i_mount->m_ddev_targp),
10764 + kdb_printf("dev %x ino %s\n",
10765 + ip->i_mount->m_dev,
10766 xfs_fmtino(ip->i_ino, ip->i_mount));
10767 kdb_printf("blkno 0x%llx len 0x%x boffset 0x%x\n",
10768 (long long) ip->i_blkno,
10769 @@ -4835,7 +6974,7 @@
10770 kdb_printf("transp 0x%p &itemp 0x%p\n",
10773 - kdb_printf("&lock 0x%p &iolock 0x%p",
10774 + kdb_printf("&lock 0x%p &iolock 0x%p ",
10777 kdb_printf("&flock 0x%p (%d) pincount 0x%x\n",
10778 @@ -4843,14 +6982,29 @@
10779 xfs_ipincount(ip));
10780 kdb_printf("udquotp 0x%p gdquotp 0x%p\n",
10781 ip->i_udquot, ip->i_gdquot);
10782 - kdb_printf("new_size %Lx\n", ip->i_iocore.io_new_size);
10783 + kdb_printf("new_size %Ld\n", ip->i_iocore.io_new_size);
10784 printflags((int)ip->i_flags, tab_flags, "flags");
10786 - kdb_printf("update_core 0x%x update size 0x%x\n",
10787 + kdb_printf("update_core %d update size %d\n",
10788 (int)(ip->i_update_core), (int) ip->i_update_size);
10789 kdb_printf("gen 0x%x delayed blks %d",
10791 ip->i_delayed_blks);
10792 +#ifdef XFS_BMAP_TRACE
10793 + qprintf(" bmap_trace 0x%p\n", ip->i_xtrace);
10795 +#ifdef XFS_BMBT_TRACE
10796 + qprintf(" bmbt trace 0x%p\n", ip->i_btrace);
10798 +#ifdef XFS_RW_TRACE
10799 + qprintf(" rw trace 0x%p\n", ip->i_rwtrace);
10801 +#ifdef XFS_ILOCK_TRACE
10802 + qprintf(" ilock trace 0x%p\n", ip->i_lock_trace);
10804 +#ifdef XFS_DIR2_TRACE
10805 + qprintf(" dir trace 0x%p\n", ip->i_dir_trace);
10808 kdb_printf("chash 0x%p cnext 0x%p cprev 0x%p\n",
10810 @@ -5032,6 +7186,9 @@
10812 (valusema(&dqp->q_flock) <= 0) ? "LCK" : "UNLKD",
10814 +#ifdef XFS_DQUOT_TRACE
10815 + qprintf("dqtrace 0x%p\n", dqp->q_trace);
10817 kdb_printf("disk-dquot 0x%p\n", &dqp->q_core);
10818 xfsidbg_xqm_diskdq(&dqp->q_core);
10820 @@ -5076,7 +7233,7 @@
10821 kdb_printf("\nNumber of inodes with dquots attached: %d\n", n);
10824 -#ifdef CONFIG_XFS_QUOTA
10825 +#ifdef CONFIG_XFS_QUOTA
10827 xfsidbg_xqm_freelist_print(xfs_frlist_t *qlist, char *title)
10829 @@ -5130,6 +7287,80 @@
10833 +#ifdef XFS_DQUOT_TRACE
10835 +xfsidbg_xqm_pr_dqentry(ktrace_entry_t *ktep)
10837 + static char *xdq_flags[] = {
10840 + "LCKD", /* 0x4 */
10842 + "FLOCKD", /* 0x08 */
10843 + "DIRTY", /* 0x10 */
10844 + "WANT", /* 0x20 */
10845 + "INACT", /* 0x40 */
10846 + "MARKER", /* 0x80 */
10850 + if ((__psint_t)ktep->val[0] == 0)
10852 + switch ((__psint_t)ktep->val[0]) {
10853 + case DQUOT_KTRACE_ENTRY:
10854 + qprintf("[%ld] %s\t",
10855 + (long)ktep->val[12], /* pid */
10856 + (char *)ktep->val[1]);
10857 + printflags((__psint_t)ktep->val[3], xdq_flags,"flgs ");
10858 + qprintf("\nnrefs = %u, "
10861 + "res_bc = 0x%x\n"
10862 + "bcnt = 0x%x [0x%x | 0x%x], "
10863 + "icnt = 0x%x [0x%x | 0x%x]\n"
10865 + (unsigned int)(long)ktep->val[2], /* nrefs */
10866 + (unsigned int)(long)ktep->val[3], /* flags */
10867 + (unsigned int)(long)ktep->val[11], /* ID */
10868 + (unsigned int)(long)ktep->val[4], /* res_bc */
10869 + (unsigned int)(long)ktep->val[5], /* bcnt */
10870 + (unsigned int)(long)ktep->val[8], /* bsoft */
10871 + (unsigned int)(long)ktep->val[7], /* bhard */
10872 + (unsigned int)(long)ktep->val[6], /* icnt */
10873 + (unsigned int)(long)ktep->val[10], /* isoft */
10874 + (unsigned int)(long)ktep->val[9], /* ihard */
10875 + (long) ktep->val[13] /* time */
10880 + qprintf("unknown dqtrace record\n");
10887 +xfsidbg_xqm_dqtrace(xfs_dquot_t *dqp)
10889 + ktrace_entry_t *ktep;
10890 + ktrace_snap_t kts;
10892 + if (dqp->q_trace == NULL) {
10893 + qprintf("The xfs dquot trace buffer is not initialized\n");
10896 + qprintf("xdqtrace dquot 0x%p\n", dqp);
10898 + ktep = ktrace_first(dqp->q_trace, &kts);
10899 + while (ktep != NULL) {
10900 + if (xfsidbg_xqm_pr_dqentry(ktep))
10901 + qprintf("---------------------------------\n");
10902 + ktep = ktrace_next(dqp->q_trace, &kts);
10908 xfsidbg_xqm_mplist(xfs_mount_t *mp)
10910 @@ -5206,7 +7437,54 @@
10914 +#ifdef XFS_RW_TRACE
10916 + * Print out the read/write trace buffer attached to the given inode.
10919 +xfsidbg_xrwtrace(xfs_inode_t *ip)
10921 + ktrace_entry_t *ktep;
10922 + ktrace_snap_t kts;
10924 + int skip_entries;
10925 + int count = xargument;
10927 + if (ip->i_rwtrace == NULL) {
10928 + qprintf("The inode trace buffer is not initialized\n");
10931 + qprintf("i_rwtrace = 0x%p\n", ip->i_rwtrace);
10933 + nentries = ktrace_nentries(ip->i_rwtrace);
10934 + if (count == -1) {
10935 + count = nentries;
10937 + if ((count <= 0) || (count > nentries)) {
10938 + qprintf("Invalid count. There are %d entries.\n", nentries);
10942 + ktep = ktrace_first(ip->i_rwtrace, &kts);
10943 + if (count != nentries) {
10945 + * Skip the total minus the number to look at minus one
10946 + * for the entry returned by ktrace_first().
10948 + skip_entries = count - nentries - 1;
10949 + ktep = ktrace_skip(ip->i_rwtrace, skip_entries, &kts);
10950 + if (ktep == NULL) {
10951 + qprintf("Skipped them all\n");
10955 + while (ktep != NULL) {
10956 + if (xfs_rw_trace_entry(ktep))
10958 + ktep = ktrace_next(ip->i_rwtrace, &kts);
10964 * Print xfs superblock.
10965 @@ -5284,7 +7562,7 @@
10967 "sb_dirty", /* 0x2 */
10968 "perm_log_res", /* 0x4 */
10969 - "sync", /* 0x08 */
10970 + "sync", /* 0x08 */
10971 "dq_dirty", /* 0x10 */
10974 @@ -5298,7 +7576,7 @@
10976 kdb_printf("tp 0x%p type ", tp);
10977 switch (tp->t_type) {
10978 - case XFS_TRANS_SETATTR_NOT_SIZE: kdb_printf("SETATTR_NOT_SIZE"); break;
10979 + case XFS_TRANS_SETATTR_NOT_SIZE: kdb_printf("SETATTR_NOT_SIZE");break;
10980 case XFS_TRANS_SETATTR_SIZE: kdb_printf("SETATTR_SIZE"); break;
10981 case XFS_TRANS_INACTIVE: kdb_printf("INACTIVE"); break;
10982 case XFS_TRANS_CREATE: kdb_printf("CREATE"); break;
10983 @@ -5310,32 +7588,31 @@
10984 case XFS_TRANS_MKDIR: kdb_printf("MKDIR"); break;
10985 case XFS_TRANS_RMDIR: kdb_printf("RMDIR"); break;
10986 case XFS_TRANS_SYMLINK: kdb_printf("SYMLINK"); break;
10987 - case XFS_TRANS_SET_DMATTRS: kdb_printf("SET_DMATTRS"); break;
10988 + case XFS_TRANS_SET_DMATTRS: kdb_printf("SET_DMATTRS"); break;
10989 case XFS_TRANS_GROWFS: kdb_printf("GROWFS"); break;
10990 - case XFS_TRANS_STRAT_WRITE: kdb_printf("STRAT_WRITE"); break;
10991 + case XFS_TRANS_STRAT_WRITE: kdb_printf("STRAT_WRITE"); break;
10992 case XFS_TRANS_DIOSTRAT: kdb_printf("DIOSTRAT"); break;
10993 - case XFS_TRANS_WRITE_SYNC: kdb_printf("WRITE_SYNC"); break;
10994 + case XFS_TRANS_WRITE_SYNC: kdb_printf("WRITE_SYNC"); break;
10995 case XFS_TRANS_WRITEID: kdb_printf("WRITEID"); break;
10996 case XFS_TRANS_ADDAFORK: kdb_printf("ADDAFORK"); break;
10997 - case XFS_TRANS_ATTRINVAL: kdb_printf("ATTRINVAL"); break;
10998 - case XFS_TRANS_ATRUNCATE: kdb_printf("ATRUNCATE"); break;
10999 + case XFS_TRANS_ATTRINVAL: kdb_printf("ATTRINVAL"); break;
11000 + case XFS_TRANS_ATRUNCATE: kdb_printf("ATRUNCATE"); break;
11001 case XFS_TRANS_ATTR_SET: kdb_printf("ATTR_SET"); break;
11002 case XFS_TRANS_ATTR_RM: kdb_printf("ATTR_RM"); break;
11003 - case XFS_TRANS_ATTR_FLAG: kdb_printf("ATTR_FLAG"); break;
11004 - case XFS_TRANS_CLEAR_AGI_BUCKET: kdb_printf("CLEAR_AGI_BUCKET"); break;
11005 + case XFS_TRANS_ATTR_FLAG: kdb_printf("ATTR_FLAG"); break;
11006 + case XFS_TRANS_CLEAR_AGI_BUCKET:kdb_printf("CLEAR_AGI_BUCKET"); break;
11007 case XFS_TRANS_QM_SBCHANGE: kdb_printf("QM_SBCHANGE"); break;
11008 case XFS_TRANS_QM_QUOTAOFF: kdb_printf("QM_QUOTAOFF"); break;
11009 - case XFS_TRANS_QM_DQALLOC: kdb_printf("QM_DQALLOC"); break;
11010 - case XFS_TRANS_QM_SETQLIM: kdb_printf("QM_SETQLIM"); break;
11011 + case XFS_TRANS_QM_DQALLOC: kdb_printf("QM_DQALLOC"); break;
11012 + case XFS_TRANS_QM_SETQLIM: kdb_printf("QM_SETQLIM"); break;
11013 case XFS_TRANS_QM_DQCLUSTER: kdb_printf("QM_DQCLUSTER"); break;
11014 case XFS_TRANS_QM_QINOCREATE: kdb_printf("QM_QINOCREATE"); break;
11015 - case XFS_TRANS_QM_QUOTAOFF_END: kdb_printf("QM_QOFF_END"); break;
11016 + case XFS_TRANS_QM_QUOTAOFF_END: kdb_printf("QM_QOFF_END"); break;
11017 case XFS_TRANS_SB_UNIT: kdb_printf("SB_UNIT"); break;
11018 case XFS_TRANS_FSYNC_TS: kdb_printf("FSYNC_TS"); break;
11019 case XFS_TRANS_GROWFSRT_ALLOC: kdb_printf("GROWFSRT_ALLOC"); break;
11020 case XFS_TRANS_GROWFSRT_ZERO: kdb_printf("GROWFSRT_ZERO"); break;
11021 case XFS_TRANS_GROWFSRT_FREE: kdb_printf("GROWFSRT_FREE"); break;
11023 default: kdb_printf("0x%x", tp->t_type); break;
11025 kdb_printf(" mount 0x%p\n", tp->t_mountp);
11026 diff -urN linux.org/fs/xfs/xfs_iget.c linux/fs/xfs/xfs_iget.c
11027 --- linux.org/fs/xfs/xfs_iget.c 2003-12-31 05:48:38.000000000 +0100
11028 +++ linux/fs/xfs/xfs_iget.c 2004-01-02 04:21:44.000000000 +0100
11029 @@ -445,18 +445,17 @@
11031 XFS_STATS_INC(xs_ig_attempts);
11033 - if ((inode = iget_locked(XFS_MTOVFS(mp)->vfs_super, ino))) {
11034 + if ((inode = VFS_GET_INODE(XFS_MTOVFS(mp), ino, 0))) {
11040 vp = LINVFS_GET_VP(inode);
11041 if (inode->i_state & I_NEW) {
11043 vn_initialize(inode);
11044 error = xfs_iget_core(vp, mp, tp, ino,
11045 - lock_flags, ipp, bno);
11046 + lock_flags, ipp, bno);
11048 make_bad_inode(inode);
11049 if (inode->i_state & I_NEW)
11050 @@ -506,9 +505,6 @@
11051 mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER,
11052 "xfsino", (long)vp->v_number);
11053 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", vp->v_number);
11055 - mutex_init(&ip->i_range_lock.r_spinlock, MUTEX_SPIN, "xrange");
11056 -#endif /* NOTYET */
11057 init_waitqueue_head(&ip->i_ipin_wait);
11058 atomic_set(&ip->i_pincount, 0);
11059 init_sema(&ip->i_flock, 1, "xfsfino", vp->v_number);
11060 @@ -830,9 +826,7 @@
11061 } else if (lock_flags & XFS_ILOCK_SHARED) {
11062 mraccess(&ip->i_lock);
11064 -#ifdef XFS_ILOCK_TRACE
11065 - xfs_ilock_trace(ip, 1, lock_flags, (inst_t *)return_address);
11067 + xfs_ilock_trace(ip, 1, lock_flags, (inst_t *)__return_address);
11071 @@ -895,9 +889,7 @@
11075 -#ifdef XFS_ILOCK_TRACE
11076 xfs_ilock_trace(ip, 2, lock_flags, (inst_t *)__return_address);
11081 @@ -955,9 +947,7 @@
11082 (xfs_log_item_t*)(ip->i_itemp));
11085 -#ifdef XFS_ILOCK_TRACE
11086 xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address);
11091 diff -urN linux.org/fs/xfs/xfs_inode.c linux/fs/xfs/xfs_inode.c
11092 --- linux.org/fs/xfs/xfs_inode.c 2003-12-31 05:48:38.000000000 +0100
11093 +++ linux/fs/xfs/xfs_inode.c 2004-01-02 04:21:44.000000000 +0100
11094 @@ -908,9 +908,6 @@
11095 #ifdef XFS_RW_TRACE
11096 ip->i_rwtrace = ktrace_alloc(XFS_RW_KTRACE_SIZE, KM_SLEEP);
11098 -#ifdef XFS_STRAT_TRACE
11099 - ip->i_strat_trace = ktrace_alloc(XFS_STRAT_KTRACE_SIZE, KM_SLEEP);
11101 #ifdef XFS_ILOCK_TRACE
11102 ip->i_lock_trace = ktrace_alloc(XFS_ILOCK_KTRACE_SIZE, KM_SLEEP);
11104 @@ -1144,8 +1141,8 @@
11105 ip->i_d.di_onlink = 0;
11106 ip->i_d.di_nlink = nlink;
11107 ASSERT(ip->i_d.di_nlink == nlink);
11108 - ip->i_d.di_uid = current->fsuid;
11109 - ip->i_d.di_gid = current->fsgid;
11110 + ip->i_d.di_uid = current_fsuid(cr);
11111 + ip->i_d.di_gid = current_fsgid(cr);
11112 ip->i_d.di_projid = prid;
11113 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
11115 @@ -1362,16 +1359,16 @@
11116 ktrace_enter(ip->i_rwtrace,
11117 (void*)((long)tag),
11119 - (void*)((ip->i_d.di_size >> 32) & 0xffffffff),
11120 - (void*)(ip->i_d.di_size & 0xffffffff),
11121 + (void*)(unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff),
11122 + (void*)(unsigned long)(ip->i_d.di_size & 0xffffffff),
11123 (void*)((long)flag),
11124 - (void*)((new_size >> 32) & 0xffffffff),
11125 - (void*)(new_size & 0xffffffff),
11126 - (void*)((toss_start >> 32) & 0xffffffff),
11127 - (void*)(toss_start & 0xffffffff),
11128 - (void*)((toss_finish >> 32) & 0xffffffff),
11129 - (void*)(toss_finish & 0xffffffff),
11130 - (void*)((long)private.p_cpuid),
11131 + (void*)(unsigned long)((new_size >> 32) & 0xffffffff),
11132 + (void*)(unsigned long)(new_size & 0xffffffff),
11133 + (void*)(unsigned long)((toss_start >> 32) & 0xffffffff),
11134 + (void*)(unsigned long)(toss_start & 0xffffffff),
11135 + (void*)(unsigned long)((toss_finish >> 32) & 0xffffffff),
11136 + (void*)(unsigned long)(toss_finish & 0xffffffff),
11137 + (void*)(unsigned long)current_cpu(),
11141 @@ -2755,17 +2752,8 @@
11144 xfs_idestroy_fork(ip, XFS_ATTR_FORK);
11146 - if (ip->i_range_lock.r_sleep != NULL) {
11147 - freesema(ip->i_range_lock.r_sleep);
11148 - kmem_free(ip->i_range_lock.r_sleep, sizeof(sema_t));
11150 -#endif /* NOTYET */
11151 mrfree(&ip->i_lock);
11152 mrfree(&ip->i_iolock);
11154 - mutex_destroy(&ip->i_range_lock.r_spinlock);
11155 -#endif /* NOTYET */
11156 freesema(&ip->i_flock);
11157 #ifdef XFS_BMAP_TRACE
11158 ktrace_free(ip->i_xtrace);
11159 @@ -2776,9 +2764,6 @@
11160 #ifdef XFS_RW_TRACE
11161 ktrace_free(ip->i_rwtrace);
11163 -#ifdef XFS_STRAT_TRACE
11164 - ktrace_free(ip->i_strat_trace);
11166 #ifdef XFS_ILOCK_TRACE
11167 ktrace_free(ip->i_lock_trace);
11169 @@ -3707,7 +3692,7 @@
11170 if ((error = _ACL_XFS_IACCESS(ip, mode, cr)) != -1)
11171 return error ? XFS_ERROR(error) : 0;
11173 - if (current->fsuid != ip->i_d.di_uid) {
11174 + if (current_fsuid(cr) != ip->i_d.di_uid) {
11176 if (!in_group_p((gid_t)ip->i_d.di_gid))
11178 @@ -3814,7 +3799,7 @@
11179 * We're not supposed to change timestamps in readonly-mounted
11180 * filesystems. Throw it away if anyone asks us.
11182 - if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
11183 + if (unlikely(vp->v_vfsp->vfs_flag & VFS_RDONLY))
11187 @@ -3828,17 +3813,17 @@
11190 if (flags & XFS_ICHGTIME_MOD) {
11191 - inode->i_mtime = tv;
11192 + VN_MTIMESET(vp, &tv);
11193 ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
11194 ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
11196 if (flags & XFS_ICHGTIME_ACC) {
11197 - inode->i_atime = tv;
11198 + VN_ATIMESET(vp, &tv);
11199 ip->i_d.di_atime.t_sec = (__int32_t)tv.tv_sec;
11200 ip->i_d.di_atime.t_nsec = (__int32_t)tv.tv_nsec;
11202 if (flags & XFS_ICHGTIME_CHG) {
11203 - inode->i_ctime = tv;
11204 + VN_CTIMESET(vp, &tv);
11205 ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec;
11206 ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec;
11208 @@ -3859,17 +3844,18 @@
11211 #ifdef XFS_ILOCK_TRACE
11212 +ktrace_t *xfs_ilock_trace_buf;
11215 xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra)
11217 ktrace_enter(ip->i_lock_trace,
11219 - (void *)(__psint_t)lock, /* 1 = LOCK, 3=UNLOCK, etc */
11220 - (void *)(__psint_t)lockflags, /* XFS_ILOCK_EXCL etc */
11221 - (void *)ra, /* caller of ilock */
11222 - (void *)(__psint_t)cpuid(),
11223 - (void *)(__psint_t)current_pid(),
11224 + (void *)(unsigned long)lock, /* 1 = LOCK, 3=UNLOCK, etc */
11225 + (void *)(unsigned long)lockflags, /* XFS_ILOCK_EXCL etc */
11226 + (void *)ra, /* caller of ilock */
11227 + (void *)(unsigned long)current_cpu(),
11228 + (void *)(unsigned long)current_pid(),
11229 0,0,0,0,0,0,0,0,0,0);
11232 -#endif /* ILOCK_TRACE */
11234 diff -urN linux.org/fs/xfs/xfs_inode.h linux/fs/xfs/xfs_inode.h
11235 --- linux.org/fs/xfs/xfs_inode.h 2003-12-31 05:48:01.000000000 +0100
11236 +++ linux/fs/xfs/xfs_inode.h 2004-01-02 04:21:44.000000000 +0100
11241 +#if defined(XFS_ILOCK_TRACE)
11242 +#define XFS_ILOCK_KTRACE_SIZE 32
11243 +extern ktrace_t *xfs_ilock_trace_buf;
11244 +extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
11246 +#define xfs_ilock_trace(i,n,f,ra)
11250 * This structure is used to communicate which extents of a file
11251 @@ -264,7 +271,10 @@
11252 sema_t i_flock; /* inode flush lock */
11253 atomic_t i_pincount; /* inode pin count */
11254 wait_queue_head_t i_ipin_wait; /* inode pinning wait queue */
11256 +#ifdef HAVE_REFCACHE
11257 + struct xfs_inode **i_refcache; /* ptr to entry in ref cache */
11258 + struct xfs_inode *i_release; /* inode to unref */
11261 xfs_iocore_t i_iocore; /* I/O core */
11263 @@ -280,15 +290,22 @@
11264 struct xfs_inode *i_cnext; /* cluster hash link forward */
11265 struct xfs_inode *i_cprev; /* cluster hash link backward */
11268 /* Trace buffers per inode. */
11269 +#ifdef XFS_BMAP_TRACE
11270 struct ktrace *i_xtrace; /* inode extent list trace */
11272 +#ifdef XFS_BMBT_TRACE
11273 struct ktrace *i_btrace; /* inode bmap btree trace */
11275 +#ifdef XFS_RW_TRACE
11276 struct ktrace *i_rwtrace; /* inode read/write trace */
11277 - struct ktrace *i_strat_trace; /* inode strat_write trace */
11279 +#ifdef XFS_ILOCK_TRACE
11280 struct ktrace *i_lock_trace; /* inode lock/unlock trace */
11282 +#ifdef XFS_DIR2_TRACE
11283 struct ktrace *i_dir_trace; /* inode directory trace */
11284 -#endif /* DEBUG */
11288 #endif /* __KERNEL__ */
11289 @@ -536,12 +553,6 @@
11290 extern struct kmem_zone *xfs_ili_zone;
11291 extern struct vnodeops xfs_vnodeops;
11293 -#ifdef XFS_ILOCK_TRACE
11294 -#define XFS_ILOCK_KTRACE_SIZE 32
11295 -void xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags,
11299 #endif /* __KERNEL__ */
11301 #endif /* __XFS_INODE_H__ */
11302 diff -urN linux.org/fs/xfs/xfs_iocore.c linux/fs/xfs/xfs_iocore.c
11303 --- linux.org/fs/xfs/xfs_iocore.c 2003-12-31 05:48:05.000000000 +0100
11304 +++ linux/fs/xfs/xfs_iocore.c 2004-01-02 04:21:44.000000000 +0100
11306 #include "xfs_rw.h"
11307 #include "xfs_quota.h"
11308 #include "xfs_trans_space.h"
11309 +#include "xfs_iomap.h"
11313 diff -urN linux.org/fs/xfs/xfs_iomap.h linux/fs/xfs/xfs_iomap.h
11314 --- linux.org/fs/xfs/xfs_iomap.h 1970-01-01 01:00:00.000000000 +0100
11315 +++ linux/fs/xfs/xfs_iomap.h 2004-01-02 04:21:44.000000000 +0100
11318 + * Copyright (c) 2003 Silicon Graphics, Inc. All Rights Reserved.
11320 + * This program is free software; you can redistribute it and/or modify it
11321 + * under the terms of version 2 of the GNU General Public License as
11322 + * published by the Free Software Foundation.
11324 + * This program is distributed in the hope that it would be useful, but
11325 + * WITHOUT ANY WARRANTY; without even the implied warranty of
11326 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11328 + * Further, this software is distributed without any warranty that it is
11329 + * free of the rightful claim of any third person regarding infringement
11330 + * or the like. Any license provided herein, whether implied or
11331 + * otherwise, applies only to this software file. Patent licenses, if
11332 + * any, provided herein do not apply to combinations of this program with
11333 + * other software, or any other product whatsoever.
11335 + * You should have received a copy of the GNU General Public License along
11336 + * with this program; if not, write the Free Software Foundation, Inc., 59
11337 + * Temple Place - Suite 330, Boston MA 02111-1307, USA.
11339 + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
11340 + * Mountain View, CA 94043, or:
11342 + * http://www.sgi.com
11344 + * For further information regarding this notice, see:
11346 + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
11351 +#ifndef __XFS_IOMAP_H__
11352 +#define __XFS_IOMAP_H__
11354 +#define IOMAP_DADDR_NULL ((xfs_daddr_t) (-1LL))
11357 +typedef enum { /* iomap_flags values */
11358 + IOMAP_EOF = 0x01, /* mapping contains EOF */
11359 + IOMAP_HOLE = 0x02, /* mapping covers a hole */
11360 + IOMAP_DELAY = 0x04, /* mapping covers delalloc region */
11361 + IOMAP_UNWRITTEN = 0x20, /* mapping covers allocated */
11362 + /* but uninitialized file data */
11363 + IOMAP_NEW = 0x40 /* just allocate */
11367 + /* base extent manipulation calls */
11368 + BMAPI_READ = (1 << 0), /* read extents */
11369 + BMAPI_WRITE = (1 << 1), /* create extents */
11370 + BMAPI_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
11371 + BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
11373 + BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
11374 + BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
11375 + BMAPI_MMAP = (1 << 6), /* allocate for mmap write */
11376 + BMAPI_SYNC = (1 << 7), /* sync write */
11377 + BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */
11378 + BMAPI_DEVICE = (1 << 9), /* we only want to know the device */
11383 + * xfs_iomap_t: File system I/O map
11385 + * The iomap_bn, iomap_offset and iomap_length fields are expressed in disk blocks.
11386 + * The iomap_length field specifies the size of the underlying backing store
11387 + * for the particular mapping.
11389 + * The iomap_bsize, iomap_size and iomap_delta fields are in bytes and indicate
11390 + * the size of the mapping, the number of bytes that are valid to access
11391 + * (read or write), and the offset into the mapping, given the offset
11392 + * supplied to the file I/O map routine. iomap_delta is the offset of the
11393 + * desired data from the beginning of the mapping.
11395 + * When a request is made to read beyond the logical end of the object,
11396 + * iomap_size may be set to 0, but iomap_offset and iomap_length should be set to
11397 + * the actual amount of underlying storage that has been allocated, if any.
11400 +typedef struct xfs_iomap {
11401 + xfs_daddr_t iomap_bn;
11402 + xfs_buftarg_t *iomap_target;
11403 + loff_t iomap_offset;
11404 + size_t iomap_delta;
11405 + size_t iomap_bsize;
11406 + iomap_flags_t iomap_flags;
11409 +struct xfs_iocore;
11411 +struct xfs_bmbt_irec;
11413 +extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int,
11414 + struct xfs_iomap *, int *);
11415 +extern int xfs_iomap_write_direct(struct xfs_inode *, loff_t, size_t,
11416 + int, struct xfs_bmbt_irec *, int *, int);
11417 +extern int xfs_iomap_write_delay(struct xfs_inode *, loff_t, size_t, int,
11418 + struct xfs_bmbt_irec *, int *);
11419 +extern int xfs_iomap_write_allocate(struct xfs_inode *,
11420 + struct xfs_bmbt_irec *, int *);
11421 +extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t);
11423 +#endif /* __XFS_IOMAP_H__*/
11424 diff -urN linux.org/fs/xfs/xfs_itable.c linux/fs/xfs/xfs_itable.c
11425 --- linux.org/fs/xfs/xfs_itable.c 2003-12-31 05:46:26.000000000 +0100
11426 +++ linux/fs/xfs/xfs_itable.c 2004-01-02 04:21:44.000000000 +0100
11428 xfs_trans_t *tp, /* transaction pointer */
11429 xfs_ino_t ino, /* inode number to get data for */
11430 void *buffer, /* buffer to place output in */
11431 + int ubsize, /* size of buffer */
11432 + void *private_data, /* my private data */
11433 xfs_daddr_t bno, /* starting bno of inode cluster */
11434 + int *ubused, /* bytes used by me */
11435 void *dibuff, /* on-disk inode buffer */
11436 int *stat) /* BULKSTAT_RV_... */
11439 *stat = BULKSTAT_RV_NOTHING;
11440 return XFS_ERROR(EINVAL);
11442 + if (ubsize < sizeof(*buf)) {
11443 + *stat = BULKSTAT_RV_NOTHING;
11444 + return XFS_ERROR(ENOMEM);
11448 /* We're not being passed a pointer to a dinode. This happens
11449 @@ -218,6 +225,8 @@
11452 *stat = BULKSTAT_RV_DIDONE;
11454 + *ubused = sizeof(*buf);
11458 @@ -231,6 +240,7 @@
11459 xfs_ino_t *lastinop, /* last inode returned */
11460 int *ubcountp, /* size of buffer/count returned */
11461 bulkstat_one_pf formatter, /* func that'd fill a single buf */
11462 + void *private_data,/* private data for formatter */
11463 size_t statstruct_size, /* sizeof struct filling */
11464 xfs_caddr_t ubuffer, /* buffer with inode stats */
11465 int flags, /* defined in xfs_itable.h */
11466 @@ -265,8 +275,10 @@
11467 int rval; /* return value error code */
11468 int tmp; /* result value from btree calls */
11469 int ubcount; /* size of user's buffer */
11470 - int ubleft; /* spaces left in user's buffer */
11471 + int ubleft; /* bytes left in user's buffer */
11472 xfs_caddr_t ubufp; /* current pointer into user's buffer */
11473 + int ubelem; /* spaces used in user's buffer */
11474 + int ubused; /* bytes used by formatter */
11475 xfs_buf_t *bp; /* ptr to on-disk inode cluster buf */
11476 xfs_dinode_t *dip; /* ptr into bp for specific inode */
11477 xfs_inode_t *ip; /* ptr to in-core inode struct */
11478 @@ -284,8 +296,9 @@
11482 - ubcount = ubleft = *ubcountp;
11484 + ubcount = *ubcountp; /* statstruct's */
11485 + ubleft = ubcount * statstruct_size; /* bytes */
11486 + *ubcountp = ubelem = 0;
11490 @@ -317,7 +330,7 @@
11491 * inode returned; 0 means start of the allocation group.
11494 - while (ubleft > 0 && agno < mp->m_sb.sb_agcount) {
11495 + while ((ubleft/statstruct_size) > 0 && agno < mp->m_sb.sb_agcount) {
11497 down_read(&mp->m_peraglock);
11498 error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
11499 @@ -402,7 +415,7 @@
11500 * Loop through inode btree records in this ag,
11501 * until we run out of inodes or space in the buffer.
11503 - while (irbp < irbufend && icount < ubcount) {
11504 + while (irbp < irbufend && icount < (ubleft/statstruct_size)) {
11506 * Loop as long as we're unable to read the
11508 @@ -453,7 +466,8 @@
11509 * Now format all the good inodes into the user's buffer.
11512 - for (irbp = irbuf; irbp < irbufend && ubleft > 0; irbp++) {
11513 + for (irbp = irbuf;
11514 + irbp < irbufend && (ubleft/statstruct_size) > 0; irbp++) {
11516 * Read-ahead the next chunk's worth of inodes.
11518 @@ -561,14 +575,19 @@
11519 * Get the inode and fill in a single buffer.
11520 * BULKSTAT_FG_QUICK uses dip to fill it in.
11521 * BULKSTAT_FG_IGET uses igets.
11522 - * See: xfs_bulkstat_one & dm_bulkstat_one.
11523 + * See: xfs_bulkstat_one & xfs_dm_bulkstat_one.
11524 * This is also used to count inodes/blks, etc
11525 * in xfs_qm_quotacheck.
11527 - error = formatter(mp, tp, ino, ubufp, bno, dip,
11529 - if (fmterror == BULKSTAT_RV_NOTHING)
11530 + ubused = statstruct_size;
11531 + error = formatter(mp, tp, ino, ubufp,
11532 + ubleft, private_data,
11533 + bno, &ubused, dip, &fmterror);
11534 + if (fmterror == BULKSTAT_RV_NOTHING) {
11535 + if (error == ENOMEM)
11539 if (fmterror == BULKSTAT_RV_GIVEUP) {
11542 @@ -576,8 +595,9 @@
11546 - ubufp += statstruct_size;
11549 + ubleft -= ubused;
11554 @@ -605,7 +625,7 @@
11556 unuseracc(ubuffer, ubcount * statstruct_size, (B_READ|B_PHYS));
11558 - *ubcountp = ubcount - ubleft;
11559 + *ubcountp = ubelem;
11560 if (agno >= mp->m_sb.sb_agcount) {
11562 * If we ran out of filesystem, mark lastino as off
11563 @@ -647,7 +667,8 @@
11566 ino = (xfs_ino_t)*lastinop;
11567 - error = xfs_bulkstat_one(mp, NULL, ino, &bstat, 0, 0, &res);
11568 + error = xfs_bulkstat_one(mp, NULL, ino, &bstat, sizeof(bstat),
11569 + NULL, 0, NULL, NULL, &res);
11572 * Special case way failed, do it the "long" way
11573 @@ -656,6 +677,7 @@
11576 if (xfs_bulkstat(mp, NULL, lastinop, &count, xfs_bulkstat_one,
11578 sizeof(bstat), buffer, BULKSTAT_FG_IGET, done))
11580 if (count == 0 || (xfs_ino_t)*lastinop != ino)
11581 diff -urN linux.org/fs/xfs/xfs_itable.h linux/fs/xfs/xfs_itable.h
11582 --- linux.org/fs/xfs/xfs_itable.h 2003-12-31 05:48:36.000000000 +0100
11583 +++ linux/fs/xfs/xfs_itable.h 2004-01-02 04:21:42.000000000 +0100
11584 @@ -36,15 +36,19 @@
11585 * xfs_bulkstat() is used to fill in xfs_bstat structures as well as dm_stat
11586 * structures (by the dmi library). This is a pointer to a formatter function
11587 * that will iget the inode and fill in the appropriate structure.
11588 - * see xfs_bulkstat_one() and dm_bulkstat_one() in dmi_xfs.c
11589 + * see xfs_bulkstat_one() and xfs_dm_bulkstat_one() in dmapi_xfs.c
11591 typedef int (*bulkstat_one_pf)(struct xfs_mount *mp,
11592 struct xfs_trans *tp,
11596 + void *private_data,
11603 * Values for stat return value.
11606 xfs_ino_t *lastino, /* last inode returned */
11607 int *count, /* size of buffer/count returned */
11608 bulkstat_one_pf formatter, /* func that'd fill a single buf */
11609 + void *private_data, /* private data for formatter */
11610 size_t statstruct_size,/* sizeof struct that we're filling */
11611 xfs_caddr_t ubuffer, /* buffer with inode stats */
11612 int flags, /* flag to control access method */
11618 + void *private_data,
11624 diff -urN linux.org/fs/xfs/xfs_log.c linux/fs/xfs/xfs_log.c
11625 --- linux.org/fs/xfs/xfs_log.c 2003-12-31 05:48:47.000000000 +0100
11626 +++ linux/fs/xfs/xfs_log.c 2004-01-02 04:21:42.000000000 +0100
11627 @@ -159,11 +159,15 @@
11630 #if defined(XFS_LOG_TRACE)
11633 xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
11635 - if (! log->l_grant_trace)
11636 - log->l_grant_trace = ktrace_alloc(1024, KM_SLEEP);
11637 + if (! log->l_grant_trace) {
11638 + log->l_grant_trace = ktrace_alloc(1024, KM_NOSLEEP);
11639 + if (! log->l_grant_trace)
11643 ktrace_enter(log->l_grant_trace,
11645 @@ -185,31 +189,6 @@
11649 -xlog_trace_tic(xlog_t *log, xlog_ticket_t *tic)
11651 - if (! log->l_trace)
11652 - log->l_trace = ktrace_alloc(256, KM_SLEEP);
11654 - ktrace_enter(log->l_trace,
11656 - (void *)((unsigned long)tic->t_curr_res),
11657 - (void *)((unsigned long)tic->t_unit_res),
11658 - (void *)((unsigned long)tic->t_ocnt),
11659 - (void *)((unsigned long)tic->t_cnt),
11660 - (void *)((unsigned long)tic->t_flags),
11661 - (void *)((unsigned long)7),
11662 - (void *)((unsigned long)8),
11663 - (void *)((unsigned long)9),
11664 - (void *)((unsigned long)10),
11665 - (void *)((unsigned long)11),
11666 - (void *)((unsigned long)12),
11667 - (void *)((unsigned long)13),
11668 - (void *)((unsigned long)14),
11669 - (void *)((unsigned long)15),
11670 - (void *)((unsigned long)16));
11674 xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
11677 @@ -1044,7 +1023,6 @@
11679 * If the filesystem blocksize is too large, we may need to choose a
11680 * larger size since the directory code currently logs entire blocks.
11681 - * XXXmiken XXXcurtis
11685 @@ -1059,7 +1037,7 @@
11686 * When logbufs == 0, someone has disabled the log from the FSTAB
11687 * file. This is not a documented feature. We need to set xlog_debug
11688 * to zero (this deactivates the log) and set xlog_target to the
11689 - * appropriate dev_t. Only one filesystem may be affected as such
11690 + * appropriate device. Only one filesystem may be affected as such
11691 * since this is just a performance hack to test what we might be able
11692 * to get if the log were not present.
11694 @@ -1078,7 +1056,7 @@
11695 if (xfs_physmem <= btoc(128*1024*1024)) {
11696 log->l_iclog_bufs = XLOG_MIN_ICLOGS;
11697 } else if (xfs_physmem <= btoc(400*1024*1024)) {
11698 - log->l_iclog_bufs = XLOG_MED_ICLOGS;;
11699 + log->l_iclog_bufs = XLOG_MED_ICLOGS;
11701 /* 256K with 32K bufs */
11702 log->l_iclog_bufs = XLOG_MAX_ICLOGS;
11703 @@ -1087,9 +1065,9 @@
11704 log->l_iclog_bufs = mp->m_logbufs;
11706 #if defined(DEBUG) || defined(XLOG_NOLOG)
11707 - /* We are reactivating a filesystem after it was active */
11708 + /* We are reactivating a filesystem after it was inactive */
11709 if (log->l_targ == xlog_target) {
11710 - xlog_target = 1; /* XXX(hch): WTF? */
11711 + xlog_target = NULL;
11715 @@ -1578,7 +1556,7 @@
11716 sv_destroy(&iclog->ic_forcesema);
11717 sv_destroy(&iclog->ic_writesema);
11718 xfs_buf_free(iclog->ic_bp);
11720 +#ifdef XFS_LOG_TRACE
11721 if (iclog->ic_trace != NULL) {
11722 ktrace_free(iclog->ic_trace);
11724 @@ -1609,7 +1587,7 @@
11727 xfs_buf_free(log->l_xbuf);
11729 +#ifdef XFS_LOG_TRACE
11730 if (log->l_trace != NULL) {
11731 ktrace_free(log->l_trace);
11733 diff -urN linux.org/fs/xfs/xfs_log.h linux/fs/xfs/xfs_log.h
11734 --- linux.org/fs/xfs/xfs_log.h 2003-12-31 05:48:56.000000000 +0100
11735 +++ linux/fs/xfs/xfs_log.h 2004-01-02 04:21:42.000000000 +0100
11737 * endian issues in treating two 32 bit numbers as one 64 bit number
11740 -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
11741 -__attribute__((unused)) /* gcc 2.95 miscompiles this when inlined */
11742 +#if defined(__GNUC__) && (__GNUC__ == 2) && ( (__GNUC_MINOR__ == 95) || (__GNUC_MINOR__ == 96))
11743 +__attribute__((unused)) /* gcc 2.95, 2.96 miscompile this when inlined */
11747 diff -urN linux.org/fs/xfs/xfs_log_priv.h linux/fs/xfs/xfs_log_priv.h
11748 --- linux.org/fs/xfs/xfs_log_priv.h 2003-12-31 05:46:29.000000000 +0100
11749 +++ linux/fs/xfs/xfs_log_priv.h 2004-01-02 04:21:42.000000000 +0100
11751 #ifndef __XFS_LOG_PRIV_H__
11752 #define __XFS_LOG_PRIV_H__
11754 -#if defined(XFS_ALL_TRACE)
11755 -#define XFS_LOG_TRACE
11758 -#if !defined(DEBUG)
11759 -#undef XFS_LOG_TRACE
11765 @@ -109,6 +101,7 @@
11771 * get client id from packed copy.
11773 @@ -434,7 +427,7 @@
11774 struct log *ic_log;
11775 xfs_log_callback_t *ic_callback;
11776 xfs_log_callback_t **ic_callback_tail;
11778 +#ifdef XFS_LOG_TRACE
11779 struct ktrace *ic_trace;
11782 @@ -531,7 +524,7 @@
11783 int l_grant_write_bytes;
11785 /* The following fields don't need locking */
11787 +#ifdef XFS_LOG_TRACE
11788 struct ktrace *l_trace;
11789 struct ktrace *l_grant_trace;
11791 diff -urN linux.org/fs/xfs/xfs_mount.c linux/fs/xfs/xfs_mount.c
11792 --- linux.org/fs/xfs/xfs_mount.c 2003-12-31 05:46:55.000000000 +0100
11793 +++ linux/fs/xfs/xfs_mount.c 2004-01-02 04:21:42.000000000 +0100
11794 @@ -903,7 +903,7 @@
11795 * File systems that don't support user level file handles (i.e.
11796 * all of them except for XFS) will leave vfs_altfsid as NULL.
11798 - vfsp->vfs_altfsid = (fsid_t *)mp->m_fixedfsid;
11799 + vfsp->vfs_altfsid = (xfs_fsid_t *)mp->m_fixedfsid;
11800 mp->m_dmevmask = 0; /* not persistent; set after each mount */
11803 diff -urN linux.org/fs/xfs/xfs_qmops.c linux/fs/xfs/xfs_qmops.c
11804 --- linux.org/fs/xfs/xfs_qmops.c 2003-12-31 05:46:56.000000000 +0100
11805 +++ linux/fs/xfs/xfs_qmops.c 2004-01-02 04:21:43.000000000 +0100
11807 #include "xfs_mount.h"
11810 -#ifndef CONFIG_XFS_QUOTA
11811 STATIC struct xfs_dquot *
11812 xfs_dqvopchown_default(
11813 struct xfs_trans *tp,
11815 .xfs_dqvopchown = xfs_dqvopchown_default,
11816 .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr,
11818 -#endif /* CONFIG_XFS_QUOTA */
11819 diff -urN linux.org/fs/xfs/xfs_refcache.c linux/fs/xfs/xfs_refcache.c
11820 --- linux.org/fs/xfs/xfs_refcache.c 1970-01-01 01:00:00.000000000 +0100
11821 +++ linux/fs/xfs/xfs_refcache.c 2004-01-02 04:21:43.000000000 +0100
11824 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
11826 + * This program is free software; you can redistribute it and/or modify it
11827 + * under the terms of version 2 of the GNU General Public License as
11828 + * published by the Free Software Foundation.
11830 + * This program is distributed in the hope that it would be useful, but
11831 + * WITHOUT ANY WARRANTY; without even the implied warranty of
11832 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11834 + * Further, this software is distributed without any warranty that it is
11835 + * free of the rightful claim of any third person regarding infringement
11836 + * or the like. Any license provided herein, whether implied or
11837 + * otherwise, applies only to this software file. Patent licenses, if
11838 + * any, provided herein do not apply to combinations of this program with
11839 + * other software, or any other product whatsoever.
11841 + * You should have received a copy of the GNU General Public License along
11842 + * with this program; if not, write the Free Software Foundation, Inc., 59
11843 + * Temple Place - Suite 330, Boston MA 02111-1307, USA.
11845 + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
11846 + * Mountain View, CA 94043, or:
11848 + * http://www.sgi.com
11850 + * For further information regarding this notice, see:
11852 + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
11856 +#include "xfs_macros.h"
11857 +#include "xfs_types.h"
11858 +#include "xfs_inum.h"
11859 +#include "xfs_log.h"
11860 +#include "xfs_trans.h"
11861 +#include "xfs_sb.h"
11862 +#include "xfs_ag.h"
11863 +#include "xfs_dir.h"
11864 +#include "xfs_dir2.h"
11865 +#include "xfs_dmapi.h"
11866 +#include "xfs_mount.h"
11867 +#include "xfs_alloc_btree.h"
11868 +#include "xfs_bmap_btree.h"
11869 +#include "xfs_ialloc_btree.h"
11870 +#include "xfs_itable.h"
11871 +#include "xfs_btree.h"
11872 +#include "xfs_alloc.h"
11873 +#include "xfs_ialloc.h"
11874 +#include "xfs_attr.h"
11875 +#include "xfs_attr_sf.h"
11876 +#include "xfs_dir_sf.h"
11877 +#include "xfs_dir2_sf.h"
11878 +#include "xfs_dinode.h"
11879 +#include "xfs_inode_item.h"
11880 +#include "xfs_inode.h"
11881 +#include "xfs_bmap.h"
11882 +#include "xfs_error.h"
11883 +#include "xfs_buf_item.h"
11884 +#include "xfs_refcache.h"
11886 +STATIC spinlock_t xfs_refcache_lock = SPIN_LOCK_UNLOCKED;
11887 +STATIC xfs_inode_t **xfs_refcache;
11888 +STATIC int xfs_refcache_index;
11889 +STATIC int xfs_refcache_busy;
11890 +STATIC int xfs_refcache_count;
11893 + * Insert the given inode into the reference cache.
11896 +xfs_refcache_insert(
11900 + xfs_inode_t *release_ip;
11901 + xfs_inode_t **refcache;
11903 + ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE));
11906 + * If an unmount is busy blowing entries out of the cache,
11907 + * then don't bother.
11909 + if (xfs_refcache_busy) {
11914 + * If we tuned the refcache down to zero, don't do anything.
11916 + if (!xfs_refcache_size) {
11921 + * The inode is already in the refcache, so don't bother
11924 + if (ip->i_refcache != NULL) {
11928 + vp = XFS_ITOV(ip);
11929 + /* ASSERT(vp->v_count > 0); */
11933 + * We allocate the reference cache on use so that we don't
11934 + * waste the memory on systems not being used as NFS servers.
11936 + if (xfs_refcache == NULL) {
11937 + refcache = (xfs_inode_t **)kmem_zalloc(XFS_REFCACHE_SIZE_MAX *
11938 + sizeof(xfs_inode_t *),
11944 + spin_lock(&xfs_refcache_lock);
11947 + * If we allocated memory for the refcache above and it still
11948 + * needs it, then use the memory we allocated. Otherwise we'll
11949 + * free the memory below.
11951 + if (refcache != NULL) {
11952 + if (xfs_refcache == NULL) {
11953 + xfs_refcache = refcache;
11959 + * If an unmount is busy clearing out the cache, don't add new
11962 + if (xfs_refcache_busy) {
11963 + spin_unlock(&xfs_refcache_lock);
11966 + * If we allocated memory for the refcache above but someone
11967 + * else beat us to using it, then free the memory now.
11969 + if (refcache != NULL) {
11970 + kmem_free(refcache,
11971 + XFS_REFCACHE_SIZE_MAX * sizeof(xfs_inode_t *));
11975 + release_ip = xfs_refcache[xfs_refcache_index];
11976 + if (release_ip != NULL) {
11977 + release_ip->i_refcache = NULL;
11978 + xfs_refcache_count--;
11979 + ASSERT(xfs_refcache_count >= 0);
11981 + xfs_refcache[xfs_refcache_index] = ip;
11982 + ASSERT(ip->i_refcache == NULL);
11983 + ip->i_refcache = &(xfs_refcache[xfs_refcache_index]);
11984 + xfs_refcache_count++;
11985 + ASSERT(xfs_refcache_count <= xfs_refcache_size);
11986 + xfs_refcache_index++;
11987 + if (xfs_refcache_index == xfs_refcache_size) {
11988 + xfs_refcache_index = 0;
11990 + spin_unlock(&xfs_refcache_lock);
11993 + * Save the pointer to the inode to be released so that we can
11994 + * VN_RELE it once we've dropped our inode locks in xfs_rwunlock().
11995 + * The pointer may be NULL, but that's OK.
11997 + ip->i_release = release_ip;
12000 + * If we allocated memory for the refcache above but someone
12001 + * else beat us to using it, then free the memory now.
12003 + if (refcache != NULL) {
12004 + kmem_free(refcache,
12005 + XFS_REFCACHE_SIZE_MAX * sizeof(xfs_inode_t *));
12011 + * If the given inode is in the reference cache, purge its entry and
12012 + * release the reference on the vnode.
12015 +xfs_refcache_purge_ip(
12022 + * If we're not pointing to our entry in the cache, then
12023 + * we must not be in the cache.
12025 + if (ip->i_refcache == NULL) {
12029 + spin_lock(&xfs_refcache_lock);
12030 + if (ip->i_refcache == NULL) {
12031 + spin_unlock(&xfs_refcache_lock);
12036 + * Clear both our pointer to the cache entry and its pointer
12039 + ASSERT(*(ip->i_refcache) == ip);
12040 + *(ip->i_refcache) = NULL;
12041 + ip->i_refcache = NULL;
12042 + xfs_refcache_count--;
12043 + ASSERT(xfs_refcache_count >= 0);
12044 + spin_unlock(&xfs_refcache_lock);
12046 + vp = XFS_ITOV(ip);
12047 + /* ASSERT(vp->v_count > 1); */
12048 + VOP_RELEASE(vp, error);
12054 + * This is called from the XFS unmount code to purge all entries for the
12055 + * given mount from the cache. It uses the refcache busy counter to
12056 + * make sure that new entries are not added to the cache as we purge them.
12059 +xfs_refcache_purge_mp(
12066 + if (xfs_refcache == NULL) {
12070 + spin_lock(&xfs_refcache_lock);
12072 + * Bumping the busy counter keeps new entries from being added
12073 + * to the cache. We use a counter since multiple unmounts could
12074 + * be in here simultaneously.
12076 + xfs_refcache_busy++;
12078 + for (i = 0; i < xfs_refcache_size; i++) {
12079 + ip = xfs_refcache[i];
12080 + if ((ip != NULL) && (ip->i_mount == mp)) {
12081 + xfs_refcache[i] = NULL;
12082 + ip->i_refcache = NULL;
12083 + xfs_refcache_count--;
12084 + ASSERT(xfs_refcache_count >= 0);
12085 + spin_unlock(&xfs_refcache_lock);
12086 + vp = XFS_ITOV(ip);
12087 + VOP_RELEASE(vp, error);
12089 + spin_lock(&xfs_refcache_lock);
12093 + xfs_refcache_busy--;
12094 + ASSERT(xfs_refcache_busy >= 0);
12095 + spin_unlock(&xfs_refcache_lock);
12100 + * This is called from the XFS sync code to ensure that the refcache
12101 + * is emptied out over time. We purge a small number of entries with
12105 +xfs_refcache_purge_some(xfs_mount_t *mp)
12109 + int iplist_index;
12110 + xfs_inode_t **iplist;
12112 + if ((xfs_refcache == NULL) || (xfs_refcache_count == 0)) {
12116 + iplist_index = 0;
12117 + iplist = (xfs_inode_t **)kmem_zalloc(xfs_refcache_purge_count *
12118 + sizeof(xfs_inode_t *), KM_SLEEP);
12120 + spin_lock(&xfs_refcache_lock);
12123 + * Store any inodes we find in the next several entries
12124 + * into the iplist array to be released after dropping
12125 + * the spinlock. We always start looking from the currently
12126 + * oldest place in the cache. We move the refcache index
12127 + * forward as we go so that we are sure to eventually clear
12128 + * out the entire cache when the system goes idle.
12130 + for (i = 0; i < xfs_refcache_purge_count; i++) {
12131 + ip = xfs_refcache[xfs_refcache_index];
12132 + if (ip != NULL) {
12133 + xfs_refcache[xfs_refcache_index] = NULL;
12134 + ip->i_refcache = NULL;
12135 + xfs_refcache_count--;
12136 + ASSERT(xfs_refcache_count >= 0);
12137 + iplist[iplist_index] = ip;
12140 + xfs_refcache_index++;
12141 + if (xfs_refcache_index == xfs_refcache_size) {
12142 + xfs_refcache_index = 0;
12146 + spin_unlock(&xfs_refcache_lock);
12149 + * Now drop the inodes we collected.
12151 + for (i = 0; i < iplist_index; i++) {
12152 + VOP_RELEASE(XFS_ITOV(iplist[i]), error);
12153 + VN_RELE(XFS_ITOV(iplist[i]));
12156 + kmem_free(iplist, xfs_refcache_purge_count *
12157 + sizeof(xfs_inode_t *));
12161 + * This is called when the refcache is dynamically resized
12164 + * If the new size is smaller than the old size, purge all
12165 + * entries in slots greater than the new size, and move
12166 + * the index if necessary.
12168 + * If the refcache hasn't even been allocated yet, or the
12169 + * new size is larger than the old size, just set the value
12170 + * of xfs_refcache_size.
12174 +xfs_refcache_resize(int xfs_refcache_new_size)
12178 + int iplist_index = 0;
12179 + xfs_inode_t **iplist;
12183 + * If the new size is smaller than the current size,
12184 + * purge entries to create smaller cache, and
12185 + * reposition index if necessary.
12186 + * Don't bother if no refcache yet.
12188 + if (xfs_refcache && (xfs_refcache_new_size < xfs_refcache_size)) {
12190 + iplist = (xfs_inode_t **)kmem_zalloc(XFS_REFCACHE_SIZE_MAX *
12191 + sizeof(xfs_inode_t *), KM_SLEEP);
12193 + spin_lock(&xfs_refcache_lock);
12195 + for (i = xfs_refcache_new_size; i < xfs_refcache_size; i++) {
12196 + ip = xfs_refcache[i];
12197 + if (ip != NULL) {
12198 + xfs_refcache[i] = NULL;
12199 + ip->i_refcache = NULL;
12200 + xfs_refcache_count--;
12201 + ASSERT(xfs_refcache_count >= 0);
12202 + iplist[iplist_index] = ip;
12207 + xfs_refcache_size = xfs_refcache_new_size;
12210 + * Move index to beginning of cache if it's now past the end
12212 + if (xfs_refcache_index >= xfs_refcache_new_size)
12213 + xfs_refcache_index = 0;
12215 + spin_unlock(&xfs_refcache_lock);
12218 + * Now drop the inodes we collected.
12220 + for (i = 0; i < iplist_index; i++) {
12221 + VOP_RELEASE(XFS_ITOV(iplist[i]), error);
12222 + VN_RELE(XFS_ITOV(iplist[i]));
12225 + kmem_free(iplist, XFS_REFCACHE_SIZE_MAX *
12226 + sizeof(xfs_inode_t *));
12228 + spin_lock(&xfs_refcache_lock);
12229 + xfs_refcache_size = xfs_refcache_new_size;
12230 + spin_unlock(&xfs_refcache_lock);
12235 +xfs_refcache_iunlock(
12239 + xfs_inode_t *release_ip;
12242 + release_ip = ip->i_release;
12243 + ip->i_release = NULL;
12245 + xfs_iunlock(ip, lock_flags);
12247 + if (release_ip != NULL) {
12248 + VOP_RELEASE(XFS_ITOV(release_ip), error);
12249 + VN_RELE(XFS_ITOV(release_ip));
12254 +xfs_refcache_destroy(void)
12256 + if (xfs_refcache) {
12257 + kmem_free(xfs_refcache,
12258 + XFS_REFCACHE_SIZE_MAX * sizeof(xfs_inode_t *));
12259 + xfs_refcache = NULL;
12262 diff -urN linux.org/fs/xfs/xfs_refcache.h linux/fs/xfs/xfs_refcache.h
12263 --- linux.org/fs/xfs/xfs_refcache.h 1970-01-01 01:00:00.000000000 +0100
12264 +++ linux/fs/xfs/xfs_refcache.h 2004-01-02 04:21:43.000000000 +0100
12267 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12269 + * This program is free software; you can redistribute it and/or modify it
12270 + * under the terms of version 2 of the GNU General Public License as
12271 + * published by the Free Software Foundation.
12273 + * This program is distributed in the hope that it would be useful, but
12274 + * WITHOUT ANY WARRANTY; without even the implied warranty of
12275 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12277 + * Further, this software is distributed without any warranty that it is
12278 + * free of the rightful claim of any third person regarding infringement
12279 + * or the like. Any license provided herein, whether implied or
12280 + * otherwise, applies only to this software file. Patent licenses, if
12281 + * any, provided herein do not apply to combinations of this program with
12282 + * other software, or any other product whatsoever.
12284 + * You should have received a copy of the GNU General Public License along
12285 + * with this program; if not, write the Free Software Foundation, Inc., 59
12286 + * Temple Place - Suite 330, Boston MA 02111-1307, USA.
12288 + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
12289 + * Mountain View, CA 94043, or:
12291 + * http://www.sgi.com
12293 + * For further information regarding this notice, see:
12295 + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
12297 +#ifndef __XFS_REFCACHE_H__
12298 +#define __XFS_REFCACHE_H__
12300 +#ifdef HAVE_REFCACHE
12302 + * Maximum size (in inodes) for the NFS reference cache
12304 +#define XFS_REFCACHE_SIZE_MAX 512
12309 +extern void xfs_refcache_insert(struct xfs_inode *);
12310 +extern void xfs_refcache_purge_ip(struct xfs_inode *);
12311 +extern void xfs_refcache_purge_mp(struct xfs_mount *);
12312 +extern void xfs_refcache_purge_some(struct xfs_mount *);
12313 +extern void xfs_refcache_resize(int);
12314 +extern void xfs_refcache_destroy(void);
12316 +extern void xfs_refcache_iunlock(struct xfs_inode *, uint);
12320 +#define xfs_refcache_insert(ip) do { } while (0)
12321 +#define xfs_refcache_purge_ip(ip) do { } while (0)
12322 +#define xfs_refcache_purge_mp(mp) do { } while (0)
12323 +#define xfs_refcache_purge_some(mp) do { } while (0)
12324 +#define xfs_refcache_resize(size) do { } while (0)
12325 +#define xfs_refcache_destroy() do { } while (0)
12327 +#define xfs_refcache_iunlock(ip, flags) xfs_iunlock(ip, flags)
12331 +#endif /* __XFS_REFCACHE_H__ */
12332 diff -urN linux.org/fs/xfs/xfs_rename.c linux/fs/xfs/xfs_rename.c
12333 --- linux.org/fs/xfs/xfs_rename.c 2003-12-31 05:47:23.000000000 +0100
12334 +++ linux/fs/xfs/xfs_rename.c 2004-01-02 04:21:43.000000000 +0100
12337 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
12338 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12340 * This program is free software; you can redistribute it and/or modify it
12341 * under the terms of version 2 of the GNU General Public License as
12343 #include "xfs_bmap.h"
12344 #include "xfs_error.h"
12345 #include "xfs_quota.h"
12346 -#include "xfs_rw.h"
12347 +#include "xfs_refcache.h"
12348 #include "xfs_utils.h"
12349 #include "xfs_trans_space.h"
12350 #include "xfs_da_btree.h"
12351 @@ -343,8 +343,7 @@
12352 src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR);
12355 - * Drop the locks on our inodes so that we can do the ancestor
12356 - * check if necessary and start the transaction.
12357 + * Drop the locks on our inodes so that we can start the transaction.
12359 xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
12361 @@ -486,7 +485,7 @@
12362 error = xfs_droplink(tp, target_ip);
12364 rename_which_error_return = __LINE__;
12365 - goto abort_return;;
12366 + goto abort_return;
12368 target_ip_dropped = 1;
12370 @@ -627,6 +626,7 @@
12372 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL);
12373 if (target_ip != NULL) {
12374 + xfs_refcache_purge_ip(target_ip);
12378 diff -urN linux.org/fs/xfs/xfs_rw.c linux/fs/xfs/xfs_rw.c
12379 --- linux.org/fs/xfs/xfs_rw.c 2003-12-31 05:48:40.000000000 +0100
12380 +++ linux/fs/xfs/xfs_rw.c 2004-01-02 04:21:43.000000000 +0100
12383 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
12384 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12386 * This program is free software; you can redistribute it and/or modify it
12387 * under the terms of version 2 of the GNU General Public License as
12388 @@ -149,6 +149,9 @@
12389 xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp,
12390 "Corruption of in-memory data detected. Shutting down filesystem: %s",
12392 + if (XFS_ERRLEVEL_HIGH <= xfs_error_level) {
12393 + xfs_stack_trace();
12395 } else if (!(flags & XFS_FORCE_UMOUNT)) {
12397 xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp,
12398 @@ -351,54 +354,3 @@
12404 - * xfs_inval_cached_pages()
12405 - * This routine is responsible for keeping direct I/O and buffered I/O
12406 - * somewhat coherent. From here we make sure that we're at least
12407 - * temporarily holding the inode I/O lock exclusively and then call
12408 - * the page cache to flush and invalidate any cached pages. If there
12409 - * are no cached pages this routine will be very quick.
12412 -xfs_inval_cached_pages(
12414 - xfs_iocore_t *io,
12415 - xfs_off_t offset,
12421 - if (!VN_CACHED(vp)) {
12425 - mp = io->io_mount;
12428 - * We need to get the I/O lock exclusively in order
12429 - * to safely invalidate pages and mappings.
12432 - XFS_IUNLOCK(mp, io, XFS_IOLOCK_SHARED);
12433 - XFS_ILOCK(mp, io, XFS_IOLOCK_EXCL);
12436 - /* Writing beyond EOF creates a hole that must be zeroed */
12437 - if (write && (offset > XFS_SIZE(mp, io))) {
12438 - xfs_fsize_t isize;
12440 - XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
12441 - isize = XFS_SIZE(mp, io);
12442 - if (offset > isize) {
12443 - xfs_zero_eof(vp, io, offset, isize, offset);
12445 - XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
12448 - VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);
12450 - XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL);
12453 diff -urN linux.org/fs/xfs/xfs_rw.h linux/fs/xfs/xfs_rw.h
12454 --- linux.org/fs/xfs/xfs_rw.h 2003-12-31 05:46:29.000000000 +0100
12455 +++ linux/fs/xfs/xfs_rw.h 2004-01-02 04:21:43.000000000 +0100
12458 - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
12459 + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
12461 * This program is free software; you can redistribute it and/or modify it
12462 * under the terms of version 2 of the GNU General Public License as
12464 #ifndef __XFS_RW_H__
12465 #define __XFS_RW_H__
12474 -struct xfs_iocore;
12479 * Maximum count of bmaps used by read and write paths.
12481 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
12484 - * Defines for the trace mechanisms in xfs_rw.c.
12486 -#define XFS_RW_KTRACE_SIZE 64
12487 -#define XFS_STRAT_KTRACE_SIZE 64
12488 -#define XFS_STRAT_GTRACE_SIZE 512
12490 -#define XFS_READ_ENTER 1
12491 -#define XFS_WRITE_ENTER 2
12492 -#define XFS_IOMAP_READ_ENTER 3
12493 -#define XFS_IOMAP_WRITE_ENTER 4
12494 -#define XFS_IOMAP_READ_MAP 5
12495 -#define XFS_IOMAP_WRITE_MAP 6
12496 -#define XFS_IOMAP_WRITE_NOSPACE 7
12497 -#define XFS_ITRUNC_START 8
12498 -#define XFS_ITRUNC_FINISH1 9
12499 -#define XFS_ITRUNC_FINISH2 10
12500 -#define XFS_CTRUNC1 11
12501 -#define XFS_CTRUNC2 12
12502 -#define XFS_CTRUNC3 13
12503 -#define XFS_CTRUNC4 14
12504 -#define XFS_CTRUNC5 15
12505 -#define XFS_CTRUNC6 16
12506 -#define XFS_BUNMAPI 17
12507 -#define XFS_INVAL_CACHED 18
12508 -#define XFS_DIORD_ENTER 19
12509 -#define XFS_DIOWR_ENTER 20
12511 -#if defined(XFS_ALL_TRACE)
12512 -#define XFS_RW_TRACE
12513 -#define XFS_STRAT_TRACE
12516 -#if !defined(DEBUG)
12517 -#undef XFS_RW_TRACE
12518 -#undef XFS_STRAT_TRACE
12522 * Prototypes for functions in xfs_rw.c.
12525 @@ -141,14 +96,6 @@
12526 struct xfs_mount *mp,
12527 struct xfs_buf *bp);
12530 -xfs_inval_cached_pages(
12531 - struct vnode *vp,
12532 - struct xfs_iocore *io,
12533 - xfs_off_t offset,
12539 struct xfs_buf *b);
12540 diff -urN linux.org/fs/xfs/xfs_trans.c linux/fs/xfs/xfs_trans.c
12541 --- linux.org/fs/xfs/xfs_trans.c 2003-12-31 05:47:13.000000000 +0100
12542 +++ linux/fs/xfs/xfs_trans.c 2004-01-02 04:21:43.000000000 +0100
12543 @@ -142,9 +142,9 @@
12548 ASSERT(xfs_trans_zone != NULL);
12549 tp = kmem_zone_zalloc(xfs_trans_zone, KM_SLEEP);
12550 - tp->t_dqinfo = NULL;
12553 * Initialize the transaction structure.
12554 diff -urN linux.org/fs/xfs/xfs_vfsops.c linux/fs/xfs/xfs_vfsops.c
12555 --- linux.org/fs/xfs/xfs_vfsops.c 2003-12-31 05:46:41.000000000 +0100
12556 +++ linux/fs/xfs/xfs_vfsops.c 2004-01-02 04:21:43.000000000 +0100
12558 #include "xfs_bmap.h"
12559 #include "xfs_da_btree.h"
12560 #include "xfs_rw.h"
12561 +#include "xfs_refcache.h"
12562 #include "xfs_buf_item.h"
12563 #include "xfs_extfree_item.h"
12564 #include "xfs_quota.h"
12565 @@ -74,24 +75,11 @@
12569 - extern kmem_zone_t *xfs_da_state_zone;
12570 extern kmem_zone_t *xfs_bmap_free_item_zone;
12571 extern kmem_zone_t *xfs_btree_cur_zone;
12572 - extern kmem_zone_t *xfs_inode_zone;
12573 - extern kmem_zone_t *xfs_chashlist_zone;
12574 extern kmem_zone_t *xfs_trans_zone;
12575 extern kmem_zone_t *xfs_buf_item_zone;
12576 - extern kmem_zone_t *xfs_efd_zone;
12577 - extern kmem_zone_t *xfs_efi_zone;
12578 extern kmem_zone_t *xfs_dabuf_zone;
12580 - extern ktrace_t *xfs_alloc_trace_buf;
12581 - extern ktrace_t *xfs_bmap_trace_buf;
12582 - extern ktrace_t *xfs_bmbt_trace_buf;
12583 - extern ktrace_t *xfs_dir_trace_buf;
12584 - extern ktrace_t *xfs_attr_trace_buf;
12585 - extern ktrace_t *xfs_dir2_trace_buf;
12586 -#endif /* DEBUG */
12587 #ifdef XFS_DABUF_DEBUG
12588 extern lock_t xfs_dabuf_global_lock;
12589 spinlock_init(&xfs_dabuf_global_lock, "xfsda");
12590 @@ -132,14 +120,6 @@
12592 _ACL_ZONE_INIT(xfs_acl_zone, "xfs_acl");
12594 -#ifdef CONFIG_XFS_VNODE_TRACING
12595 - ktrace_init(VNODE_TRACE_SIZE);
12603 * Allocate global trace buffers.
12605 @@ -189,6 +169,7 @@
12607 xfs_cleanup_procfs();
12608 xfs_sysctl_unregister();
12609 + xfs_refcache_destroy();
12611 kmem_cache_destroy(xfs_bmap_free_item_zone);
12612 kmem_cache_destroy(xfs_btree_cur_zone);
12613 @@ -203,9 +184,6 @@
12614 kmem_cache_destroy(xfs_ili_zone);
12615 kmem_cache_destroy(xfs_chashlist_zone);
12616 _ACL_ZONE_DESTROY(xfs_acl_zone);
12617 -#if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING))
12623 @@ -547,6 +525,12 @@
12624 0 : DM_FLAGS_UNWANTED;
12628 + * First blow any referenced inode from this file system
12629 + * out of the reference cache, and delete the timer.
12631 + xfs_refcache_purge_mp(mp);
12633 XFS_bflush(mp->m_ddev_targp);
12634 error = xfs_unmount_flush(mp, 0);
12636 @@ -617,6 +601,7 @@
12639 if (*flags & MS_RDONLY) {
12640 + xfs_refcache_purge_mp(mp);
12641 pagebuf_delwri_flush(mp->m_ddev_targp, 0, NULL);
12642 xfs_finish_reclaim_all(mp, 0);
12644 @@ -758,7 +743,7 @@
12648 - struct kstatfs *statp,
12649 + xfs_statfs_t *statp,
12652 __uint64_t fakeinos;
12653 @@ -766,7 +751,6 @@
12659 mp = XFS_BHVTOM(bdp);
12661 @@ -793,9 +777,8 @@
12662 statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree);
12663 XFS_SB_UNLOCK(mp, s);
12665 - id = huge_encode_dev(mp->m_dev);
12666 - statp->f_fsid.val[0] = (u32)id;
12667 - statp->f_fsid.val[1] = (u32)(id >> 32);
12668 + statp->f_fsid.val[0] = mp->m_dev;
12669 + statp->f_fsid.val[1] = 0;
12670 statp->f_namelen = MAXNAMELEN - 1;
12673 @@ -1489,8 +1472,18 @@
12677 + * If this is the periodic sync, then kick some entries out of
12678 + * the reference cache. This ensures that idle entries are
12679 + * eventually kicked out of the cache.
12681 + if (flags & SYNC_REFCACHE) {
12682 + xfs_refcache_purge_some(mp);
12686 * Now check to see if the log needs a "dummy" transaction.
12689 if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) {
12692 @@ -1598,8 +1591,9 @@
12693 #define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */
12694 #define MNTOPT_NOLOGFLUSH "nologflush" /* don't hard flush on log writes */
12695 #define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */
12696 -#define MNTOPT_64BITINODE "inode64" /* inodes can be allocated anywhere */
12697 -#define MNTOPT_IKEEP "ikeep" /* free empty inode clusters */
12698 +#define MNTOPT_64BITINODE "inode64" /* inodes can be allocated anywhere */
12699 +#define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */
12700 +#define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */
12704 @@ -1614,7 +1608,9 @@
12705 int dsunit, dswidth, vol_dsunit, vol_dswidth;
12708 +#if 0 /* XXX: off by default, until some remaining issues ironed out */
12709 args->flags |= XFSMNT_IDELETE; /* default to on */
12714 @@ -1722,6 +1718,8 @@
12715 args->flags |= XFSMNT_NOLOGFLUSH;
12716 } else if (!strcmp(this_char, MNTOPT_IKEEP)) {
12717 args->flags &= ~XFSMNT_IDELETE;
12718 + } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) {
12719 + args->flags |= XFSMNT_IDELETE;
12720 } else if (!strcmp(this_char, "osyncisdsync")) {
12721 /* no-op, this is now the default */
12722 printk("XFS: osyncisdsync is now the default, option is deprecated.\n");
12723 @@ -1784,10 +1782,14 @@
12726 /* the few simple ones we can get from the mount struct */
12727 + { XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC },
12728 + { XFS_MOUNT_INO64, "," MNTOPT_INO64 },
12729 { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN },
12730 + { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
12731 { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY },
12732 { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC },
12733 - { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
12734 + { XFS_MOUNT_NOLOGFLUSH, "," MNTOPT_NOLOGFLUSH },
12735 + { XFS_MOUNT_IDELETE, "," MNTOPT_NOIKEEP },
12738 struct proc_xfs_info *xfs_infop;
12739 @@ -1823,6 +1825,9 @@
12740 seq_printf(m, "," MNTOPT_SWIDTH "=%d",
12741 (int)XFS_FSB_TO_BB(mp, mp->m_swidth));
12743 + if (!(mp->m_flags & XFS_MOUNT_32BITINOOPT))
12744 + seq_printf(m, "," MNTOPT_64BITINODE);
12749 @@ -1840,6 +1845,7 @@
12750 .vfs_vget = xfs_vget,
12751 .vfs_dmapiops = (vfs_dmapiops_t)fs_nosys,
12752 .vfs_quotactl = (vfs_quotactl_t)fs_nosys,
12753 + .vfs_get_inode = xfs_get_inode,
12754 .vfs_init_vnode = xfs_initialize_vnode,
12755 .vfs_force_shutdown = xfs_do_force_shutdown,
12757 diff -urN linux.org/fs/xfs/xfs_vnodeops.c linux/fs/xfs/xfs_vnodeops.c
12758 --- linux.org/fs/xfs/xfs_vnodeops.c 2003-12-31 05:48:49.000000000 +0100
12759 +++ linux/fs/xfs/xfs_vnodeops.c 2004-01-02 04:21:43.000000000 +0100
12761 #include "xfs_da_btree.h"
12762 #include "xfs_attr.h"
12763 #include "xfs_rw.h"
12764 +#include "xfs_refcache.h"
12765 #include "xfs_error.h"
12766 #include "xfs_bit.h"
12767 #include "xfs_rtalloc.h"
12770 #define SYMLINK_MAPS 2
12772 -extern int xfs_ioctl(bhv_desc_t *, struct inode *, struct file *,
12773 - int, unsigned int, unsigned long);
12777 * For xfs, we check that the file isn't too big to be opened by this kernel.
12778 * No other open action is required for regular files. Devices are handled
12779 @@ -434,7 +431,7 @@
12782 /* boolean: are we the file owner? */
12783 - file_owner = (current->fsuid == ip->i_d.di_uid);
12784 + file_owner = (current_fsuid(credp) == ip->i_d.di_uid);
12787 * Change various properties of a file.
12788 @@ -1660,6 +1657,12 @@
12789 if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
12792 +#ifdef HAVE_REFCACHE
12793 + /* If we are in the NFS reference cache then don't do this now */
12794 + if (ip->i_refcache)
12800 if (ip->i_d.di_nlink != 0) {
12801 @@ -2004,7 +2007,8 @@
12803 * Make sure that we have allocated dquot(s) on disk.
12805 - error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid,
12806 + error = XFS_QM_DQVOPALLOC(mp, dp,
12807 + current_fsuid(credp), current_fsgid(credp),
12808 XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp);
12811 @@ -2613,6 +2617,14 @@
12816 + * Before we drop our extra reference to the inode, purge it
12817 + * from the refcache if it is there. By waiting until afterwards
12818 + * to do the IRELE, we ensure that we won't go inactive in the
12819 + * xfs_refcache_purge_ip routine (although that would be OK).
12821 + xfs_refcache_purge_ip(ip);
12823 vn_trace_exit(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
12826 @@ -2652,6 +2664,14 @@
12827 cancel_flags |= XFS_TRANS_ABORT;
12828 xfs_trans_cancel(tp, cancel_flags);
12831 + * Before we drop our extra reference to the inode, purge it
12832 + * from the refcache if it is there. By waiting until afterwards
12833 + * to do the IRELE, we ensure that we won't go inactive in the
12834 + * xfs_refcache_purge_ip routine (although that would be OK).
12836 + xfs_refcache_purge_ip(ip);
12841 @@ -2899,7 +2919,8 @@
12843 * Make sure that we have allocated dquot(s) on disk.
12845 - error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid,
12846 + error = XFS_QM_DQVOPALLOC(mp, dp,
12847 + current_fsuid(credp), current_fsgid(credp),
12848 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
12851 @@ -3456,7 +3477,8 @@
12853 * Make sure that we have allocated dquot(s) on disk.
12855 - error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid,
12856 + error = XFS_QM_DQVOPALLOC(mp, dp,
12857 + current_fsuid(credp), current_fsgid(credp),
12858 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
12861 @@ -3743,7 +3765,14 @@
12863 ip = XFS_BHVTOI(bdp);
12864 if (locktype == VRWLOCK_WRITE) {
12865 - xfs_iunlock (ip, XFS_IOLOCK_EXCL);
12867 + * In the write case, we may have added a new entry to
12868 + * the reference cache. This might store a pointer to
12869 + * an inode to be released in this inode. If it is there,
12870 + * clear the pointer and release the inode after unlocking
12873 + xfs_refcache_iunlock(ip, XFS_IOLOCK_EXCL);
12875 ASSERT((locktype == VRWLOCK_READ) ||
12876 (locktype == VRWLOCK_WRITE_DIRECT));
12877 @@ -4738,7 +4767,9 @@
12878 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
12879 .vop_open = xfs_open,
12880 .vop_read = xfs_read,
12881 +#ifdef HAVE_SENDFILE
12882 .vop_sendfile = xfs_sendfile,
12884 .vop_write = xfs_write,
12885 .vop_ioctl = xfs_ioctl,
12886 .vop_getattr = xfs_getattr,