Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6

* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6:
  [XFS] fix nasty quota hashtable allocation bug
  [XFS] fix sparse shadowed variable warnings
  [XFS] fix ASSERT and ASSERT_ALWAYS
  [XFS] Fix sparse warning in kmem_shake_allow
  [XFS] Fix sparse NULL vs 0 warnings
  [XFS] Set filestreams object timeout to something sane.
This commit is contained in:
Linus Torvalds 2007-09-10 14:36:37 -07:00
commit 3c038f97e4
8 changed files with 26 additions and 24 deletions

View File

@ -103,7 +103,7 @@ extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast);
static inline int static inline int
kmem_shake_allow(gfp_t gfp_mask) kmem_shake_allow(gfp_t gfp_mask)
{ {
return (gfp_mask & __GFP_WAIT); return (gfp_mask & __GFP_WAIT) != 0;
} }
#endif /* __XFS_SUPPORT_KMEM_H__ */ #endif /* __XFS_SUPPORT_KMEM_H__ */

View File

@ -652,7 +652,7 @@ xfs_probe_cluster(
for (i = 0; i < pagevec_count(&pvec); i++) { for (i = 0; i < pagevec_count(&pvec); i++) {
struct page *page = pvec.pages[i]; struct page *page = pvec.pages[i];
size_t pg_offset, len = 0; size_t pg_offset, pg_len = 0;
if (tindex == tlast) { if (tindex == tlast) {
pg_offset = pg_offset =
@ -665,16 +665,16 @@ xfs_probe_cluster(
pg_offset = PAGE_CACHE_SIZE; pg_offset = PAGE_CACHE_SIZE;
if (page->index == tindex && !TestSetPageLocked(page)) { if (page->index == tindex && !TestSetPageLocked(page)) {
len = xfs_probe_page(page, pg_offset, mapped); pg_len = xfs_probe_page(page, pg_offset, mapped);
unlock_page(page); unlock_page(page);
} }
if (!len) { if (!pg_len) {
done = 1; done = 1;
break; break;
} }
total += len; total += pg_len;
tindex++; tindex++;
} }

View File

@ -46,7 +46,7 @@ xfs_param_t xfs_params = {
.inherit_nosym = { 0, 0, 1 }, .inherit_nosym = { 0, 0, 1 },
.rotorstep = { 1, 1, 255 }, .rotorstep = { 1, 1, 255 },
.inherit_nodfrg = { 0, 1, 1 }, .inherit_nodfrg = { 0, 1, 1 },
.fstrm_timer = { 1, 50, 3600*100}, .fstrm_timer = { 1, 30*100, 3600*100},
}; };
/* /*

View File

@ -120,7 +120,8 @@ xfs_Gqm_init(void)
* Initialize the dquot hash tables. * Initialize the dquot hash tables.
*/ */
udqhash = kmem_zalloc_greedy(&hsize, udqhash = kmem_zalloc_greedy(&hsize,
XFS_QM_HASHSIZE_LOW, XFS_QM_HASHSIZE_HIGH, XFS_QM_HASHSIZE_LOW * sizeof(xfs_dqhash_t),
XFS_QM_HASHSIZE_HIGH * sizeof(xfs_dqhash_t),
KM_SLEEP | KM_MAYFAIL | KM_LARGE); KM_SLEEP | KM_MAYFAIL | KM_LARGE);
gdqhash = kmem_zalloc(hsize, KM_SLEEP | KM_LARGE); gdqhash = kmem_zalloc(hsize, KM_SLEEP | KM_LARGE);
hsize /= sizeof(xfs_dqhash_t); hsize /= sizeof(xfs_dqhash_t);

View File

@ -34,10 +34,10 @@ extern void cmn_err(int, char *, ...)
extern void assfail(char *expr, char *f, int l); extern void assfail(char *expr, char *f, int l);
#define ASSERT_ALWAYS(expr) \ #define ASSERT_ALWAYS(expr) \
(unlikely((expr) != 0) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
#ifndef DEBUG #ifndef DEBUG
# define ASSERT(expr) ((void)0) #define ASSERT(expr) ((void)0)
#ifndef STATIC #ifndef STATIC
# define STATIC static noinline # define STATIC static noinline
@ -49,8 +49,10 @@ extern void assfail(char *expr, char *f, int l);
#else /* DEBUG */ #else /* DEBUG */
# define ASSERT(expr) ASSERT_ALWAYS(expr) #include <linux/random.h>
# include <linux/random.h>
#define ASSERT(expr) \
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
#ifndef STATIC #ifndef STATIC
# define STATIC noinline # define STATIC noinline

View File

@ -1975,7 +1975,6 @@ xfs_da_do_buf(
error = mappedbno == -2 ? 0 : XFS_ERROR(EFSCORRUPTED); error = mappedbno == -2 ? 0 : XFS_ERROR(EFSCORRUPTED);
if (unlikely(error == EFSCORRUPTED)) { if (unlikely(error == EFSCORRUPTED)) {
if (xfs_error_level >= XFS_ERRLEVEL_LOW) { if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
int i;
cmn_err(CE_ALERT, "xfs_da_do_buf: bno %lld\n", cmn_err(CE_ALERT, "xfs_da_do_buf: bno %lld\n",
(long long)bno); (long long)bno);
cmn_err(CE_ALERT, "dir: inode %lld\n", cmn_err(CE_ALERT, "dir: inode %lld\n",

View File

@ -2185,13 +2185,13 @@ xlog_state_do_callback(
} }
cb = iclog->ic_callback; cb = iclog->ic_callback;
while (cb != 0) { while (cb) {
iclog->ic_callback_tail = &(iclog->ic_callback); iclog->ic_callback_tail = &(iclog->ic_callback);
iclog->ic_callback = NULL; iclog->ic_callback = NULL;
LOG_UNLOCK(log, s); LOG_UNLOCK(log, s);
/* perform callbacks in the order given */ /* perform callbacks in the order given */
for (; cb != 0; cb = cb_next) { for (; cb; cb = cb_next) {
cb_next = cb->cb_next; cb_next = cb->cb_next;
cb->cb_func(cb->cb_arg, aborted); cb->cb_func(cb->cb_arg, aborted);
} }
@ -2202,7 +2202,7 @@ xlog_state_do_callback(
loopdidcallbacks++; loopdidcallbacks++;
funcdidcallbacks++; funcdidcallbacks++;
ASSERT(iclog->ic_callback == 0); ASSERT(iclog->ic_callback == NULL);
if (!(iclog->ic_state & XLOG_STATE_IOERROR)) if (!(iclog->ic_state & XLOG_STATE_IOERROR))
iclog->ic_state = XLOG_STATE_DIRTY; iclog->ic_state = XLOG_STATE_DIRTY;
@ -3242,10 +3242,10 @@ xlog_ticket_put(xlog_t *log,
#else #else
/* When we debug, it is easier if tickets are cycled */ /* When we debug, it is easier if tickets are cycled */
ticket->t_next = NULL; ticket->t_next = NULL;
if (log->l_tail != 0) { if (log->l_tail) {
log->l_tail->t_next = ticket; log->l_tail->t_next = ticket;
} else { } else {
ASSERT(log->l_freelist == 0); ASSERT(log->l_freelist == NULL);
log->l_freelist = ticket; log->l_freelist = ticket;
} }
log->l_tail = ticket; log->l_tail = ticket;
@ -3463,7 +3463,7 @@ xlog_verify_iclog(xlog_t *log,
s = LOG_LOCK(log); s = LOG_LOCK(log);
icptr = log->l_iclog; icptr = log->l_iclog;
for (i=0; i < log->l_iclog_bufs; i++) { for (i=0; i < log->l_iclog_bufs; i++) {
if (icptr == 0) if (icptr == NULL)
xlog_panic("xlog_verify_iclog: invalid ptr"); xlog_panic("xlog_verify_iclog: invalid ptr");
icptr = icptr->ic_next; icptr = icptr->ic_next;
} }

View File

@ -1366,7 +1366,7 @@ xlog_recover_add_to_cont_trans(
int old_len; int old_len;
item = trans->r_itemq; item = trans->r_itemq;
if (item == 0) { if (item == NULL) {
/* finish copying rest of trans header */ /* finish copying rest of trans header */
xlog_recover_add_item(&trans->r_itemq); xlog_recover_add_item(&trans->r_itemq);
ptr = (xfs_caddr_t) &trans->r_theader + ptr = (xfs_caddr_t) &trans->r_theader +
@ -1412,7 +1412,7 @@ xlog_recover_add_to_trans(
if (!len) if (!len)
return 0; return 0;
item = trans->r_itemq; item = trans->r_itemq;
if (item == 0) { if (item == NULL) {
ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC); ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC);
if (len == sizeof(xfs_trans_header_t)) if (len == sizeof(xfs_trans_header_t))
xlog_recover_add_item(&trans->r_itemq); xlog_recover_add_item(&trans->r_itemq);
@ -1467,12 +1467,12 @@ xlog_recover_unlink_tid(
xlog_recover_t *tp; xlog_recover_t *tp;
int found = 0; int found = 0;
ASSERT(trans != 0); ASSERT(trans != NULL);
if (trans == *q) { if (trans == *q) {
*q = (*q)->r_next; *q = (*q)->r_next;
} else { } else {
tp = *q; tp = *q;
while (tp != 0) { while (tp) {
if (tp->r_next == trans) { if (tp->r_next == trans) {
found = 1; found = 1;
break; break;
@ -1495,7 +1495,7 @@ xlog_recover_insert_item_backq(
xlog_recover_item_t **q, xlog_recover_item_t **q,
xlog_recover_item_t *item) xlog_recover_item_t *item)
{ {
if (*q == 0) { if (*q == NULL) {
item->ri_prev = item->ri_next = item; item->ri_prev = item->ri_next = item;
*q = item; *q = item;
} else { } else {
@ -1899,7 +1899,7 @@ xlog_recover_do_reg_buffer(
break; break;
nbits = xfs_contig_bits(data_map, map_size, bit); nbits = xfs_contig_bits(data_map, map_size, bit);
ASSERT(nbits > 0); ASSERT(nbits > 0);
ASSERT(item->ri_buf[i].i_addr != 0); ASSERT(item->ri_buf[i].i_addr != NULL);
ASSERT(item->ri_buf[i].i_len % XFS_BLI_CHUNK == 0); ASSERT(item->ri_buf[i].i_len % XFS_BLI_CHUNK == 0);
ASSERT(XFS_BUF_COUNT(bp) >= ASSERT(XFS_BUF_COUNT(bp) >=
((uint)bit << XFS_BLI_SHIFT)+(nbits<<XFS_BLI_SHIFT)); ((uint)bit << XFS_BLI_SHIFT)+(nbits<<XFS_BLI_SHIFT));