diff options
author | Nathan Scott <nathans@sgi.com> | 2006-09-27 21:03:05 -0400 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2006-09-27 21:03:05 -0400 |
commit | efb8ad7e9431a430a75d44288614cf6047ff4baa (patch) | |
tree | cbebf7d8bf1b5f25235756c0aa7ff610d4cb4055 /fs | |
parent | 3f89243c5b987dd55f8eec6fd54be05887d69bc6 (diff) |
[XFS] Add a debug flag for allocations which are known to be larger than
one page.
SGI-PV: 955302
SGI-Modid: xfs-linux-melb:xfs-kern:26800a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 8 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.h | 3 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 2 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 6 | ||||
-rw-r--r-- | fs/xfs/support/ktrace.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 2 |
7 files changed, 18 insertions, 9 deletions
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index aba7fcf881a2..f77fe5c8fcc1 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -34,6 +34,14 @@ kmem_alloc(size_t size, unsigned int __nocast flags) | |||
34 | gfp_t lflags = kmem_flags_convert(flags); | 34 | gfp_t lflags = kmem_flags_convert(flags); |
35 | void *ptr; | 35 | void *ptr; |
36 | 36 | ||
37 | #ifdef DEBUG | ||
38 | if (unlikely(!(flags & KM_LARGE) && (size > PAGE_SIZE))) { | ||
39 | printk(KERN_WARNING "Large %s attempt, size=%ld\n", | ||
40 | __FUNCTION__, (long)size); | ||
41 | dump_stack(); | ||
42 | } | ||
43 | #endif | ||
44 | |||
37 | do { | 45 | do { |
38 | if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS) | 46 | if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS) |
39 | ptr = kmalloc(size, lflags); | 47 | ptr = kmalloc(size, lflags); |
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index 0e8293c5a32f..6d24274fb3cb 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define KM_NOSLEEP 0x0002u | 30 | #define KM_NOSLEEP 0x0002u |
31 | #define KM_NOFS 0x0004u | 31 | #define KM_NOFS 0x0004u |
32 | #define KM_MAYFAIL 0x0008u | 32 | #define KM_MAYFAIL 0x0008u |
33 | #define KM_LARGE 0x0010u | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * We use a special process flag to avoid recursive callbacks into | 36 | * We use a special process flag to avoid recursive callbacks into |
@@ -41,7 +42,7 @@ kmem_flags_convert(unsigned int __nocast flags) | |||
41 | { | 42 | { |
42 | gfp_t lflags; | 43 | gfp_t lflags; |
43 | 44 | ||
44 | BUG_ON(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL)); | 45 | BUG_ON(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL|KM_LARGE)); |
45 | 46 | ||
46 | if (flags & KM_NOSLEEP) { | 47 | if (flags & KM_NOSLEEP) { |
47 | lflags = GFP_ATOMIC | __GFP_NOWARN; | 48 | lflags = GFP_ATOMIC | __GFP_NOWARN; |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 247adced6e1b..58b6599de619 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -768,7 +768,7 @@ xfs_buf_get_noaddr( | |||
768 | _xfs_buf_initialize(bp, target, 0, len, 0); | 768 | _xfs_buf_initialize(bp, target, 0, len, 0); |
769 | 769 | ||
770 | try_again: | 770 | try_again: |
771 | data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL); | 771 | data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL | KM_LARGE); |
772 | if (unlikely(data == NULL)) | 772 | if (unlikely(data == NULL)) |
773 | goto fail_free_buf; | 773 | goto fail_free_buf; |
774 | 774 | ||
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index e23e45535c48..3f86c7c04648 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -112,17 +112,17 @@ xfs_Gqm_init(void) | |||
112 | { | 112 | { |
113 | xfs_dqhash_t *udqhash, *gdqhash; | 113 | xfs_dqhash_t *udqhash, *gdqhash; |
114 | xfs_qm_t *xqm; | 114 | xfs_qm_t *xqm; |
115 | uint i, hsize, flags = KM_SLEEP | KM_MAYFAIL; | 115 | uint i, hsize, flags = KM_SLEEP | KM_MAYFAIL | KM_LARGE; |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * Initialize the dquot hash tables. | 118 | * Initialize the dquot hash tables. |
119 | */ | 119 | */ |
120 | hsize = XFS_QM_HASHSIZE_HIGH; | 120 | hsize = XFS_QM_HASHSIZE_HIGH; |
121 | while (!(udqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), flags))) { | 121 | while (!(udqhash = kmem_zalloc(hsize * sizeof(*udqhash), flags))) { |
122 | if ((hsize >>= 1) <= XFS_QM_HASHSIZE_LOW) | 122 | if ((hsize >>= 1) <= XFS_QM_HASHSIZE_LOW) |
123 | flags = KM_SLEEP; | 123 | flags = KM_SLEEP; |
124 | } | 124 | } |
125 | gdqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), KM_SLEEP); | 125 | gdqhash = kmem_zalloc(hsize * sizeof(*gdqhash), KM_SLEEP | KM_LARGE); |
126 | ndquot = hsize << 8; | 126 | ndquot = hsize << 8; |
127 | 127 | ||
128 | xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP); | 128 | xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP); |
diff --git a/fs/xfs/support/ktrace.c b/fs/xfs/support/ktrace.c index addf5a7ea06c..5cf2e86caa71 100644 --- a/fs/xfs/support/ktrace.c +++ b/fs/xfs/support/ktrace.c | |||
@@ -75,7 +75,7 @@ ktrace_alloc(int nentries, unsigned int __nocast sleep) | |||
75 | sleep); | 75 | sleep); |
76 | } else { | 76 | } else { |
77 | ktep = (ktrace_entry_t*)kmem_zalloc((nentries * sizeof(*ktep)), | 77 | ktep = (ktrace_entry_t*)kmem_zalloc((nentries * sizeof(*ktep)), |
78 | sleep); | 78 | sleep | KM_LARGE); |
79 | } | 79 | } |
80 | 80 | ||
81 | if (ktep == NULL) { | 81 | if (ktep == NULL) { |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 109000a4bc87..30eebc2fd90e 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -50,7 +50,7 @@ void | |||
50 | xfs_ihash_init(xfs_mount_t *mp) | 50 | xfs_ihash_init(xfs_mount_t *mp) |
51 | { | 51 | { |
52 | __uint64_t icount; | 52 | __uint64_t icount; |
53 | uint i, flags = KM_SLEEP | KM_MAYFAIL; | 53 | uint i, flags = KM_SLEEP | KM_MAYFAIL | KM_LARGE; |
54 | 54 | ||
55 | if (!mp->m_ihsize) { | 55 | if (!mp->m_ihsize) { |
56 | icount = mp->m_maxicount ? mp->m_maxicount : | 56 | icount = mp->m_maxicount ? mp->m_maxicount : |
@@ -95,7 +95,7 @@ xfs_chash_init(xfs_mount_t *mp) | |||
95 | mp->m_chsize = min_t(uint, mp->m_chsize, mp->m_ihsize); | 95 | mp->m_chsize = min_t(uint, mp->m_chsize, mp->m_ihsize); |
96 | mp->m_chash = (xfs_chash_t *)kmem_zalloc(mp->m_chsize | 96 | mp->m_chash = (xfs_chash_t *)kmem_zalloc(mp->m_chsize |
97 | * sizeof(xfs_chash_t), | 97 | * sizeof(xfs_chash_t), |
98 | KM_SLEEP); | 98 | KM_SLEEP | KM_LARGE); |
99 | for (i = 0; i < mp->m_chsize; i++) { | 99 | for (i = 0; i < mp->m_chsize; i++) { |
100 | spinlock_init(&mp->m_chash[i].ch_lock,"xfshash"); | 100 | spinlock_init(&mp->m_chash[i].ch_lock,"xfshash"); |
101 | } | 101 | } |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 2a46919110f2..ac999789a44d 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -1196,7 +1196,7 @@ xlog_alloc_log(xfs_mount_t *mp, | |||
1196 | kmem_zalloc(sizeof(xlog_in_core_t), KM_SLEEP); | 1196 | kmem_zalloc(sizeof(xlog_in_core_t), KM_SLEEP); |
1197 | iclog = *iclogp; | 1197 | iclog = *iclogp; |
1198 | iclog->hic_data = (xlog_in_core_2_t *) | 1198 | iclog->hic_data = (xlog_in_core_2_t *) |
1199 | kmem_zalloc(iclogsize, KM_SLEEP); | 1199 | kmem_zalloc(iclogsize, KM_SLEEP | KM_LARGE); |
1200 | 1200 | ||
1201 | iclog->ic_prev = prev_iclog; | 1201 | iclog->ic_prev = prev_iclog; |
1202 | prev_iclog = iclog; | 1202 | prev_iclog = iclog; |