aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r--fs/xfs/quota/Makefile1
-rw-r--r--fs/xfs/quota/Makefile-linux-2.653
-rw-r--r--fs/xfs/quota/xfs_dquot.c237
-rw-r--r--fs/xfs/quota/xfs_dquot.h36
-rw-r--r--fs/xfs/quota/xfs_dquot_item.c53
-rw-r--r--fs/xfs/quota/xfs_dquot_item.h36
-rw-r--r--fs/xfs/quota/xfs_qm.c187
-rw-r--r--fs/xfs/quota/xfs_qm.h42
-rw-r--r--fs/xfs/quota/xfs_qm_bhv.c53
-rw-r--r--fs/xfs/quota/xfs_qm_stats.c53
-rw-r--r--fs/xfs/quota/xfs_qm_stats.h37
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c173
-rw-r--r--fs/xfs/quota/xfs_quota_priv.h36
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c102
14 files changed, 415 insertions, 684 deletions
diff --git a/fs/xfs/quota/Makefile b/fs/xfs/quota/Makefile
deleted file mode 100644
index 7a4f725b2824..000000000000
--- a/fs/xfs/quota/Makefile
+++ /dev/null
@@ -1 +0,0 @@
1include $(TOPDIR)/fs/xfs/quota/Makefile-linux-$(VERSION).$(PATCHLEVEL)
diff --git a/fs/xfs/quota/Makefile-linux-2.6 b/fs/xfs/quota/Makefile-linux-2.6
deleted file mode 100644
index 93e60e839355..000000000000
--- a/fs/xfs/quota/Makefile-linux-2.6
+++ /dev/null
@@ -1,53 +0,0 @@
1#
2# Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
3#
4# This program is free software; you can redistribute it and/or modify it
5# under the terms of version 2 of the GNU General Public License as
6# published by the Free Software Foundation.
7#
8# This program is distributed in the hope that it would be useful, but
9# WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11#
12# Further, this software is distributed without any warranty that it is
13# free of the rightful claim of any third person regarding infringement
14# or the like. Any license provided herein, whether implied or
15# otherwise, applies only to this software file. Patent licenses, if
16# any, provided herein do not apply to combinations of this program with
17# other software, or any other product whatsoever.
18#
19# You should have received a copy of the GNU General Public License along
20# with this program; if not, write the Free Software Foundation, Inc., 59
21# Temple Place - Suite 330, Boston MA 02111-1307, USA.
22#
23# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24# Mountain View, CA 94043, or:
25#
26# http://www.sgi.com
27#
28# For further information regarding this notice, see:
29#
30# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31#
32
33EXTRA_CFLAGS += -I $(TOPDIR)/fs/xfs -I $(TOPDIR)/fs/xfs/linux-2.6
34
35ifeq ($(CONFIG_XFS_DEBUG),y)
36 EXTRA_CFLAGS += -g -DDEBUG
37 #EXTRA_CFLAGS += -DQUOTADEBUG
38endif
39ifeq ($(CONFIG_XFS_TRACE),y)
40 EXTRA_CFLAGS += -DXFS_DQUOT_TRACE
41 EXTRA_CFLAGS += -DXFS_VNODE_TRACE
42endif
43
44xfs-$(CONFIG_XFS_QUOTA) += xfs_dquot.o \
45 xfs_dquot_item.o \
46 xfs_trans_dquot.o \
47 xfs_qm_syscalls.o \
48 xfs_qm_bhv.o \
49 xfs_qm.o
50
51ifeq ($(CONFIG_XFS_QUOTA),y)
52xfs-$(CONFIG_PROC_FS) += xfs_qm_stats.o
53endif
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index e2e8d35fa4d0..00b5043dfa5a 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -1,39 +1,25 @@
1/* 1/*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_trans.h" 23#include "xfs_trans.h"
38#include "xfs_sb.h" 24#include "xfs_sb.h"
39#include "xfs_ag.h" 25#include "xfs_ag.h"
@@ -43,18 +29,17 @@
43#include "xfs_dmapi.h" 29#include "xfs_dmapi.h"
44#include "xfs_quota.h" 30#include "xfs_quota.h"
45#include "xfs_mount.h" 31#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 32#include "xfs_bmap_btree.h"
33#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 34#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 35#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 36#include "xfs_dir2_sf.h"
37#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 38#include "xfs_dinode.h"
55#include "xfs_inode.h" 39#include "xfs_inode.h"
40#include "xfs_btree.h"
41#include "xfs_ialloc.h"
56#include "xfs_bmap.h" 42#include "xfs_bmap.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 43#include "xfs_rtalloc.h"
59#include "xfs_error.h" 44#include "xfs_error.h"
60#include "xfs_itable.h" 45#include "xfs_itable.h"
@@ -66,7 +51,6 @@
66#include "xfs_buf_item.h" 51#include "xfs_buf_item.h"
67#include "xfs_trans_space.h" 52#include "xfs_trans_space.h"
68#include "xfs_trans_priv.h" 53#include "xfs_trans_priv.h"
69
70#include "xfs_qm.h" 54#include "xfs_qm.h"
71 55
72 56
@@ -112,7 +96,7 @@ xfs_qm_dqinit(
112 96
113 brandnewdquot = xfs_qm_dqalloc_incore(&dqp); 97 brandnewdquot = xfs_qm_dqalloc_incore(&dqp);
114 dqp->dq_flags = type; 98 dqp->dq_flags = type;
115 INT_SET(dqp->q_core.d_id, ARCH_CONVERT, id); 99 dqp->q_core.d_id = cpu_to_be32(id);
116 dqp->q_mount = mp; 100 dqp->q_mount = mp;
117 101
118 /* 102 /*
@@ -194,10 +178,10 @@ xfs_qm_dqinit_core(
194 /* 178 /*
195 * Caller has zero'd the entire dquot 'chunk' already. 179 * Caller has zero'd the entire dquot 'chunk' already.
196 */ 180 */
197 INT_SET(d->dd_diskdq.d_magic, ARCH_CONVERT, XFS_DQUOT_MAGIC); 181 d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
198 INT_SET(d->dd_diskdq.d_version, ARCH_CONVERT, XFS_DQUOT_VERSION); 182 d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
199 INT_SET(d->dd_diskdq.d_id, ARCH_CONVERT, id); 183 d->dd_diskdq.d_id = cpu_to_be32(id);
200 INT_SET(d->dd_diskdq.d_flags, ARCH_CONVERT, type); 184 d->dd_diskdq.d_flags = type;
201} 185}
202 186
203 187
@@ -227,19 +211,13 @@ __xfs_dqtrace_entry(
227 (void *)(__psint_t)dqp->q_nrefs, 211 (void *)(__psint_t)dqp->q_nrefs,
228 (void *)(__psint_t)dqp->dq_flags, 212 (void *)(__psint_t)dqp->dq_flags,
229 (void *)(__psint_t)dqp->q_res_bcount, 213 (void *)(__psint_t)dqp->q_res_bcount,
230 (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount, 214 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_bcount),
231 ARCH_CONVERT), 215 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_icount),
232 (void *)(__psint_t)INT_GET(dqp->q_core.d_icount, 216 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_hardlimit),
233 ARCH_CONVERT), 217 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_softlimit),
234 (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit, 218 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_hardlimit),
235 ARCH_CONVERT), 219 (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_softlimit),
236 (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit, 220 (void *)(__psint_t)be32_to_cpu(dqp->q_core.d_id),
237 ARCH_CONVERT),
238 (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit,
239 ARCH_CONVERT),
240 (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit,
241 ARCH_CONVERT),
242 (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT),
243 (void *)(__psint_t)current_pid(), 221 (void *)(__psint_t)current_pid(),
244 (void *)(__psint_t)ino, 222 (void *)(__psint_t)ino,
245 (void *)(__psint_t)retaddr, 223 (void *)(__psint_t)retaddr,
@@ -264,17 +242,17 @@ xfs_qm_adjust_dqlimits(
264 ASSERT(d->d_id); 242 ASSERT(d->d_id);
265 243
266 if (q->qi_bsoftlimit && !d->d_blk_softlimit) 244 if (q->qi_bsoftlimit && !d->d_blk_softlimit)
267 INT_SET(d->d_blk_softlimit, ARCH_CONVERT, q->qi_bsoftlimit); 245 d->d_blk_softlimit = cpu_to_be64(q->qi_bsoftlimit);
268 if (q->qi_bhardlimit && !d->d_blk_hardlimit) 246 if (q->qi_bhardlimit && !d->d_blk_hardlimit)
269 INT_SET(d->d_blk_hardlimit, ARCH_CONVERT, q->qi_bhardlimit); 247 d->d_blk_hardlimit = cpu_to_be64(q->qi_bhardlimit);
270 if (q->qi_isoftlimit && !d->d_ino_softlimit) 248 if (q->qi_isoftlimit && !d->d_ino_softlimit)
271 INT_SET(d->d_ino_softlimit, ARCH_CONVERT, q->qi_isoftlimit); 249 d->d_ino_softlimit = cpu_to_be64(q->qi_isoftlimit);
272 if (q->qi_ihardlimit && !d->d_ino_hardlimit) 250 if (q->qi_ihardlimit && !d->d_ino_hardlimit)
273 INT_SET(d->d_ino_hardlimit, ARCH_CONVERT, q->qi_ihardlimit); 251 d->d_ino_hardlimit = cpu_to_be64(q->qi_ihardlimit);
274 if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit) 252 if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit)
275 INT_SET(d->d_rtb_softlimit, ARCH_CONVERT, q->qi_rtbsoftlimit); 253 d->d_rtb_softlimit = cpu_to_be64(q->qi_rtbsoftlimit);
276 if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit) 254 if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit)
277 INT_SET(d->d_rtb_hardlimit, ARCH_CONVERT, q->qi_rtbhardlimit); 255 d->d_rtb_hardlimit = cpu_to_be64(q->qi_rtbhardlimit);
278} 256}
279 257
280/* 258/*
@@ -298,81 +276,81 @@ xfs_qm_adjust_dqtimers(
298 ASSERT(d->d_id); 276 ASSERT(d->d_id);
299 277
300#ifdef QUOTADEBUG 278#ifdef QUOTADEBUG
301 if (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)) 279 if (d->d_blk_hardlimit)
302 ASSERT(INT_GET(d->d_blk_softlimit, ARCH_CONVERT) <= 280 ASSERT(be64_to_cpu(d->d_blk_softlimit) <=
303 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)); 281 be64_to_cpu(d->d_blk_hardlimit));
304 if (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)) 282 if (d->d_ino_hardlimit)
305 ASSERT(INT_GET(d->d_ino_softlimit, ARCH_CONVERT) <= 283 ASSERT(be64_to_cpu(d->d_ino_softlimit) <=
306 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)); 284 be64_to_cpu(d->d_ino_hardlimit));
307 if (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)) 285 if (d->d_rtb_hardlimit)
308 ASSERT(INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) <= 286 ASSERT(be64_to_cpu(d->d_rtb_softlimit) <=
309 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)); 287 be64_to_cpu(d->d_rtb_hardlimit));
310#endif 288#endif
311 if (!d->d_btimer) { 289 if (!d->d_btimer) {
312 if ((INT_GET(d->d_blk_softlimit, ARCH_CONVERT) && 290 if ((d->d_blk_softlimit &&
313 (INT_GET(d->d_bcount, ARCH_CONVERT) >= 291 (be64_to_cpu(d->d_bcount) >=
314 INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) || 292 be64_to_cpu(d->d_blk_softlimit))) ||
315 (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT) && 293 (d->d_blk_hardlimit &&
316 (INT_GET(d->d_bcount, ARCH_CONVERT) >= 294 (be64_to_cpu(d->d_bcount) >=
317 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { 295 be64_to_cpu(d->d_blk_hardlimit)))) {
318 INT_SET(d->d_btimer, ARCH_CONVERT, 296 d->d_btimer = cpu_to_be32(get_seconds() +
319 get_seconds() + XFS_QI_BTIMELIMIT(mp)); 297 XFS_QI_BTIMELIMIT(mp));
320 } else { 298 } else {
321 d->d_bwarns = 0; 299 d->d_bwarns = 0;
322 } 300 }
323 } else { 301 } else {
324 if ((!d->d_blk_softlimit || 302 if ((!d->d_blk_softlimit ||
325 (INT_GET(d->d_bcount, ARCH_CONVERT) < 303 (be64_to_cpu(d->d_bcount) <
326 INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) && 304 be64_to_cpu(d->d_blk_softlimit))) &&
327 (!d->d_blk_hardlimit || 305 (!d->d_blk_hardlimit ||
328 (INT_GET(d->d_bcount, ARCH_CONVERT) < 306 (be64_to_cpu(d->d_bcount) <
329 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { 307 be64_to_cpu(d->d_blk_hardlimit)))) {
330 d->d_btimer = 0; 308 d->d_btimer = 0;
331 } 309 }
332 } 310 }
333 311
334 if (!d->d_itimer) { 312 if (!d->d_itimer) {
335 if ((INT_GET(d->d_ino_softlimit, ARCH_CONVERT) && 313 if ((d->d_ino_softlimit &&
336 (INT_GET(d->d_icount, ARCH_CONVERT) >= 314 (be64_to_cpu(d->d_icount) >=
337 INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) || 315 be64_to_cpu(d->d_ino_softlimit))) ||
338 (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT) && 316 (d->d_ino_hardlimit &&
339 (INT_GET(d->d_icount, ARCH_CONVERT) >= 317 (be64_to_cpu(d->d_icount) >=
340 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { 318 be64_to_cpu(d->d_ino_hardlimit)))) {
341 INT_SET(d->d_itimer, ARCH_CONVERT, 319 d->d_itimer = cpu_to_be32(get_seconds() +
342 get_seconds() + XFS_QI_ITIMELIMIT(mp)); 320 XFS_QI_ITIMELIMIT(mp));
343 } else { 321 } else {
344 d->d_iwarns = 0; 322 d->d_iwarns = 0;
345 } 323 }
346 } else { 324 } else {
347 if ((!d->d_ino_softlimit || 325 if ((!d->d_ino_softlimit ||
348 (INT_GET(d->d_icount, ARCH_CONVERT) < 326 (be64_to_cpu(d->d_icount) <
349 INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) && 327 be64_to_cpu(d->d_ino_softlimit))) &&
350 (!d->d_ino_hardlimit || 328 (!d->d_ino_hardlimit ||
351 (INT_GET(d->d_icount, ARCH_CONVERT) < 329 (be64_to_cpu(d->d_icount) <
352 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { 330 be64_to_cpu(d->d_ino_hardlimit)))) {
353 d->d_itimer = 0; 331 d->d_itimer = 0;
354 } 332 }
355 } 333 }
356 334
357 if (!d->d_rtbtimer) { 335 if (!d->d_rtbtimer) {
358 if ((INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) && 336 if ((d->d_rtb_softlimit &&
359 (INT_GET(d->d_rtbcount, ARCH_CONVERT) >= 337 (be64_to_cpu(d->d_rtbcount) >=
360 INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) || 338 be64_to_cpu(d->d_rtb_softlimit))) ||
361 (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT) && 339 (d->d_rtb_hardlimit &&
362 (INT_GET(d->d_rtbcount, ARCH_CONVERT) >= 340 (be64_to_cpu(d->d_rtbcount) >=
363 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { 341 be64_to_cpu(d->d_rtb_hardlimit)))) {
364 INT_SET(d->d_rtbtimer, ARCH_CONVERT, 342 d->d_rtbtimer = cpu_to_be32(get_seconds() +
365 get_seconds() + XFS_QI_RTBTIMELIMIT(mp)); 343 XFS_QI_RTBTIMELIMIT(mp));
366 } else { 344 } else {
367 d->d_rtbwarns = 0; 345 d->d_rtbwarns = 0;
368 } 346 }
369 } else { 347 } else {
370 if ((!d->d_rtb_softlimit || 348 if ((!d->d_rtb_softlimit ||
371 (INT_GET(d->d_rtbcount, ARCH_CONVERT) < 349 (be64_to_cpu(d->d_rtbcount) <
372 INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) && 350 be64_to_cpu(d->d_rtb_softlimit))) &&
373 (!d->d_rtb_hardlimit || 351 (!d->d_rtb_hardlimit ||
374 (INT_GET(d->d_rtbcount, ARCH_CONVERT) < 352 (be64_to_cpu(d->d_rtbcount) <
375 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { 353 be64_to_cpu(d->d_rtb_hardlimit)))) {
376 d->d_rtbtimer = 0; 354 d->d_rtbtimer = 0;
377 } 355 }
378 } 356 }
@@ -490,7 +468,7 @@ xfs_qm_dqalloc(
490 * Make a chunk of dquots out of this buffer and log 468 * Make a chunk of dquots out of this buffer and log
491 * the entire thing. 469 * the entire thing.
492 */ 470 */
493 xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), 471 xfs_qm_init_dquot_blk(tp, mp, be32_to_cpu(dqp->q_core.d_id),
494 dqp->dq_flags & XFS_DQ_ALLTYPES, bp); 472 dqp->dq_flags & XFS_DQ_ALLTYPES, bp);
495 473
496 /* 474 /*
@@ -554,7 +532,7 @@ xfs_qm_dqtobp(
554 xfs_trans_t *tp = (tpp ? *tpp : NULL); 532 xfs_trans_t *tp = (tpp ? *tpp : NULL);
555 533
556 mp = dqp->q_mount; 534 mp = dqp->q_mount;
557 id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); 535 id = be32_to_cpu(dqp->q_core.d_id);
558 nmaps = 1; 536 nmaps = 1;
559 newdquot = B_FALSE; 537 newdquot = B_FALSE;
560 538
@@ -563,8 +541,7 @@ xfs_qm_dqtobp(
563 */ 541 */
564 if (dqp->q_blkno == (xfs_daddr_t) 0) { 542 if (dqp->q_blkno == (xfs_daddr_t) 0) {
565 /* We use the id as an index */ 543 /* We use the id as an index */
566 dqp->q_fileoffset = (xfs_fileoff_t) ((uint)id / 544 dqp->q_fileoffset = (xfs_fileoff_t)id / XFS_QM_DQPERBLK(mp);
567 XFS_QM_DQPERBLK(mp));
568 nmaps = 1; 545 nmaps = 1;
569 quotip = XFS_DQ_TO_QIP(dqp); 546 quotip = XFS_DQ_TO_QIP(dqp);
570 xfs_ilock(quotip, XFS_ILOCK_SHARED); 547 xfs_ilock(quotip, XFS_ILOCK_SHARED);
@@ -694,16 +671,16 @@ xfs_qm_dqread(
694 671
695 /* copy everything from disk dquot to the incore dquot */ 672 /* copy everything from disk dquot to the incore dquot */
696 memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); 673 memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t));
697 ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id); 674 ASSERT(be32_to_cpu(dqp->q_core.d_id) == id);
698 xfs_qm_dquot_logitem_init(dqp); 675 xfs_qm_dquot_logitem_init(dqp);
699 676
700 /* 677 /*
701 * Reservation counters are defined as reservation plus current usage 678 * Reservation counters are defined as reservation plus current usage
702 * to avoid having to add everytime. 679 * to avoid having to add everytime.
703 */ 680 */
704 dqp->q_res_bcount = INT_GET(ddqp->d_bcount, ARCH_CONVERT); 681 dqp->q_res_bcount = be64_to_cpu(ddqp->d_bcount);
705 dqp->q_res_icount = INT_GET(ddqp->d_icount, ARCH_CONVERT); 682 dqp->q_res_icount = be64_to_cpu(ddqp->d_icount);
706 dqp->q_res_rtbcount = INT_GET(ddqp->d_rtbcount, ARCH_CONVERT); 683 dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount);
707 684
708 /* Mark the buf so that this will stay incore a little longer */ 685 /* Mark the buf so that this will stay incore a little longer */
709 XFS_BUF_SET_VTYPE_REF(bp, B_FS_DQUOT, XFS_DQUOT_REF); 686 XFS_BUF_SET_VTYPE_REF(bp, B_FS_DQUOT, XFS_DQUOT_REF);
@@ -829,7 +806,7 @@ xfs_qm_dqlookup(
829 * dqlock to look at the id field of the dquot, since the 806 * dqlock to look at the id field of the dquot, since the
830 * id can't be modified without the hashlock anyway. 807 * id can't be modified without the hashlock anyway.
831 */ 808 */
832 if (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id && dqp->q_mount == mp) { 809 if (be32_to_cpu(dqp->q_core.d_id) == id && dqp->q_mount == mp) {
833 xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP"); 810 xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP");
834 /* 811 /*
835 * All in core dquots must be on the dqlist of mp 812 * All in core dquots must be on the dqlist of mp
@@ -860,7 +837,7 @@ xfs_qm_dqlookup(
860 * id couldn't have changed; we had the hashlock all 837 * id couldn't have changed; we had the hashlock all
861 * along 838 * along
862 */ 839 */
863 ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id); 840 ASSERT(be32_to_cpu(dqp->q_core.d_id) == id);
864 841
865 if (flist_locked) { 842 if (flist_locked) {
866 if (dqp->q_nrefs != 0) { 843 if (dqp->q_nrefs != 0) {
@@ -1282,7 +1259,7 @@ xfs_qm_dqflush(
1282 return (error); 1259 return (error);
1283 } 1260 }
1284 1261
1285 if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), 1262 if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id),
1286 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { 1263 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) {
1287 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); 1264 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE);
1288 return XFS_ERROR(EIO); 1265 return XFS_ERROR(EIO);
@@ -1435,8 +1412,8 @@ xfs_dqlock2(
1435{ 1412{
1436 if (d1 && d2) { 1413 if (d1 && d2) {
1437 ASSERT(d1 != d2); 1414 ASSERT(d1 != d2);
1438 if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > 1415 if (be32_to_cpu(d1->q_core.d_id) >
1439 INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { 1416 be32_to_cpu(d2->q_core.d_id)) {
1440 xfs_dqlock(d2); 1417 xfs_dqlock(d2);
1441 xfs_dqlock(d1); 1418 xfs_dqlock(d1);
1442 } else { 1419 } else {
@@ -1558,33 +1535,33 @@ xfs_qm_dqprint(xfs_dquot_t *dqp)
1558{ 1535{
1559 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); 1536 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------");
1560 cmn_err(CE_DEBUG, "---- dquotID = %d", 1537 cmn_err(CE_DEBUG, "---- dquotID = %d",
1561 (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 1538 (int)be32_to_cpu(dqp->q_core.d_id));
1562 cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); 1539 cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp));
1563 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); 1540 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount);
1564 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); 1541 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno);
1565 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); 1542 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset);
1566 cmn_err(CE_DEBUG, "---- blkhlimit = %Lu (0x%x)", 1543 cmn_err(CE_DEBUG, "---- blkhlimit = %Lu (0x%x)",
1567 INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT), 1544 be64_to_cpu(dqp->q_core.d_blk_hardlimit),
1568 (int) INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT)); 1545 (int)be64_to_cpu(dqp->q_core.d_blk_hardlimit));
1569 cmn_err(CE_DEBUG, "---- blkslimit = %Lu (0x%x)", 1546 cmn_err(CE_DEBUG, "---- blkslimit = %Lu (0x%x)",
1570 INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT), 1547 be64_to_cpu(dqp->q_core.d_blk_softlimit),
1571 (int)INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)); 1548 (int)be64_to_cpu(dqp->q_core.d_blk_softlimit));
1572 cmn_err(CE_DEBUG, "---- inohlimit = %Lu (0x%x)", 1549 cmn_err(CE_DEBUG, "---- inohlimit = %Lu (0x%x)",
1573 INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT), 1550 be64_to_cpu(dqp->q_core.d_ino_hardlimit),
1574 (int)INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT)); 1551 (int)be64_to_cpu(dqp->q_core.d_ino_hardlimit));
1575 cmn_err(CE_DEBUG, "---- inoslimit = %Lu (0x%x)", 1552 cmn_err(CE_DEBUG, "---- inoslimit = %Lu (0x%x)",
1576 INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT), 1553 be64_to_cpu(dqp->q_core.d_ino_softlimit),
1577 (int)INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)); 1554 (int)be64_to_cpu(dqp->q_core.d_ino_softlimit));
1578 cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", 1555 cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)",
1579 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), 1556 be64_to_cpu(dqp->q_core.d_bcount),
1580 (int)INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 1557 (int)be64_to_cpu(dqp->q_core.d_bcount));
1581 cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)", 1558 cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)",
1582 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), 1559 be64_to_cpu(dqp->q_core.d_icount),
1583 (int)INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); 1560 (int)be64_to_cpu(dqp->q_core.d_icount));
1584 cmn_err(CE_DEBUG, "---- btimer = %d", 1561 cmn_err(CE_DEBUG, "---- btimer = %d",
1585 (int)INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT)); 1562 (int)be32_to_cpu(dqp->q_core.d_btimer));
1586 cmn_err(CE_DEBUG, "---- itimer = %d", 1563 cmn_err(CE_DEBUG, "---- itimer = %d",
1587 (int)INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT)); 1564 (int)be32_to_cpu(dqp->q_core.d_itimer));
1588 cmn_err(CE_DEBUG, "---------------------------"); 1565 cmn_err(CE_DEBUG, "---------------------------");
1589} 1566}
1590#endif 1567#endif
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h
index 8ebc87176c78..c0c629663a5c 100644
--- a/fs/xfs/quota/xfs_dquot.h
+++ b/fs/xfs/quota/xfs_dquot.h
@@ -1,33 +1,19 @@
1/* 1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32#ifndef __XFS_DQUOT_H__ 18#ifndef __XFS_DQUOT_H__
33#define __XFS_DQUOT_H__ 19#define __XFS_DQUOT_H__
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c
index e74eaa7dd1bc..2f69822344e5 100644
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -1,39 +1,25 @@
1/* 1/*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_trans.h" 23#include "xfs_trans.h"
38#include "xfs_sb.h" 24#include "xfs_sb.h"
39#include "xfs_ag.h" 25#include "xfs_ag.h"
@@ -43,18 +29,17 @@
43#include "xfs_dmapi.h" 29#include "xfs_dmapi.h"
44#include "xfs_quota.h" 30#include "xfs_quota.h"
45#include "xfs_mount.h" 31#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 32#include "xfs_bmap_btree.h"
33#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 34#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 35#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 36#include "xfs_dir2_sf.h"
37#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 38#include "xfs_dinode.h"
55#include "xfs_inode.h" 39#include "xfs_inode.h"
56#include "xfs_bmap.h" 40#include "xfs_bmap.h"
57#include "xfs_bit.h" 41#include "xfs_btree.h"
42#include "xfs_ialloc.h"
58#include "xfs_rtalloc.h" 43#include "xfs_rtalloc.h"
59#include "xfs_error.h" 44#include "xfs_error.h"
60#include "xfs_itable.h" 45#include "xfs_itable.h"
@@ -65,10 +50,8 @@
65#include "xfs_attr.h" 50#include "xfs_attr.h"
66#include "xfs_buf_item.h" 51#include "xfs_buf_item.h"
67#include "xfs_trans_priv.h" 52#include "xfs_trans_priv.h"
68
69#include "xfs_qm.h" 53#include "xfs_qm.h"
70 54
71
72/* 55/*
73 * returns the number of iovecs needed to log the given dquot item. 56 * returns the number of iovecs needed to log the given dquot item.
74 */ 57 */
@@ -467,7 +450,7 @@ xfs_qm_dquot_logitem_init(
467 lp->qli_item.li_mountp = dqp->q_mount; 450 lp->qli_item.li_mountp = dqp->q_mount;
468 lp->qli_dquot = dqp; 451 lp->qli_dquot = dqp;
469 lp->qli_format.qlf_type = XFS_LI_DQUOT; 452 lp->qli_format.qlf_type = XFS_LI_DQUOT;
470 lp->qli_format.qlf_id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); 453 lp->qli_format.qlf_id = be32_to_cpu(dqp->q_core.d_id);
471 lp->qli_format.qlf_blkno = dqp->q_blkno; 454 lp->qli_format.qlf_blkno = dqp->q_blkno;
472 lp->qli_format.qlf_len = 1; 455 lp->qli_format.qlf_len = 1;
473 /* 456 /*
diff --git a/fs/xfs/quota/xfs_dquot_item.h b/fs/xfs/quota/xfs_dquot_item.h
index 9c6500dabcaa..5a632531f843 100644
--- a/fs/xfs/quota/xfs_dquot_item.h
+++ b/fs/xfs/quota/xfs_dquot_item.h
@@ -1,33 +1,19 @@
1/* 1/*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32#ifndef __XFS_DQUOT_ITEM_H__ 18#ifndef __XFS_DQUOT_ITEM_H__
33#define __XFS_DQUOT_ITEM_H__ 19#define __XFS_DQUOT_ITEM_H__
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index efde16e0a913..1aea42d71a64 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1,39 +1,25 @@
1/* 1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_clnt.h" 23#include "xfs_clnt.h"
38#include "xfs_trans.h" 24#include "xfs_trans.h"
39#include "xfs_sb.h" 25#include "xfs_sb.h"
@@ -44,21 +30,20 @@
44#include "xfs_dmapi.h" 30#include "xfs_dmapi.h"
45#include "xfs_quota.h" 31#include "xfs_quota.h"
46#include "xfs_mount.h" 32#include "xfs_mount.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_bmap_btree.h" 33#include "xfs_bmap_btree.h"
34#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 35#include "xfs_ialloc_btree.h"
50#include "xfs_btree.h"
51#include "xfs_ialloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 36#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 37#include "xfs_dir2_sf.h"
38#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 39#include "xfs_dinode.h"
56#include "xfs_inode.h" 40#include "xfs_inode.h"
57#include "xfs_bmap.h" 41#include "xfs_btree.h"
58#include "xfs_bit.h" 42#include "xfs_ialloc.h"
43#include "xfs_itable.h"
59#include "xfs_rtalloc.h" 44#include "xfs_rtalloc.h"
60#include "xfs_error.h" 45#include "xfs_error.h"
61#include "xfs_itable.h" 46#include "xfs_bmap.h"
62#include "xfs_rw.h" 47#include "xfs_rw.h"
63#include "xfs_acl.h" 48#include "xfs_acl.h"
64#include "xfs_cap.h" 49#include "xfs_cap.h"
@@ -67,7 +52,6 @@
67#include "xfs_buf_item.h" 52#include "xfs_buf_item.h"
68#include "xfs_trans_space.h" 53#include "xfs_trans_space.h"
69#include "xfs_utils.h" 54#include "xfs_utils.h"
70
71#include "xfs_qm.h" 55#include "xfs_qm.h"
72 56
73/* 57/*
@@ -76,8 +60,9 @@
76 * quota functionality, including maintaining the freelist and hash 60 * quota functionality, including maintaining the freelist and hash
77 * tables of dquots. 61 * tables of dquots.
78 */ 62 */
79mutex_t xfs_Gqm_lock; 63mutex_t xfs_Gqm_lock;
80struct xfs_qm *xfs_Gqm; 64struct xfs_qm *xfs_Gqm;
65uint ndquot;
81 66
82kmem_zone_t *qm_dqzone; 67kmem_zone_t *qm_dqzone;
83kmem_zone_t *qm_dqtrxzone; 68kmem_zone_t *qm_dqtrxzone;
@@ -107,10 +92,10 @@ extern mutex_t qcheck_lock;
107 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \ 92 for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \
108 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \ 93 cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \
109 "bcnt = %d, icnt = %d, refs = %d", \ 94 "bcnt = %d, icnt = %d, refs = %d", \
110 ++i, (int) INT_GET(dqp->q_core.d_id, ARCH_CONVERT), \ 95 ++i, (int) be32_to_cpu(dqp->q_core.d_id), \
111 DQFLAGTO_TYPESTR(dqp), \ 96 DQFLAGTO_TYPESTR(dqp), \
112 (int) INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), \ 97 (int) be64_to_cpu(dqp->q_core.d_bcount), \
113 (int) INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), \ 98 (int) be64_to_cpu(dqp->q_core.d_icount), \
114 (int) dqp->q_nrefs); } \ 99 (int) dqp->q_nrefs); } \
115} 100}
116#else 101#else
@@ -124,25 +109,25 @@ extern mutex_t qcheck_lock;
124STATIC struct xfs_qm * 109STATIC struct xfs_qm *
125xfs_Gqm_init(void) 110xfs_Gqm_init(void)
126{ 111{
127 xfs_qm_t *xqm; 112 xfs_dqhash_t *udqhash, *gdqhash;
128 int hsize, i; 113 xfs_qm_t *xqm;
129 114 uint i, hsize, flags = KM_SLEEP | KM_MAYFAIL;
130 xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP);
131 ASSERT(xqm);
132 115
133 /* 116 /*
134 * Initialize the dquot hash tables. 117 * Initialize the dquot hash tables.
135 */ 118 */
136 hsize = (DQUOT_HASH_HEURISTIC < XFS_QM_NCSIZE_THRESHOLD) ? 119 hsize = XFS_QM_HASHSIZE_HIGH;
137 XFS_QM_HASHSIZE_LOW : XFS_QM_HASHSIZE_HIGH; 120 while (!(udqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), flags))) {
138 xqm->qm_dqhashmask = hsize - 1; 121 if ((hsize >>= 1) <= XFS_QM_HASHSIZE_LOW)
122 flags = KM_SLEEP;
123 }
124 gdqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), KM_SLEEP);
125 ndquot = hsize << 8;
139 126
140 xqm->qm_usr_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * 127 xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP);
141 sizeof(xfs_dqhash_t), 128 xqm->qm_dqhashmask = hsize - 1;
142 KM_SLEEP); 129 xqm->qm_usr_dqhtable = udqhash;
143 xqm->qm_grp_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * 130 xqm->qm_grp_dqhtable = gdqhash;
144 sizeof(xfs_dqhash_t),
145 KM_SLEEP);
146 ASSERT(xqm->qm_usr_dqhtable != NULL); 131 ASSERT(xqm->qm_usr_dqhtable != NULL);
147 ASSERT(xqm->qm_grp_dqhtable != NULL); 132 ASSERT(xqm->qm_grp_dqhtable != NULL);
148 133
@@ -743,7 +728,7 @@ xfs_qm_dqattach_one(
743 */ 728 */
744 if (udqhint && 729 if (udqhint &&
745 (dqp = udqhint->q_gdquot) && 730 (dqp = udqhint->q_gdquot) &&
746 (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id)) { 731 (be32_to_cpu(dqp->q_core.d_id) == id)) {
747 ASSERT(XFS_DQ_IS_LOCKED(udqhint)); 732 ASSERT(XFS_DQ_IS_LOCKED(udqhint));
748 xfs_dqlock(dqp); 733 xfs_dqlock(dqp);
749 XFS_DQHOLD(dqp); 734 XFS_DQHOLD(dqp);
@@ -1213,42 +1198,24 @@ xfs_qm_init_quotainfo(
1213 * a user or group before he or she can not perform any 1198 * a user or group before he or she can not perform any
1214 * more writing. If it is zero, a default is used. 1199 * more writing. If it is zero, a default is used.
1215 */ 1200 */
1216 qinf->qi_btimelimit = 1201 qinf->qi_btimelimit = ddqp->d_btimer ?
1217 INT_GET(ddqp->d_btimer, ARCH_CONVERT) ? 1202 be32_to_cpu(ddqp->d_btimer) : XFS_QM_BTIMELIMIT;
1218 INT_GET(ddqp->d_btimer, ARCH_CONVERT) : 1203 qinf->qi_itimelimit = ddqp->d_itimer ?
1219 XFS_QM_BTIMELIMIT; 1204 be32_to_cpu(ddqp->d_itimer) : XFS_QM_ITIMELIMIT;
1220 qinf->qi_itimelimit = 1205 qinf->qi_rtbtimelimit = ddqp->d_rtbtimer ?
1221 INT_GET(ddqp->d_itimer, ARCH_CONVERT) ? 1206 be32_to_cpu(ddqp->d_rtbtimer) : XFS_QM_RTBTIMELIMIT;
1222 INT_GET(ddqp->d_itimer, ARCH_CONVERT) : 1207 qinf->qi_bwarnlimit = ddqp->d_bwarns ?
1223 XFS_QM_ITIMELIMIT; 1208 be16_to_cpu(ddqp->d_bwarns) : XFS_QM_BWARNLIMIT;
1224 qinf->qi_rtbtimelimit = 1209 qinf->qi_iwarnlimit = ddqp->d_iwarns ?
1225 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) ? 1210 be16_to_cpu(ddqp->d_iwarns) : XFS_QM_IWARNLIMIT;
1226 INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) : 1211 qinf->qi_rtbwarnlimit = ddqp->d_rtbwarns ?
1227 XFS_QM_RTBTIMELIMIT; 1212 be16_to_cpu(ddqp->d_rtbwarns) : XFS_QM_RTBWARNLIMIT;
1228 qinf->qi_bwarnlimit = 1213 qinf->qi_bhardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
1229 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) ? 1214 qinf->qi_bsoftlimit = be64_to_cpu(ddqp->d_blk_softlimit);
1230 INT_GET(ddqp->d_bwarns, ARCH_CONVERT) : 1215 qinf->qi_ihardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
1231 XFS_QM_BWARNLIMIT; 1216 qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit);
1232 qinf->qi_iwarnlimit = 1217 qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
1233 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? 1218 qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
1234 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
1235 XFS_QM_IWARNLIMIT;
1236 qinf->qi_rtbwarnlimit =
1237 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
1238 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
1239 XFS_QM_RTBWARNLIMIT;
1240 qinf->qi_bhardlimit =
1241 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
1242 qinf->qi_bsoftlimit =
1243 INT_GET(ddqp->d_blk_softlimit, ARCH_CONVERT);
1244 qinf->qi_ihardlimit =
1245 INT_GET(ddqp->d_ino_hardlimit, ARCH_CONVERT);
1246 qinf->qi_isoftlimit =
1247 INT_GET(ddqp->d_ino_softlimit, ARCH_CONVERT);
1248 qinf->qi_rtbhardlimit =
1249 INT_GET(ddqp->d_rtb_hardlimit, ARCH_CONVERT);
1250 qinf->qi_rtbsoftlimit =
1251 INT_GET(ddqp->d_rtb_softlimit, ARCH_CONVERT);
1252 1219
1253 /* 1220 /*
1254 * We sent the XFS_QMOPT_DQSUSER flag to dqget because 1221 * We sent the XFS_QMOPT_DQSUSER flag to dqget because
@@ -1527,15 +1494,15 @@ xfs_qm_reset_dqcounts(
1527 */ 1494 */
1528 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, 1495 (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR,
1529 "xfs_quotacheck"); 1496 "xfs_quotacheck");
1530 INT_SET(ddq->d_bcount, ARCH_CONVERT, 0ULL); 1497 ddq->d_bcount = 0;
1531 INT_SET(ddq->d_icount, ARCH_CONVERT, 0ULL); 1498 ddq->d_icount = 0;
1532 INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL); 1499 ddq->d_rtbcount = 0;
1533 INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0); 1500 ddq->d_btimer = 0;
1534 INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0); 1501 ddq->d_itimer = 0;
1535 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0); 1502 ddq->d_rtbtimer = 0;
1536 INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL); 1503 ddq->d_bwarns = 0;
1537 INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL); 1504 ddq->d_iwarns = 0;
1538 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL); 1505 ddq->d_rtbwarns = 0;
1539 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); 1506 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1);
1540 } 1507 }
1541 1508
@@ -1708,14 +1675,14 @@ xfs_qm_quotacheck_dqadjust(
1708 * Adjust the inode count and the block count to reflect this inode's 1675 * Adjust the inode count and the block count to reflect this inode's
1709 * resource usage. 1676 * resource usage.
1710 */ 1677 */
1711 INT_MOD(dqp->q_core.d_icount, ARCH_CONVERT, +1); 1678 be64_add(&dqp->q_core.d_icount, 1);
1712 dqp->q_res_icount++; 1679 dqp->q_res_icount++;
1713 if (nblks) { 1680 if (nblks) {
1714 INT_MOD(dqp->q_core.d_bcount, ARCH_CONVERT, nblks); 1681 be64_add(&dqp->q_core.d_bcount, nblks);
1715 dqp->q_res_bcount += nblks; 1682 dqp->q_res_bcount += nblks;
1716 } 1683 }
1717 if (rtblks) { 1684 if (rtblks) {
1718 INT_MOD(dqp->q_core.d_rtbcount, ARCH_CONVERT, rtblks); 1685 be64_add(&dqp->q_core.d_rtbcount, rtblks);
1719 dqp->q_res_rtbcount += rtblks; 1686 dqp->q_res_rtbcount += rtblks;
1720 } 1687 }
1721 1688
@@ -2202,7 +2169,7 @@ xfs_qm_shake_freelist(
2202 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING"); 2169 xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING");
2203#ifdef QUOTADEBUG 2170#ifdef QUOTADEBUG
2204 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n", 2171 cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n",
2205 dqp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 2172 dqp, be32_to_cpu(dqp->q_core.d_id));
2206#endif 2173#endif
2207 ASSERT(dqp->q_nrefs == 0); 2174 ASSERT(dqp->q_nrefs == 0);
2208 nextdqp = dqp->dq_flnext; 2175 nextdqp = dqp->dq_flnext;
@@ -2670,7 +2637,7 @@ xfs_qm_vop_chown_reserve(
2670 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; 2637 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
2671 2638
2672 if (XFS_IS_UQUOTA_ON(mp) && udqp && 2639 if (XFS_IS_UQUOTA_ON(mp) && udqp &&
2673 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { 2640 ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) {
2674 delblksudq = udqp; 2641 delblksudq = udqp;
2675 /* 2642 /*
2676 * If there are delayed allocation blocks, then we have to 2643 * If there are delayed allocation blocks, then we have to
@@ -2683,10 +2650,10 @@ xfs_qm_vop_chown_reserve(
2683 } 2650 }
2684 } 2651 }
2685 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { 2652 if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) {
2686 if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid != 2653 if ((XFS_IS_GQUOTA_ON(ip->i_mount) &&
2687 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) || 2654 ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id)) ||
2688 (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid != 2655 (XFS_IS_PQUOTA_ON(ip->i_mount) &&
2689 INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) { 2656 ip->i_d.di_projid != be32_to_cpu(gdqp->q_core.d_id))) {
2690 delblksgdq = gdqp; 2657 delblksgdq = gdqp;
2691 if (delblks) { 2658 if (delblks) {
2692 ASSERT(ip->i_gdquot); 2659 ASSERT(ip->i_gdquot);
@@ -2776,7 +2743,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2776 xfs_dqunlock(udqp); 2743 xfs_dqunlock(udqp);
2777 ASSERT(ip->i_udquot == NULL); 2744 ASSERT(ip->i_udquot == NULL);
2778 ip->i_udquot = udqp; 2745 ip->i_udquot = udqp;
2779 ASSERT(ip->i_d.di_uid == INT_GET(udqp->q_core.d_id, ARCH_CONVERT)); 2746 ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
2780 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); 2747 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
2781 } 2748 }
2782 if (gdqp) { 2749 if (gdqp) {
@@ -2785,7 +2752,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode(
2785 xfs_dqunlock(gdqp); 2752 xfs_dqunlock(gdqp);
2786 ASSERT(ip->i_gdquot == NULL); 2753 ASSERT(ip->i_gdquot == NULL);
2787 ip->i_gdquot = gdqp; 2754 ip->i_gdquot = gdqp;
2788 ASSERT(ip->i_d.di_gid == INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)); 2755 ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
2789 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); 2756 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
2790 } 2757 }
2791} 2758}
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h
index 0b00b3c67015..12da259f2fcb 100644
--- a/fs/xfs/quota/xfs_qm.h
+++ b/fs/xfs/quota/xfs_qm.h
@@ -1,33 +1,19 @@
1/* 1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32#ifndef __XFS_QM_H__ 18#ifndef __XFS_QM_H__
33#define __XFS_QM_H__ 19#define __XFS_QM_H__
@@ -40,6 +26,7 @@
40struct xfs_qm; 26struct xfs_qm;
41struct xfs_inode; 27struct xfs_inode;
42 28
29extern uint ndquot;
43extern mutex_t xfs_Gqm_lock; 30extern mutex_t xfs_Gqm_lock;
44extern struct xfs_qm *xfs_Gqm; 31extern struct xfs_qm *xfs_Gqm;
45extern kmem_zone_t *qm_dqzone; 32extern kmem_zone_t *qm_dqzone;
@@ -65,9 +52,8 @@ extern kmem_zone_t *qm_dqtrxzone;
65/* 52/*
66 * Dquot hashtable constants/threshold values. 53 * Dquot hashtable constants/threshold values.
67 */ 54 */
68#define XFS_QM_NCSIZE_THRESHOLD 5000 55#define XFS_QM_HASHSIZE_LOW (NBPP / sizeof(xfs_dqhash_t))
69#define XFS_QM_HASHSIZE_LOW 32 56#define XFS_QM_HASHSIZE_HIGH ((NBPP * 4) / sizeof(xfs_dqhash_t))
70#define XFS_QM_HASHSIZE_HIGH 64
71 57
72/* 58/*
73 * We output a cmn_err when quotachecking a quota file with more than 59 * We output a cmn_err when quotachecking a quota file with more than
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c
index 8890a18a99d8..d9d2993de435 100644
--- a/fs/xfs/quota/xfs_qm_bhv.c
+++ b/fs/xfs/quota/xfs_qm_bhv.c
@@ -1,70 +1,55 @@
1/* 1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_clnt.h" 23#include "xfs_clnt.h"
38#include "xfs_trans.h" 24#include "xfs_trans.h"
39#include "xfs_sb.h" 25#include "xfs_sb.h"
26#include "xfs_ag.h"
40#include "xfs_dir.h" 27#include "xfs_dir.h"
41#include "xfs_dir2.h" 28#include "xfs_dir2.h"
42#include "xfs_alloc.h" 29#include "xfs_alloc.h"
43#include "xfs_dmapi.h" 30#include "xfs_dmapi.h"
44#include "xfs_quota.h" 31#include "xfs_quota.h"
45#include "xfs_mount.h" 32#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 33#include "xfs_bmap_btree.h"
34#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 35#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 36#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 37#include "xfs_dir2_sf.h"
38#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 39#include "xfs_dinode.h"
55#include "xfs_inode.h" 40#include "xfs_inode.h"
41#include "xfs_ialloc.h"
42#include "xfs_itable.h"
43#include "xfs_btree.h"
56#include "xfs_bmap.h" 44#include "xfs_bmap.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 45#include "xfs_rtalloc.h"
59#include "xfs_error.h" 46#include "xfs_error.h"
60#include "xfs_itable.h"
61#include "xfs_rw.h" 47#include "xfs_rw.h"
62#include "xfs_acl.h" 48#include "xfs_acl.h"
63#include "xfs_cap.h" 49#include "xfs_cap.h"
64#include "xfs_mac.h" 50#include "xfs_mac.h"
65#include "xfs_attr.h" 51#include "xfs_attr.h"
66#include "xfs_buf_item.h" 52#include "xfs_buf_item.h"
67
68#include "xfs_qm.h" 53#include "xfs_qm.h"
69 54
70#define MNTOPT_QUOTA "quota" /* disk quotas (user) */ 55#define MNTOPT_QUOTA "quota" /* disk quotas (user) */
diff --git a/fs/xfs/quota/xfs_qm_stats.c b/fs/xfs/quota/xfs_qm_stats.c
index 29978e037fee..0570f7733550 100644
--- a/fs/xfs/quota/xfs_qm_stats.c
+++ b/fs/xfs/quota/xfs_qm_stats.c
@@ -1,69 +1,54 @@
1/* 1/*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_trans.h" 23#include "xfs_trans.h"
38#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
39#include "xfs_dir.h" 26#include "xfs_dir.h"
40#include "xfs_dir2.h" 27#include "xfs_dir2.h"
41#include "xfs_alloc.h" 28#include "xfs_alloc.h"
42#include "xfs_dmapi.h" 29#include "xfs_dmapi.h"
43#include "xfs_quota.h" 30#include "xfs_quota.h"
44#include "xfs_mount.h" 31#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 32#include "xfs_bmap_btree.h"
33#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 34#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_ialloc.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 35#include "xfs_dir_sf.h"
52#include "xfs_dir2_sf.h" 36#include "xfs_dir2_sf.h"
37#include "xfs_attr_sf.h"
53#include "xfs_dinode.h" 38#include "xfs_dinode.h"
54#include "xfs_inode.h" 39#include "xfs_inode.h"
40#include "xfs_ialloc.h"
41#include "xfs_itable.h"
55#include "xfs_bmap.h" 42#include "xfs_bmap.h"
56#include "xfs_bit.h" 43#include "xfs_btree.h"
57#include "xfs_rtalloc.h" 44#include "xfs_rtalloc.h"
58#include "xfs_error.h" 45#include "xfs_error.h"
59#include "xfs_itable.h"
60#include "xfs_rw.h" 46#include "xfs_rw.h"
61#include "xfs_acl.h" 47#include "xfs_acl.h"
62#include "xfs_cap.h" 48#include "xfs_cap.h"
63#include "xfs_mac.h" 49#include "xfs_mac.h"
64#include "xfs_attr.h" 50#include "xfs_attr.h"
65#include "xfs_buf_item.h" 51#include "xfs_buf_item.h"
66
67#include "xfs_qm.h" 52#include "xfs_qm.h"
68 53
69struct xqmstats xqmstats; 54struct xqmstats xqmstats;
diff --git a/fs/xfs/quota/xfs_qm_stats.h b/fs/xfs/quota/xfs_qm_stats.h
index 8093c5c284ec..a50ffabcf554 100644
--- a/fs/xfs/quota/xfs_qm_stats.h
+++ b/fs/xfs/quota/xfs_qm_stats.h
@@ -1,38 +1,23 @@
1/* 1/*
2 * Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2002 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32#ifndef __XFS_QM_STATS_H__ 18#ifndef __XFS_QM_STATS_H__
33#define __XFS_QM_STATS_H__ 19#define __XFS_QM_STATS_H__
34 20
35
36#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF) 21#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
37 22
38/* 23/*
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 15e02e8a9d4f..24690e1af659 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -1,62 +1,48 @@
1/* 1/*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_trans.h" 23#include "xfs_trans.h"
38#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
39#include "xfs_dir.h" 26#include "xfs_dir.h"
40#include "xfs_dir2.h" 27#include "xfs_dir2.h"
41#include "xfs_alloc.h" 28#include "xfs_alloc.h"
42#include "xfs_dmapi.h" 29#include "xfs_dmapi.h"
43#include "xfs_quota.h" 30#include "xfs_quota.h"
44#include "xfs_mount.h" 31#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 32#include "xfs_bmap_btree.h"
33#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 34#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_ialloc.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 35#include "xfs_dir_sf.h"
52#include "xfs_dir2_sf.h" 36#include "xfs_dir2_sf.h"
37#include "xfs_attr_sf.h"
53#include "xfs_dinode.h" 38#include "xfs_dinode.h"
54#include "xfs_inode.h" 39#include "xfs_inode.h"
40#include "xfs_ialloc.h"
41#include "xfs_itable.h"
55#include "xfs_bmap.h" 42#include "xfs_bmap.h"
56#include "xfs_bit.h" 43#include "xfs_btree.h"
57#include "xfs_rtalloc.h" 44#include "xfs_rtalloc.h"
58#include "xfs_error.h" 45#include "xfs_error.h"
59#include "xfs_itable.h"
60#include "xfs_rw.h" 46#include "xfs_rw.h"
61#include "xfs_acl.h" 47#include "xfs_acl.h"
62#include "xfs_cap.h" 48#include "xfs_cap.h"
@@ -64,7 +50,6 @@
64#include "xfs_attr.h" 50#include "xfs_attr.h"
65#include "xfs_buf_item.h" 51#include "xfs_buf_item.h"
66#include "xfs_utils.h" 52#include "xfs_utils.h"
67
68#include "xfs_qm.h" 53#include "xfs_qm.h"
69 54
70#ifdef DEBUG 55#ifdef DEBUG
@@ -109,10 +94,7 @@ xfs_qm_quotactl(
109 vfsp = bhvtovfs(bdp); 94 vfsp = bhvtovfs(bdp);
110 mp = XFS_VFSTOM(vfsp); 95 mp = XFS_VFSTOM(vfsp);
111 96
112 if (addr == NULL && cmd != Q_SYNC) 97 ASSERT(addr != NULL || cmd == Q_XQUOTASYNC);
113 return XFS_ERROR(EINVAL);
114 if (id < 0 && cmd != Q_SYNC)
115 return XFS_ERROR(EINVAL);
116 98
117 /* 99 /*
118 * The following commands are valid even when quotaoff. 100 * The following commands are valid even when quotaoff.
@@ -122,7 +104,7 @@ xfs_qm_quotactl(
122 /* 104 /*
123 * Truncate quota files. quota must be off. 105 * Truncate quota files. quota must be off.
124 */ 106 */
125 if (XFS_IS_QUOTA_ON(mp) || addr == NULL) 107 if (XFS_IS_QUOTA_ON(mp))
126 return XFS_ERROR(EINVAL); 108 return XFS_ERROR(EINVAL);
127 if (vfsp->vfs_flag & VFS_RDONLY) 109 if (vfsp->vfs_flag & VFS_RDONLY)
128 return XFS_ERROR(EROFS); 110 return XFS_ERROR(EROFS);
@@ -140,8 +122,6 @@ xfs_qm_quotactl(
140 * QUOTAON - enabling quota enforcement. 122 * QUOTAON - enabling quota enforcement.
141 * Quota accounting must be turned on at mount time. 123 * Quota accounting must be turned on at mount time.
142 */ 124 */
143 if (addr == NULL)
144 return XFS_ERROR(EINVAL);
145 if (vfsp->vfs_flag & VFS_RDONLY) 125 if (vfsp->vfs_flag & VFS_RDONLY)
146 return XFS_ERROR(EROFS); 126 return XFS_ERROR(EROFS);
147 return (xfs_qm_scall_quotaon(mp, 127 return (xfs_qm_scall_quotaon(mp,
@@ -152,6 +132,9 @@ xfs_qm_quotactl(
152 return XFS_ERROR(EROFS); 132 return XFS_ERROR(EROFS);
153 break; 133 break;
154 134
135 case Q_XQUOTASYNC:
136 return (xfs_sync_inodes(mp, SYNC_DELWRI, 0, NULL));
137
155 default: 138 default:
156 break; 139 break;
157 } 140 }
@@ -655,13 +638,13 @@ xfs_qm_scall_setqlim(
655 */ 638 */
656 hard = (newlim->d_fieldmask & FS_DQ_BHARD) ? 639 hard = (newlim->d_fieldmask & FS_DQ_BHARD) ?
657 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) : 640 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) :
658 INT_GET(ddq->d_blk_hardlimit, ARCH_CONVERT); 641 be64_to_cpu(ddq->d_blk_hardlimit);
659 soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ? 642 soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ?
660 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) : 643 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) :
661 INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT); 644 be64_to_cpu(ddq->d_blk_softlimit);
662 if (hard == 0 || hard >= soft) { 645 if (hard == 0 || hard >= soft) {
663 INT_SET(ddq->d_blk_hardlimit, ARCH_CONVERT, hard); 646 ddq->d_blk_hardlimit = cpu_to_be64(hard);
664 INT_SET(ddq->d_blk_softlimit, ARCH_CONVERT, soft); 647 ddq->d_blk_softlimit = cpu_to_be64(soft);
665 if (id == 0) { 648 if (id == 0) {
666 mp->m_quotainfo->qi_bhardlimit = hard; 649 mp->m_quotainfo->qi_bhardlimit = hard;
667 mp->m_quotainfo->qi_bsoftlimit = soft; 650 mp->m_quotainfo->qi_bsoftlimit = soft;
@@ -671,13 +654,13 @@ xfs_qm_scall_setqlim(
671 } 654 }
672 hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ? 655 hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ?
673 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) : 656 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) :
674 INT_GET(ddq->d_rtb_hardlimit, ARCH_CONVERT); 657 be64_to_cpu(ddq->d_rtb_hardlimit);
675 soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ? 658 soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ?
676 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) : 659 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) :
677 INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT); 660 be64_to_cpu(ddq->d_rtb_softlimit);
678 if (hard == 0 || hard >= soft) { 661 if (hard == 0 || hard >= soft) {
679 INT_SET(ddq->d_rtb_hardlimit, ARCH_CONVERT, hard); 662 ddq->d_rtb_hardlimit = cpu_to_be64(hard);
680 INT_SET(ddq->d_rtb_softlimit, ARCH_CONVERT, soft); 663 ddq->d_rtb_softlimit = cpu_to_be64(soft);
681 if (id == 0) { 664 if (id == 0) {
682 mp->m_quotainfo->qi_rtbhardlimit = hard; 665 mp->m_quotainfo->qi_rtbhardlimit = hard;
683 mp->m_quotainfo->qi_rtbsoftlimit = soft; 666 mp->m_quotainfo->qi_rtbsoftlimit = soft;
@@ -688,13 +671,13 @@ xfs_qm_scall_setqlim(
688 671
689 hard = (newlim->d_fieldmask & FS_DQ_IHARD) ? 672 hard = (newlim->d_fieldmask & FS_DQ_IHARD) ?
690 (xfs_qcnt_t) newlim->d_ino_hardlimit : 673 (xfs_qcnt_t) newlim->d_ino_hardlimit :
691 INT_GET(ddq->d_ino_hardlimit, ARCH_CONVERT); 674 be64_to_cpu(ddq->d_ino_hardlimit);
692 soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ? 675 soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ?
693 (xfs_qcnt_t) newlim->d_ino_softlimit : 676 (xfs_qcnt_t) newlim->d_ino_softlimit :
694 INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT); 677 be64_to_cpu(ddq->d_ino_softlimit);
695 if (hard == 0 || hard >= soft) { 678 if (hard == 0 || hard >= soft) {
696 INT_SET(ddq->d_ino_hardlimit, ARCH_CONVERT, hard); 679 ddq->d_ino_hardlimit = cpu_to_be64(hard);
697 INT_SET(ddq->d_ino_softlimit, ARCH_CONVERT, soft); 680 ddq->d_ino_softlimit = cpu_to_be64(soft);
698 if (id == 0) { 681 if (id == 0) {
699 mp->m_quotainfo->qi_ihardlimit = hard; 682 mp->m_quotainfo->qi_ihardlimit = hard;
700 mp->m_quotainfo->qi_isoftlimit = soft; 683 mp->m_quotainfo->qi_isoftlimit = soft;
@@ -707,11 +690,11 @@ xfs_qm_scall_setqlim(
707 * Update warnings counter(s) if requested 690 * Update warnings counter(s) if requested
708 */ 691 */
709 if (newlim->d_fieldmask & FS_DQ_BWARNS) 692 if (newlim->d_fieldmask & FS_DQ_BWARNS)
710 INT_SET(ddq->d_bwarns, ARCH_CONVERT, newlim->d_bwarns); 693 ddq->d_bwarns = cpu_to_be16(newlim->d_bwarns);
711 if (newlim->d_fieldmask & FS_DQ_IWARNS) 694 if (newlim->d_fieldmask & FS_DQ_IWARNS)
712 INT_SET(ddq->d_iwarns, ARCH_CONVERT, newlim->d_iwarns); 695 ddq->d_iwarns = cpu_to_be16(newlim->d_iwarns);
713 if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 696 if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
714 INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, newlim->d_rtbwarns); 697 ddq->d_rtbwarns = cpu_to_be16(newlim->d_rtbwarns);
715 698
716 if (id == 0) { 699 if (id == 0) {
717 /* 700 /*
@@ -723,15 +706,15 @@ xfs_qm_scall_setqlim(
723 */ 706 */
724 if (newlim->d_fieldmask & FS_DQ_BTIMER) { 707 if (newlim->d_fieldmask & FS_DQ_BTIMER) {
725 mp->m_quotainfo->qi_btimelimit = newlim->d_btimer; 708 mp->m_quotainfo->qi_btimelimit = newlim->d_btimer;
726 INT_SET(ddq->d_btimer, ARCH_CONVERT, newlim->d_btimer); 709 ddq->d_btimer = cpu_to_be32(newlim->d_btimer);
727 } 710 }
728 if (newlim->d_fieldmask & FS_DQ_ITIMER) { 711 if (newlim->d_fieldmask & FS_DQ_ITIMER) {
729 mp->m_quotainfo->qi_itimelimit = newlim->d_itimer; 712 mp->m_quotainfo->qi_itimelimit = newlim->d_itimer;
730 INT_SET(ddq->d_itimer, ARCH_CONVERT, newlim->d_itimer); 713 ddq->d_itimer = cpu_to_be32(newlim->d_itimer);
731 } 714 }
732 if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { 715 if (newlim->d_fieldmask & FS_DQ_RTBTIMER) {
733 mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer; 716 mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer;
734 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer); 717 ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer);
735 } 718 }
736 if (newlim->d_fieldmask & FS_DQ_BWARNS) 719 if (newlim->d_fieldmask & FS_DQ_BWARNS)
737 mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns; 720 mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns;
@@ -902,33 +885,27 @@ xfs_qm_export_dquot(
902{ 885{
903 memset(dst, 0, sizeof(*dst)); 886 memset(dst, 0, sizeof(*dst));
904 dst->d_version = FS_DQUOT_VERSION; /* different from src->d_version */ 887 dst->d_version = FS_DQUOT_VERSION; /* different from src->d_version */
905 dst->d_flags = 888 dst->d_flags = xfs_qm_export_qtype_flags(src->d_flags);
906 xfs_qm_export_qtype_flags(INT_GET(src->d_flags, ARCH_CONVERT)); 889 dst->d_id = be32_to_cpu(src->d_id);
907 dst->d_id = INT_GET(src->d_id, ARCH_CONVERT); 890 dst->d_blk_hardlimit =
908 dst->d_blk_hardlimit = (__uint64_t) 891 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_hardlimit));
909 XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_hardlimit, ARCH_CONVERT)); 892 dst->d_blk_softlimit =
910 dst->d_blk_softlimit = (__uint64_t) 893 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_softlimit));
911 XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_softlimit, ARCH_CONVERT)); 894 dst->d_ino_hardlimit = be64_to_cpu(src->d_ino_hardlimit);
912 dst->d_ino_hardlimit = (__uint64_t) 895 dst->d_ino_softlimit = be64_to_cpu(src->d_ino_softlimit);
913 INT_GET(src->d_ino_hardlimit, ARCH_CONVERT); 896 dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_bcount));
914 dst->d_ino_softlimit = (__uint64_t) 897 dst->d_icount = be64_to_cpu(src->d_icount);
915 INT_GET(src->d_ino_softlimit, ARCH_CONVERT); 898 dst->d_btimer = be32_to_cpu(src->d_btimer);
916 dst->d_bcount = (__uint64_t) 899 dst->d_itimer = be32_to_cpu(src->d_itimer);
917 XFS_FSB_TO_BB(mp, INT_GET(src->d_bcount, ARCH_CONVERT)); 900 dst->d_iwarns = be16_to_cpu(src->d_iwarns);
918 dst->d_icount = (__uint64_t) INT_GET(src->d_icount, ARCH_CONVERT); 901 dst->d_bwarns = be16_to_cpu(src->d_bwarns);
919 dst->d_btimer = (__uint32_t) INT_GET(src->d_btimer, ARCH_CONVERT); 902 dst->d_rtb_hardlimit =
920 dst->d_itimer = (__uint32_t) INT_GET(src->d_itimer, ARCH_CONVERT); 903 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_hardlimit));
921 dst->d_iwarns = INT_GET(src->d_iwarns, ARCH_CONVERT); 904 dst->d_rtb_softlimit =
922 dst->d_bwarns = INT_GET(src->d_bwarns, ARCH_CONVERT); 905 XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_softlimit));
923 906 dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtbcount));
924 dst->d_rtb_hardlimit = (__uint64_t) 907 dst->d_rtbtimer = be32_to_cpu(src->d_rtbtimer);
925 XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_hardlimit, ARCH_CONVERT)); 908 dst->d_rtbwarns = be16_to_cpu(src->d_rtbwarns);
926 dst->d_rtb_softlimit = (__uint64_t)
927 XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_softlimit, ARCH_CONVERT));
928 dst->d_rtbcount = (__uint64_t)
929 XFS_FSB_TO_BB(mp, INT_GET(src->d_rtbcount, ARCH_CONVERT));
930 dst->d_rtbtimer = (__uint32_t) INT_GET(src->d_rtbtimer, ARCH_CONVERT);
931 dst->d_rtbwarns = INT_GET(src->d_rtbwarns, ARCH_CONVERT);
932 909
933 /* 910 /*
934 * Internally, we don't reset all the timers when quota enforcement 911 * Internally, we don't reset all the timers when quota enforcement
@@ -1222,10 +1199,10 @@ xfs_qm_dqtest_failed(
1222 qmtest_nfails++; 1199 qmtest_nfails++;
1223 if (error) 1200 if (error)
1224 cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s", 1201 cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s",
1225 INT_GET(d->d_id, ARCH_CONVERT), error, reason); 1202 d->d_id, error, reason);
1226 else 1203 else
1227 cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]", 1204 cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]",
1228 INT_GET(d->d_id, ARCH_CONVERT), reason, (int)a, (int)b); 1205 d->d_id, reason, (int)a, (int)b);
1229 xfs_qm_dqtest_print(d); 1206 xfs_qm_dqtest_print(d);
1230 if (dqp) 1207 if (dqp)
1231 xfs_qm_dqprint(dqp); 1208 xfs_qm_dqprint(dqp);
@@ -1237,21 +1214,21 @@ xfs_dqtest_cmp2(
1237 xfs_dquot_t *dqp) 1214 xfs_dquot_t *dqp)
1238{ 1215{
1239 int err = 0; 1216 int err = 0;
1240 if (INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) != d->d_icount) { 1217 if (be64_to_cpu(dqp->q_core.d_icount) != d->d_icount) {
1241 xfs_qm_dqtest_failed(d, dqp, "icount mismatch", 1218 xfs_qm_dqtest_failed(d, dqp, "icount mismatch",
1242 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), 1219 be64_to_cpu(dqp->q_core.d_icount),
1243 d->d_icount, 0); 1220 d->d_icount, 0);
1244 err++; 1221 err++;
1245 } 1222 }
1246 if (INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) != d->d_bcount) { 1223 if (be64_to_cpu(dqp->q_core.d_bcount) != d->d_bcount) {
1247 xfs_qm_dqtest_failed(d, dqp, "bcount mismatch", 1224 xfs_qm_dqtest_failed(d, dqp, "bcount mismatch",
1248 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), 1225 be64_to_cpu(dqp->q_core.d_bcount),
1249 d->d_bcount, 0); 1226 d->d_bcount, 0);
1250 err++; 1227 err++;
1251 } 1228 }
1252 if (INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT) && 1229 if (dqp->q_core.d_blk_softlimit &&
1253 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) >= 1230 be64_to_cpu(dqp->q_core.d_bcount) >=
1254 INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)) { 1231 be64_to_cpu(dqp->q_core.d_blk_softlimit)) {
1255 if (!dqp->q_core.d_btimer && dqp->q_core.d_id) { 1232 if (!dqp->q_core.d_btimer && dqp->q_core.d_id) {
1256 cmn_err(CE_DEBUG, 1233 cmn_err(CE_DEBUG,
1257 "%d [%s] [0x%p] BLK TIMER NOT STARTED", 1234 "%d [%s] [0x%p] BLK TIMER NOT STARTED",
@@ -1259,9 +1236,9 @@ xfs_dqtest_cmp2(
1259 err++; 1236 err++;
1260 } 1237 }
1261 } 1238 }
1262 if (INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT) && 1239 if (dqp->q_core.d_ino_softlimit &&
1263 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= 1240 be64_to_cpu(dqp->q_core.d_icount) >=
1264 INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)) { 1241 be64_to_cpu(dqp->q_core.d_ino_softlimit)) {
1265 if (!dqp->q_core.d_itimer && dqp->q_core.d_id) { 1242 if (!dqp->q_core.d_itimer && dqp->q_core.d_id) {
1266 cmn_err(CE_DEBUG, 1243 cmn_err(CE_DEBUG,
1267 "%d [%s] [0x%p] INO TIMER NOT STARTED", 1244 "%d [%s] [0x%p] INO TIMER NOT STARTED",
diff --git a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/quota/xfs_quota_priv.h
index bf413e70ec07..7a9f3beb818c 100644
--- a/fs/xfs/quota/xfs_quota_priv.h
+++ b/fs/xfs/quota/xfs_quota_priv.h
@@ -1,33 +1,19 @@
1/* 1/*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32#ifndef __XFS_QUOTA_PRIV_H__ 18#ifndef __XFS_QUOTA_PRIV_H__
33#define __XFS_QUOTA_PRIV_H__ 19#define __XFS_QUOTA_PRIV_H__
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 3b99daf8a640..3290975d31f7 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -1,39 +1,25 @@
1/* 1/*
2 * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2002 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_fs.h" 19#include "xfs_fs.h"
35#include "xfs_inum.h" 20#include "xfs_bit.h"
36#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
37#include "xfs_trans.h" 23#include "xfs_trans.h"
38#include "xfs_sb.h" 24#include "xfs_sb.h"
39#include "xfs_ag.h" 25#include "xfs_ag.h"
@@ -43,21 +29,20 @@
43#include "xfs_dmapi.h" 29#include "xfs_dmapi.h"
44#include "xfs_quota.h" 30#include "xfs_quota.h"
45#include "xfs_mount.h" 31#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 32#include "xfs_bmap_btree.h"
33#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 34#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h" 35#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 36#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 37#include "xfs_dir2_sf.h"
54#include "xfs_dinode.h" 38#include "xfs_dinode.h"
55#include "xfs_inode.h" 39#include "xfs_inode.h"
40#include "xfs_ialloc.h"
41#include "xfs_itable.h"
42#include "xfs_btree.h"
56#include "xfs_bmap.h" 43#include "xfs_bmap.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 44#include "xfs_rtalloc.h"
59#include "xfs_error.h" 45#include "xfs_error.h"
60#include "xfs_itable.h"
61#include "xfs_rw.h" 46#include "xfs_rw.h"
62#include "xfs_acl.h" 47#include "xfs_acl.h"
63#include "xfs_cap.h" 48#include "xfs_cap.h"
@@ -65,7 +50,6 @@
65#include "xfs_attr.h" 50#include "xfs_attr.h"
66#include "xfs_buf_item.h" 51#include "xfs_buf_item.h"
67#include "xfs_trans_priv.h" 52#include "xfs_trans_priv.h"
68
69#include "xfs_qm.h" 53#include "xfs_qm.h"
70 54
71STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *); 55STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
@@ -429,25 +413,25 @@ xfs_trans_apply_dquot_deltas(
429 qtrx->qt_delrtb_delta; 413 qtrx->qt_delrtb_delta;
430#ifdef QUOTADEBUG 414#ifdef QUOTADEBUG
431 if (totalbdelta < 0) 415 if (totalbdelta < 0)
432 ASSERT(INT_GET(d->d_bcount, ARCH_CONVERT) >= 416 ASSERT(be64_to_cpu(d->d_bcount) >=
433 (xfs_qcnt_t) -totalbdelta); 417 (xfs_qcnt_t) -totalbdelta);
434 418
435 if (totalrtbdelta < 0) 419 if (totalrtbdelta < 0)
436 ASSERT(INT_GET(d->d_rtbcount, ARCH_CONVERT) >= 420 ASSERT(be64_to_cpu(d->d_rtbcount) >=
437 (xfs_qcnt_t) -totalrtbdelta); 421 (xfs_qcnt_t) -totalrtbdelta);
438 422
439 if (qtrx->qt_icount_delta < 0) 423 if (qtrx->qt_icount_delta < 0)
440 ASSERT(INT_GET(d->d_icount, ARCH_CONVERT) >= 424 ASSERT(be64_to_cpu(d->d_icount) >=
441 (xfs_qcnt_t) -qtrx->qt_icount_delta); 425 (xfs_qcnt_t) -qtrx->qt_icount_delta);
442#endif 426#endif
443 if (totalbdelta) 427 if (totalbdelta)
444 INT_MOD(d->d_bcount, ARCH_CONVERT, (xfs_qcnt_t)totalbdelta); 428 be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
445 429
446 if (qtrx->qt_icount_delta) 430 if (qtrx->qt_icount_delta)
447 INT_MOD(d->d_icount, ARCH_CONVERT, (xfs_qcnt_t)qtrx->qt_icount_delta); 431 be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
448 432
449 if (totalrtbdelta) 433 if (totalrtbdelta)
450 INT_MOD(d->d_rtbcount, ARCH_CONVERT, (xfs_qcnt_t)totalrtbdelta); 434 be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
451 435
452 /* 436 /*
453 * Get any default limits in use. 437 * Get any default limits in use.
@@ -531,11 +515,11 @@ xfs_trans_apply_dquot_deltas(
531 } 515 }
532 516
533 ASSERT(dqp->q_res_bcount >= 517 ASSERT(dqp->q_res_bcount >=
534 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 518 be64_to_cpu(dqp->q_core.d_bcount));
535 ASSERT(dqp->q_res_icount >= 519 ASSERT(dqp->q_res_icount >=
536 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); 520 be64_to_cpu(dqp->q_core.d_icount));
537 ASSERT(dqp->q_res_rtbcount >= 521 ASSERT(dqp->q_res_rtbcount >=
538 INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT)); 522 be64_to_cpu(dqp->q_core.d_rtbcount));
539 } 523 }
540 /* 524 /*
541 * Do the group quotas next 525 * Do the group quotas next
@@ -642,26 +626,26 @@ xfs_trans_dqresv(
642 } 626 }
643 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 627 ASSERT(XFS_DQ_IS_LOCKED(dqp));
644 if (flags & XFS_TRANS_DQ_RES_BLKS) { 628 if (flags & XFS_TRANS_DQ_RES_BLKS) {
645 hardlimit = INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT); 629 hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit);
646 if (!hardlimit) 630 if (!hardlimit)
647 hardlimit = q->qi_bhardlimit; 631 hardlimit = q->qi_bhardlimit;
648 softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT); 632 softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit);
649 if (!softlimit) 633 if (!softlimit)
650 softlimit = q->qi_bsoftlimit; 634 softlimit = q->qi_bsoftlimit;
651 timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT); 635 timer = be32_to_cpu(dqp->q_core.d_btimer);
652 warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT); 636 warns = be16_to_cpu(dqp->q_core.d_bwarns);
653 warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount); 637 warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount);
654 resbcountp = &dqp->q_res_bcount; 638 resbcountp = &dqp->q_res_bcount;
655 } else { 639 } else {
656 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS); 640 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
657 hardlimit = INT_GET(dqp->q_core.d_rtb_hardlimit, ARCH_CONVERT); 641 hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit);
658 if (!hardlimit) 642 if (!hardlimit)
659 hardlimit = q->qi_rtbhardlimit; 643 hardlimit = q->qi_rtbhardlimit;
660 softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT); 644 softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit);
661 if (!softlimit) 645 if (!softlimit)
662 softlimit = q->qi_rtbsoftlimit; 646 softlimit = q->qi_rtbsoftlimit;
663 timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT); 647 timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
664 warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT); 648 warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
665 warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount); 649 warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
666 resbcountp = &dqp->q_res_rtbcount; 650 resbcountp = &dqp->q_res_rtbcount;
667 } 651 }
@@ -700,16 +684,14 @@ xfs_trans_dqresv(
700 } 684 }
701 } 685 }
702 if (ninos > 0) { 686 if (ninos > 0) {
703 count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT); 687 count = be64_to_cpu(dqp->q_core.d_icount);
704 timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT); 688 timer = be32_to_cpu(dqp->q_core.d_itimer);
705 warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT); 689 warns = be16_to_cpu(dqp->q_core.d_iwarns);
706 warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount); 690 warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount);
707 hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit, 691 hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
708 ARCH_CONVERT);
709 if (!hardlimit) 692 if (!hardlimit)
710 hardlimit = q->qi_ihardlimit; 693 hardlimit = q->qi_ihardlimit;
711 softlimit = INT_GET(dqp->q_core.d_ino_softlimit, 694 softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
712 ARCH_CONVERT);
713 if (!softlimit) 695 if (!softlimit)
714 softlimit = q->qi_isoftlimit; 696 softlimit = q->qi_isoftlimit;
715 if (hardlimit > 0ULL && count >= hardlimit) { 697 if (hardlimit > 0ULL && count >= hardlimit) {
@@ -756,9 +738,9 @@ xfs_trans_dqresv(
756 XFS_TRANS_DQ_RES_INOS, 738 XFS_TRANS_DQ_RES_INOS,
757 ninos); 739 ninos);
758 } 740 }
759 ASSERT(dqp->q_res_bcount >= INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 741 ASSERT(dqp->q_res_bcount >= be64_to_cpu(dqp->q_core.d_bcount));
760 ASSERT(dqp->q_res_rtbcount >= INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT)); 742 ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
761 ASSERT(dqp->q_res_icount >= INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); 743 ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
762 744
763error_return: 745error_return:
764 if (! (flags & XFS_QMOPT_DQLOCK)) { 746 if (! (flags & XFS_QMOPT_DQLOCK)) {