quota.c 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
  1. /*
  2. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  3. * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
  4. *
  5. * This copyrighted material is made available to anyone wishing to use,
  6. * modify, copy, or redistribute it subject to the terms and conditions
  7. * of the GNU General Public License v.2.
  8. */
  9. /*
  10. * Quota change tags are associated with each transaction that allocates or
  11. * deallocates space. Those changes are accumulated locally to each node (in a
  12. * per-node file) and then are periodically synced to the quota file. This
  13. * avoids the bottleneck of constantly touching the quota file, but introduces
  14. * fuzziness in the current usage value of IDs that are being used on different
  15. * nodes in the cluster simultaneously. So, it is possible for a user on
  16. * multiple nodes to overrun their quota, but that overrun is controlable.
  17. * Since quota tags are part of transactions, there is no need to a quota check
  18. * program to be run on node crashes or anything like that.
  19. *
  20. * There are couple of knobs that let the administrator manage the quota
  21. * fuzziness. "quota_quantum" sets the maximum time a quota change can be
  22. * sitting on one node before being synced to the quota file. (The default is
  23. * 60 seconds.) Another knob, "quota_scale" controls how quickly the frequency
  24. * of quota file syncs increases as the user moves closer to their limit. The
  25. * more frequent the syncs, the more accurate the quota enforcement, but that
  26. * means that there is more contention between the nodes for the quota file.
  27. * The default value is one. This sets the maximum theoretical quota overrun
  28. * (with infinite node with infinite bandwidth) to twice the user's limit. (In
  29. * practice, the maximum overrun you see should be much less.) A "quota_scale"
  30. * number greater than one makes quota syncs more frequent and reduces the
  31. * maximum overrun. Numbers less than one (but greater than zero) make quota
  32. * syncs less frequent.
  33. *
  34. * GFS quotas also use per-ID Lock Value Blocks (LVBs) to cache the contents of
  35. * the quota file, so it is not being constantly read.
  36. */
  37. #include <linux/sched.h>
  38. #include <linux/slab.h>
  39. #include <linux/spinlock.h>
  40. #include <linux/completion.h>
  41. #include <linux/buffer_head.h>
  42. #include <linux/tty.h>
  43. #include <linux/sort.h>
  44. #include <linux/fs.h>
  45. #include <asm/semaphore.h>
  46. #include "gfs2.h"
  47. #include "bmap.h"
  48. #include "glock.h"
  49. #include "glops.h"
  50. #include "log.h"
  51. #include "meta_io.h"
  52. #include "quota.h"
  53. #include "rgrp.h"
  54. #include "super.h"
  55. #include "trans.h"
  56. #include "inode.h"
  57. #include "ops_file.h"
  58. #include "ops_address.h"
  59. #define QUOTA_USER 1
  60. #define QUOTA_GROUP 0
  61. static uint64_t qd2offset(struct gfs2_quota_data *qd)
  62. {
  63. uint64_t offset;
  64. offset = 2 * (uint64_t)qd->qd_id + !test_bit(QDF_USER, &qd->qd_flags);
  65. offset *= sizeof(struct gfs2_quota);
  66. return offset;
  67. }
  68. static int qd_alloc(struct gfs2_sbd *sdp, int user, uint32_t id,
  69. struct gfs2_quota_data **qdp)
  70. {
  71. struct gfs2_quota_data *qd;
  72. int error;
  73. qd = kzalloc(sizeof(struct gfs2_quota_data), GFP_KERNEL);
  74. if (!qd)
  75. return -ENOMEM;
  76. qd->qd_count = 1;
  77. qd->qd_id = id;
  78. if (user)
  79. set_bit(QDF_USER, &qd->qd_flags);
  80. qd->qd_slot = -1;
  81. error = gfs2_glock_get(sdp, 2 * (uint64_t)id + !user,
  82. &gfs2_quota_glops, CREATE, &qd->qd_gl);
  83. if (error)
  84. goto fail;
  85. error = gfs2_lvb_hold(qd->qd_gl);
  86. gfs2_glock_put(qd->qd_gl);
  87. if (error)
  88. goto fail;
  89. *qdp = qd;
  90. return 0;
  91. fail:
  92. kfree(qd);
  93. return error;
  94. }
  95. static int qd_get(struct gfs2_sbd *sdp, int user, uint32_t id, int create,
  96. struct gfs2_quota_data **qdp)
  97. {
  98. struct gfs2_quota_data *qd = NULL, *new_qd = NULL;
  99. int error, found;
  100. *qdp = NULL;
  101. for (;;) {
  102. found = 0;
  103. spin_lock(&sdp->sd_quota_spin);
  104. list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) {
  105. if (qd->qd_id == id &&
  106. !test_bit(QDF_USER, &qd->qd_flags) == !user) {
  107. qd->qd_count++;
  108. found = 1;
  109. break;
  110. }
  111. }
  112. if (!found)
  113. qd = NULL;
  114. if (!qd && new_qd) {
  115. qd = new_qd;
  116. list_add(&qd->qd_list, &sdp->sd_quota_list);
  117. atomic_inc(&sdp->sd_quota_count);
  118. new_qd = NULL;
  119. }
  120. spin_unlock(&sdp->sd_quota_spin);
  121. if (qd || !create) {
  122. if (new_qd) {
  123. gfs2_lvb_unhold(new_qd->qd_gl);
  124. kfree(new_qd);
  125. }
  126. *qdp = qd;
  127. return 0;
  128. }
  129. error = qd_alloc(sdp, user, id, &new_qd);
  130. if (error)
  131. return error;
  132. }
  133. }
  134. static void qd_hold(struct gfs2_quota_data *qd)
  135. {
  136. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  137. spin_lock(&sdp->sd_quota_spin);
  138. gfs2_assert(sdp, qd->qd_count);
  139. qd->qd_count++;
  140. spin_unlock(&sdp->sd_quota_spin);
  141. }
  142. static void qd_put(struct gfs2_quota_data *qd)
  143. {
  144. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  145. spin_lock(&sdp->sd_quota_spin);
  146. gfs2_assert(sdp, qd->qd_count);
  147. if (!--qd->qd_count)
  148. qd->qd_last_touched = jiffies;
  149. spin_unlock(&sdp->sd_quota_spin);
  150. }
  151. static int slot_get(struct gfs2_quota_data *qd)
  152. {
  153. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  154. unsigned int c, o = 0, b;
  155. unsigned char byte = 0;
  156. spin_lock(&sdp->sd_quota_spin);
  157. if (qd->qd_slot_count++) {
  158. spin_unlock(&sdp->sd_quota_spin);
  159. return 0;
  160. }
  161. for (c = 0; c < sdp->sd_quota_chunks; c++)
  162. for (o = 0; o < PAGE_SIZE; o++) {
  163. byte = sdp->sd_quota_bitmap[c][o];
  164. if (byte != 0xFF)
  165. goto found;
  166. }
  167. goto fail;
  168. found:
  169. for (b = 0; b < 8; b++)
  170. if (!(byte & (1 << b)))
  171. break;
  172. qd->qd_slot = c * (8 * PAGE_SIZE) + o * 8 + b;
  173. if (qd->qd_slot >= sdp->sd_quota_slots)
  174. goto fail;
  175. sdp->sd_quota_bitmap[c][o] |= 1 << b;
  176. spin_unlock(&sdp->sd_quota_spin);
  177. return 0;
  178. fail:
  179. qd->qd_slot_count--;
  180. spin_unlock(&sdp->sd_quota_spin);
  181. return -ENOSPC;
  182. }
  183. static void slot_hold(struct gfs2_quota_data *qd)
  184. {
  185. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  186. spin_lock(&sdp->sd_quota_spin);
  187. gfs2_assert(sdp, qd->qd_slot_count);
  188. qd->qd_slot_count++;
  189. spin_unlock(&sdp->sd_quota_spin);
  190. }
  191. static void slot_put(struct gfs2_quota_data *qd)
  192. {
  193. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  194. spin_lock(&sdp->sd_quota_spin);
  195. gfs2_assert(sdp, qd->qd_slot_count);
  196. if (!--qd->qd_slot_count) {
  197. gfs2_icbit_munge(sdp, sdp->sd_quota_bitmap, qd->qd_slot, 0);
  198. qd->qd_slot = -1;
  199. }
  200. spin_unlock(&sdp->sd_quota_spin);
  201. }
  202. static int bh_get(struct gfs2_quota_data *qd)
  203. {
  204. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  205. struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
  206. unsigned int block, offset;
  207. uint64_t dblock;
  208. int new = 0;
  209. struct buffer_head *bh;
  210. int error;
  211. mutex_lock(&sdp->sd_quota_mutex);
  212. if (qd->qd_bh_count++) {
  213. mutex_unlock(&sdp->sd_quota_mutex);
  214. return 0;
  215. }
  216. block = qd->qd_slot / sdp->sd_qc_per_block;
  217. offset = qd->qd_slot % sdp->sd_qc_per_block;;
  218. error = gfs2_block_map(ip, block, &new, &dblock, NULL);
  219. if (error)
  220. goto fail;
  221. error = gfs2_meta_read(ip->i_gl, dblock, DIO_START | DIO_WAIT, &bh);
  222. if (error)
  223. goto fail;
  224. error = -EIO;
  225. if (gfs2_metatype_check(sdp, bh, GFS2_METATYPE_QC))
  226. goto fail_brelse;
  227. qd->qd_bh = bh;
  228. qd->qd_bh_qc = (struct gfs2_quota_change *)
  229. (bh->b_data + sizeof(struct gfs2_meta_header) +
  230. offset * sizeof(struct gfs2_quota_change));
  231. mutex_lock(&sdp->sd_quota_mutex);
  232. return 0;
  233. fail_brelse:
  234. brelse(bh);
  235. fail:
  236. qd->qd_bh_count--;
  237. mutex_unlock(&sdp->sd_quota_mutex);
  238. return error;
  239. }
  240. static void bh_put(struct gfs2_quota_data *qd)
  241. {
  242. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  243. mutex_lock(&sdp->sd_quota_mutex);
  244. gfs2_assert(sdp, qd->qd_bh_count);
  245. if (!--qd->qd_bh_count) {
  246. brelse(qd->qd_bh);
  247. qd->qd_bh = NULL;
  248. qd->qd_bh_qc = NULL;
  249. }
  250. mutex_unlock(&sdp->sd_quota_mutex);
  251. }
  252. static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp)
  253. {
  254. struct gfs2_quota_data *qd = NULL;
  255. int error;
  256. int found = 0;
  257. *qdp = NULL;
  258. if (sdp->sd_vfs->s_flags & MS_RDONLY)
  259. return 0;
  260. spin_lock(&sdp->sd_quota_spin);
  261. list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) {
  262. if (test_bit(QDF_LOCKED, &qd->qd_flags) ||
  263. !test_bit(QDF_CHANGE, &qd->qd_flags) ||
  264. qd->qd_sync_gen >= sdp->sd_quota_sync_gen)
  265. continue;
  266. list_move_tail(&qd->qd_list, &sdp->sd_quota_list);
  267. set_bit(QDF_LOCKED, &qd->qd_flags);
  268. gfs2_assert_warn(sdp, qd->qd_count);
  269. qd->qd_count++;
  270. qd->qd_change_sync = qd->qd_change;
  271. gfs2_assert_warn(sdp, qd->qd_slot_count);
  272. qd->qd_slot_count++;
  273. found = 1;
  274. break;
  275. }
  276. if (!found)
  277. qd = NULL;
  278. spin_unlock(&sdp->sd_quota_spin);
  279. if (qd) {
  280. gfs2_assert_warn(sdp, qd->qd_change_sync);
  281. error = bh_get(qd);
  282. if (error) {
  283. clear_bit(QDF_LOCKED, &qd->qd_flags);
  284. slot_put(qd);
  285. qd_put(qd);
  286. return error;
  287. }
  288. }
  289. *qdp = qd;
  290. return 0;
  291. }
  292. static int qd_trylock(struct gfs2_quota_data *qd)
  293. {
  294. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  295. if (sdp->sd_vfs->s_flags & MS_RDONLY)
  296. return 0;
  297. spin_lock(&sdp->sd_quota_spin);
  298. if (test_bit(QDF_LOCKED, &qd->qd_flags) ||
  299. !test_bit(QDF_CHANGE, &qd->qd_flags)) {
  300. spin_unlock(&sdp->sd_quota_spin);
  301. return 0;
  302. }
  303. list_move_tail(&qd->qd_list, &sdp->sd_quota_list);
  304. set_bit(QDF_LOCKED, &qd->qd_flags);
  305. gfs2_assert_warn(sdp, qd->qd_count);
  306. qd->qd_count++;
  307. qd->qd_change_sync = qd->qd_change;
  308. gfs2_assert_warn(sdp, qd->qd_slot_count);
  309. qd->qd_slot_count++;
  310. spin_unlock(&sdp->sd_quota_spin);
  311. gfs2_assert_warn(sdp, qd->qd_change_sync);
  312. if (bh_get(qd)) {
  313. clear_bit(QDF_LOCKED, &qd->qd_flags);
  314. slot_put(qd);
  315. qd_put(qd);
  316. return 0;
  317. }
  318. return 1;
  319. }
  320. static void qd_unlock(struct gfs2_quota_data *qd)
  321. {
  322. gfs2_assert_warn(qd->qd_gl->gl_sbd,
  323. test_bit(QDF_LOCKED, &qd->qd_flags));
  324. clear_bit(QDF_LOCKED, &qd->qd_flags);
  325. bh_put(qd);
  326. slot_put(qd);
  327. qd_put(qd);
  328. }
  329. static int qdsb_get(struct gfs2_sbd *sdp, int user, uint32_t id, int create,
  330. struct gfs2_quota_data **qdp)
  331. {
  332. int error;
  333. error = qd_get(sdp, user, id, create, qdp);
  334. if (error)
  335. return error;
  336. error = slot_get(*qdp);
  337. if (error)
  338. goto fail;
  339. error = bh_get(*qdp);
  340. if (error)
  341. goto fail_slot;
  342. return 0;
  343. fail_slot:
  344. slot_put(*qdp);
  345. fail:
  346. qd_put(*qdp);
  347. return error;
  348. }
  349. static void qdsb_put(struct gfs2_quota_data *qd)
  350. {
  351. bh_put(qd);
  352. slot_put(qd);
  353. qd_put(qd);
  354. }
  355. int gfs2_quota_hold(struct gfs2_inode *ip, uint32_t uid, uint32_t gid)
  356. {
  357. struct gfs2_sbd *sdp = ip->i_sbd;
  358. struct gfs2_alloc *al = &ip->i_alloc;
  359. struct gfs2_quota_data **qd = al->al_qd;
  360. int error;
  361. if (gfs2_assert_warn(sdp, !al->al_qd_num) ||
  362. gfs2_assert_warn(sdp, !test_bit(GIF_QD_LOCKED, &ip->i_flags)))
  363. return -EIO;
  364. if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
  365. return 0;
  366. error = qdsb_get(sdp, QUOTA_USER, ip->i_di.di_uid, CREATE, qd);
  367. if (error)
  368. goto out;
  369. al->al_qd_num++;
  370. qd++;
  371. error = qdsb_get(sdp, QUOTA_GROUP, ip->i_di.di_gid, CREATE, qd);
  372. if (error)
  373. goto out;
  374. al->al_qd_num++;
  375. qd++;
  376. if (uid != NO_QUOTA_CHANGE && uid != ip->i_di.di_uid) {
  377. error = qdsb_get(sdp, QUOTA_USER, uid, CREATE, qd);
  378. if (error)
  379. goto out;
  380. al->al_qd_num++;
  381. qd++;
  382. }
  383. if (gid != NO_QUOTA_CHANGE && gid != ip->i_di.di_gid) {
  384. error = qdsb_get(sdp, QUOTA_GROUP, gid, CREATE, qd);
  385. if (error)
  386. goto out;
  387. al->al_qd_num++;
  388. qd++;
  389. }
  390. out:
  391. if (error)
  392. gfs2_quota_unhold(ip);
  393. return error;
  394. }
  395. void gfs2_quota_unhold(struct gfs2_inode *ip)
  396. {
  397. struct gfs2_sbd *sdp = ip->i_sbd;
  398. struct gfs2_alloc *al = &ip->i_alloc;
  399. unsigned int x;
  400. gfs2_assert_warn(sdp, !test_bit(GIF_QD_LOCKED, &ip->i_flags));
  401. for (x = 0; x < al->al_qd_num; x++) {
  402. qdsb_put(al->al_qd[x]);
  403. al->al_qd[x] = NULL;
  404. }
  405. al->al_qd_num = 0;
  406. }
  407. static int sort_qd(const void *a, const void *b)
  408. {
  409. struct gfs2_quota_data *qd_a = *(struct gfs2_quota_data **)a;
  410. struct gfs2_quota_data *qd_b = *(struct gfs2_quota_data **)b;
  411. int ret = 0;
  412. if (!test_bit(QDF_USER, &qd_a->qd_flags) !=
  413. !test_bit(QDF_USER, &qd_b->qd_flags)) {
  414. if (test_bit(QDF_USER, &qd_a->qd_flags))
  415. ret = -1;
  416. else
  417. ret = 1;
  418. } else {
  419. if (qd_a->qd_id < qd_b->qd_id)
  420. ret = -1;
  421. else if (qd_a->qd_id > qd_b->qd_id)
  422. ret = 1;
  423. }
  424. return ret;
  425. }
  426. static void do_qc(struct gfs2_quota_data *qd, int64_t change)
  427. {
  428. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  429. struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
  430. struct gfs2_quota_change *qc = qd->qd_bh_qc;
  431. int64_t x;
  432. mutex_lock(&sdp->sd_quota_mutex);
  433. gfs2_trans_add_bh(ip->i_gl, qd->qd_bh, 1);
  434. if (!test_bit(QDF_CHANGE, &qd->qd_flags)) {
  435. qc->qc_change = 0;
  436. qc->qc_flags = 0;
  437. if (test_bit(QDF_USER, &qd->qd_flags))
  438. qc->qc_flags = cpu_to_be32(GFS2_QCF_USER);
  439. qc->qc_id = cpu_to_be32(qd->qd_id);
  440. }
  441. x = qc->qc_change;
  442. x = be64_to_cpu(x) + change;
  443. qc->qc_change = cpu_to_be64(x);
  444. spin_lock(&sdp->sd_quota_spin);
  445. qd->qd_change = x;
  446. spin_unlock(&sdp->sd_quota_spin);
  447. if (!x) {
  448. gfs2_assert_warn(sdp, test_bit(QDF_CHANGE, &qd->qd_flags));
  449. clear_bit(QDF_CHANGE, &qd->qd_flags);
  450. qc->qc_flags = 0;
  451. qc->qc_id = 0;
  452. slot_put(qd);
  453. qd_put(qd);
  454. } else if (!test_and_set_bit(QDF_CHANGE, &qd->qd_flags)) {
  455. qd_hold(qd);
  456. slot_hold(qd);
  457. }
  458. mutex_unlock(&sdp->sd_quota_mutex);
  459. }
  460. /**
  461. * gfs2_adjust_quota
  462. *
  463. * This function was mostly borrowed from gfs2_block_truncate_page which was
  464. * in turn mostly borrowed from ext3
  465. */
  466. static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
  467. int64_t change, struct gfs2_quota_data *qd)
  468. {
  469. struct inode *inode = ip->i_vnode;
  470. struct address_space *mapping = inode->i_mapping;
  471. unsigned long index = loc >> PAGE_CACHE_SHIFT;
  472. unsigned offset = loc & (PAGE_CACHE_SHIFT - 1);
  473. unsigned blocksize, iblock, pos;
  474. struct buffer_head *bh;
  475. struct page *page;
  476. void *kaddr;
  477. __be64 *ptr;
  478. u64 value;
  479. int err = -EIO;
  480. page = grab_cache_page(mapping, index);
  481. if (!page)
  482. return -ENOMEM;
  483. blocksize = inode->i_sb->s_blocksize;
  484. iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
  485. if (!page_has_buffers(page))
  486. create_empty_buffers(page, blocksize, 0);
  487. bh = page_buffers(page);
  488. pos = blocksize;
  489. while (offset >= pos) {
  490. bh = bh->b_this_page;
  491. iblock++;
  492. pos += blocksize;
  493. }
  494. if (!buffer_mapped(bh)) {
  495. gfs2_get_block(inode, iblock, bh, 1);
  496. if (!buffer_mapped(bh))
  497. goto unlock;
  498. }
  499. if (PageUptodate(page))
  500. set_buffer_uptodate(bh);
  501. if (!buffer_uptodate(bh)) {
  502. ll_rw_block(READ, 1, &bh);
  503. wait_on_buffer(bh);
  504. if (!buffer_uptodate(bh))
  505. goto unlock;
  506. }
  507. gfs2_trans_add_bh(ip->i_gl, bh, 0);
  508. kaddr = kmap_atomic(page, KM_USER0);
  509. ptr = (__be64 *)(kaddr + offset);
  510. value = *ptr = cpu_to_be64(be64_to_cpu(*ptr) + change);
  511. flush_dcache_page(page);
  512. kunmap_atomic(kaddr, KM_USER0);
  513. err = 0;
  514. qd->qd_qb.qb_magic = cpu_to_be32(GFS2_MAGIC);
  515. #if 0
  516. qd->qd_qb.qb_limit = cpu_to_be64(q.qu_limit);
  517. qd->qd_qb.qb_warn = cpu_to_be64(q.qu_warn);
  518. #endif
  519. qd->qd_qb.qb_value = cpu_to_be64(value);
  520. unlock:
  521. unlock_page(page);
  522. page_cache_release(page);
  523. return err;
  524. }
  525. static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
  526. {
  527. struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd;
  528. struct gfs2_inode *ip = get_v2ip(sdp->sd_quota_inode);
  529. unsigned int data_blocks, ind_blocks;
  530. struct file_ra_state ra_state;
  531. struct gfs2_holder *ghs, i_gh;
  532. unsigned int qx, x;
  533. struct gfs2_quota_data *qd;
  534. loff_t offset;
  535. unsigned int nalloc = 0;
  536. struct gfs2_alloc *al = NULL;
  537. int error;
  538. gfs2_write_calc_reserv(ip, sizeof(struct gfs2_quota),
  539. &data_blocks, &ind_blocks);
  540. ghs = kcalloc(num_qd, sizeof(struct gfs2_holder), GFP_KERNEL);
  541. if (!ghs)
  542. return -ENOMEM;
  543. sort(qda, num_qd, sizeof(struct gfs2_quota_data *), sort_qd, NULL);
  544. for (qx = 0; qx < num_qd; qx++) {
  545. error = gfs2_glock_nq_init(qda[qx]->qd_gl,
  546. LM_ST_EXCLUSIVE,
  547. GL_NOCACHE, &ghs[qx]);
  548. if (error)
  549. goto out;
  550. }
  551. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
  552. if (error)
  553. goto out;
  554. for (x = 0; x < num_qd; x++) {
  555. int alloc_required;
  556. offset = qd2offset(qda[x]);
  557. error = gfs2_write_alloc_required(ip, offset,
  558. sizeof(struct gfs2_quota),
  559. &alloc_required);
  560. if (error)
  561. goto out_gunlock;
  562. if (alloc_required)
  563. nalloc++;
  564. }
  565. if (nalloc) {
  566. al = gfs2_alloc_get(ip);
  567. al->al_requested = nalloc * (data_blocks + ind_blocks);
  568. error = gfs2_inplace_reserve(ip);
  569. if (error)
  570. goto out_alloc;
  571. error = gfs2_trans_begin(sdp,
  572. al->al_rgd->rd_ri.ri_length +
  573. num_qd * data_blocks +
  574. nalloc * ind_blocks +
  575. RES_DINODE + num_qd +
  576. RES_STATFS, 0);
  577. if (error)
  578. goto out_ipres;
  579. } else {
  580. error = gfs2_trans_begin(sdp,
  581. num_qd * data_blocks +
  582. RES_DINODE + num_qd, 0);
  583. if (error)
  584. goto out_gunlock;
  585. }
  586. file_ra_state_init(&ra_state, ip->i_vnode->i_mapping);
  587. for (x = 0; x < num_qd; x++) {
  588. qd = qda[x];
  589. offset = qd2offset(qd);
  590. error = gfs2_adjust_quota(ip, offset, qd->qd_change_sync,
  591. (struct gfs2_quota_data *)
  592. qd->qd_gl->gl_lvb);
  593. if (error)
  594. goto out_end_trans;
  595. do_qc(qd, -qd->qd_change_sync);
  596. }
  597. error = 0;
  598. out_end_trans:
  599. gfs2_trans_end(sdp);
  600. out_ipres:
  601. if (nalloc)
  602. gfs2_inplace_release(ip);
  603. out_alloc:
  604. if (nalloc)
  605. gfs2_alloc_put(ip);
  606. out_gunlock:
  607. gfs2_glock_dq_uninit(&i_gh);
  608. out:
  609. while (qx--)
  610. gfs2_glock_dq_uninit(&ghs[qx]);
  611. kfree(ghs);
  612. gfs2_log_flush_glock(ip->i_gl);
  613. return error;
  614. }
  615. static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
  616. struct gfs2_holder *q_gh)
  617. {
  618. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  619. struct gfs2_holder i_gh;
  620. struct gfs2_quota q;
  621. char buf[sizeof(struct gfs2_quota)];
  622. struct file_ra_state ra_state;
  623. int error;
  624. file_ra_state_init(&ra_state, sdp->sd_quota_inode->i_mapping);
  625. restart:
  626. error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh);
  627. if (error)
  628. return error;
  629. gfs2_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb);
  630. if (force_refresh || qd->qd_qb.qb_magic != GFS2_MAGIC) {
  631. loff_t pos;
  632. gfs2_glock_dq_uninit(q_gh);
  633. error = gfs2_glock_nq_init(qd->qd_gl,
  634. LM_ST_EXCLUSIVE, GL_NOCACHE,
  635. q_gh);
  636. if (error)
  637. return error;
  638. error = gfs2_glock_nq_init(get_v2ip(sdp->sd_quota_inode)->i_gl,
  639. LM_ST_SHARED, 0,
  640. &i_gh);
  641. if (error)
  642. goto fail;
  643. memset(buf, 0, sizeof(struct gfs2_quota));
  644. pos = qd2offset(qd);
  645. error = gfs2_internal_read(get_v2ip(sdp->sd_quota_inode),
  646. &ra_state, buf,
  647. &pos,
  648. sizeof(struct gfs2_quota));
  649. if (error < 0)
  650. goto fail_gunlock;
  651. gfs2_glock_dq_uninit(&i_gh);
  652. gfs2_quota_in(&q, buf);
  653. memset(&qd->qd_qb, 0, sizeof(struct gfs2_quota_lvb));
  654. qd->qd_qb.qb_magic = GFS2_MAGIC;
  655. qd->qd_qb.qb_limit = q.qu_limit;
  656. qd->qd_qb.qb_warn = q.qu_warn;
  657. qd->qd_qb.qb_value = q.qu_value;
  658. gfs2_quota_lvb_out(&qd->qd_qb, qd->qd_gl->gl_lvb);
  659. if (gfs2_glock_is_blocking(qd->qd_gl)) {
  660. gfs2_glock_dq_uninit(q_gh);
  661. force_refresh = 0;
  662. goto restart;
  663. }
  664. }
  665. return 0;
  666. fail_gunlock:
  667. gfs2_glock_dq_uninit(&i_gh);
  668. fail:
  669. gfs2_glock_dq_uninit(q_gh);
  670. return error;
  671. }
  672. int gfs2_quota_lock(struct gfs2_inode *ip, uint32_t uid, uint32_t gid)
  673. {
  674. struct gfs2_sbd *sdp = ip->i_sbd;
  675. struct gfs2_alloc *al = &ip->i_alloc;
  676. unsigned int x;
  677. int error = 0;
  678. gfs2_quota_hold(ip, uid, gid);
  679. if (capable(CAP_SYS_RESOURCE) ||
  680. sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
  681. return 0;
  682. sort(al->al_qd, al->al_qd_num, sizeof(struct gfs2_quota_data *),
  683. sort_qd, NULL);
  684. for (x = 0; x < al->al_qd_num; x++) {
  685. error = do_glock(al->al_qd[x], NO_FORCE, &al->al_qd_ghs[x]);
  686. if (error)
  687. break;
  688. }
  689. if (!error)
  690. set_bit(GIF_QD_LOCKED, &ip->i_flags);
  691. else {
  692. while (x--)
  693. gfs2_glock_dq_uninit(&al->al_qd_ghs[x]);
  694. gfs2_quota_unhold(ip);
  695. }
  696. return error;
  697. }
  698. static int need_sync(struct gfs2_quota_data *qd)
  699. {
  700. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  701. struct gfs2_tune *gt = &sdp->sd_tune;
  702. int64_t value;
  703. unsigned int num, den;
  704. int do_sync = 1;
  705. if (!qd->qd_qb.qb_limit)
  706. return 0;
  707. spin_lock(&sdp->sd_quota_spin);
  708. value = qd->qd_change;
  709. spin_unlock(&sdp->sd_quota_spin);
  710. spin_lock(&gt->gt_spin);
  711. num = gt->gt_quota_scale_num;
  712. den = gt->gt_quota_scale_den;
  713. spin_unlock(&gt->gt_spin);
  714. if (value < 0)
  715. do_sync = 0;
  716. else if (qd->qd_qb.qb_value >= (int64_t)qd->qd_qb.qb_limit)
  717. do_sync = 0;
  718. else {
  719. value *= gfs2_jindex_size(sdp) * num;
  720. do_div(value, den);
  721. value += qd->qd_qb.qb_value;
  722. if (value < (int64_t)qd->qd_qb.qb_limit)
  723. do_sync = 0;
  724. }
  725. return do_sync;
  726. }
  727. void gfs2_quota_unlock(struct gfs2_inode *ip)
  728. {
  729. struct gfs2_alloc *al = &ip->i_alloc;
  730. struct gfs2_quota_data *qda[4];
  731. unsigned int count = 0;
  732. unsigned int x;
  733. if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags))
  734. goto out;
  735. for (x = 0; x < al->al_qd_num; x++) {
  736. struct gfs2_quota_data *qd;
  737. int sync;
  738. qd = al->al_qd[x];
  739. sync = need_sync(qd);
  740. gfs2_glock_dq_uninit(&al->al_qd_ghs[x]);
  741. if (sync && qd_trylock(qd))
  742. qda[count++] = qd;
  743. }
  744. if (count) {
  745. do_sync(count, qda);
  746. for (x = 0; x < count; x++)
  747. qd_unlock(qda[x]);
  748. }
  749. out:
  750. gfs2_quota_unhold(ip);
  751. }
  752. #define MAX_LINE 256
  753. static int print_message(struct gfs2_quota_data *qd, char *type)
  754. {
  755. struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
  756. char *line;
  757. int len;
  758. line = kmalloc(MAX_LINE, GFP_KERNEL);
  759. if (!line)
  760. return -ENOMEM;
  761. len = snprintf(line, MAX_LINE-1,
  762. "GFS2: fsid=%s: quota %s for %s %u\r\n",
  763. sdp->sd_fsname, type,
  764. (test_bit(QDF_USER, &qd->qd_flags)) ? "user" : "group",
  765. qd->qd_id);
  766. line[MAX_LINE-1] = 0;
  767. if (current->signal) { /* Is this test still required? */
  768. tty_write_message(current->signal->tty, line);
  769. }
  770. kfree(line);
  771. return 0;
  772. }
  773. int gfs2_quota_check(struct gfs2_inode *ip, uint32_t uid, uint32_t gid)
  774. {
  775. struct gfs2_sbd *sdp = ip->i_sbd;
  776. struct gfs2_alloc *al = &ip->i_alloc;
  777. struct gfs2_quota_data *qd;
  778. int64_t value;
  779. unsigned int x;
  780. int error = 0;
  781. if (!test_bit(GIF_QD_LOCKED, &ip->i_flags))
  782. return 0;
  783. if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
  784. return 0;
  785. for (x = 0; x < al->al_qd_num; x++) {
  786. qd = al->al_qd[x];
  787. if (!((qd->qd_id == uid && test_bit(QDF_USER, &qd->qd_flags)) ||
  788. (qd->qd_id == gid && !test_bit(QDF_USER, &qd->qd_flags))))
  789. continue;
  790. value = qd->qd_qb.qb_value;
  791. spin_lock(&sdp->sd_quota_spin);
  792. value += qd->qd_change;
  793. spin_unlock(&sdp->sd_quota_spin);
  794. if (qd->qd_qb.qb_limit && (int64_t)qd->qd_qb.qb_limit < value) {
  795. print_message(qd, "exceeded");
  796. error = -EDQUOT;
  797. break;
  798. } else if (qd->qd_qb.qb_warn &&
  799. (int64_t)qd->qd_qb.qb_warn < value &&
  800. time_after_eq(jiffies, qd->qd_last_warn +
  801. gfs2_tune_get(sdp,
  802. gt_quota_warn_period) * HZ)) {
  803. error = print_message(qd, "warning");
  804. qd->qd_last_warn = jiffies;
  805. }
  806. }
  807. return error;
  808. }
  809. void gfs2_quota_change(struct gfs2_inode *ip, int64_t change,
  810. uint32_t uid, uint32_t gid)
  811. {
  812. struct gfs2_alloc *al = &ip->i_alloc;
  813. struct gfs2_quota_data *qd;
  814. unsigned int x;
  815. unsigned int found = 0;
  816. if (gfs2_assert_warn(ip->i_sbd, change))
  817. return;
  818. if (ip->i_di.di_flags & GFS2_DIF_SYSTEM)
  819. return;
  820. for (x = 0; x < al->al_qd_num; x++) {
  821. qd = al->al_qd[x];
  822. if ((qd->qd_id == uid && test_bit(QDF_USER, &qd->qd_flags)) ||
  823. (qd->qd_id == gid && !test_bit(QDF_USER, &qd->qd_flags))) {
  824. do_qc(qd, change);
  825. found++;
  826. }
  827. }
  828. }
  829. int gfs2_quota_sync(struct gfs2_sbd *sdp)
  830. {
  831. struct gfs2_quota_data **qda;
  832. unsigned int max_qd = gfs2_tune_get(sdp, gt_quota_simul_sync);
  833. unsigned int num_qd;
  834. unsigned int x;
  835. int error = 0;
  836. sdp->sd_quota_sync_gen++;
  837. qda = kcalloc(max_qd, sizeof(struct gfs2_quota_data *), GFP_KERNEL);
  838. if (!qda)
  839. return -ENOMEM;
  840. do {
  841. num_qd = 0;
  842. for (;;) {
  843. error = qd_fish(sdp, qda + num_qd);
  844. if (error || !qda[num_qd])
  845. break;
  846. if (++num_qd == max_qd)
  847. break;
  848. }
  849. if (num_qd) {
  850. if (!error)
  851. error = do_sync(num_qd, qda);
  852. if (!error)
  853. for (x = 0; x < num_qd; x++)
  854. qda[x]->qd_sync_gen =
  855. sdp->sd_quota_sync_gen;
  856. for (x = 0; x < num_qd; x++)
  857. qd_unlock(qda[x]);
  858. }
  859. } while (!error && num_qd == max_qd);
  860. kfree(qda);
  861. return error;
  862. }
  863. int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, uint32_t id)
  864. {
  865. struct gfs2_quota_data *qd;
  866. struct gfs2_holder q_gh;
  867. int error;
  868. error = qd_get(sdp, user, id, CREATE, &qd);
  869. if (error)
  870. return error;
  871. error = do_glock(qd, FORCE, &q_gh);
  872. if (!error)
  873. gfs2_glock_dq_uninit(&q_gh);
  874. qd_put(qd);
  875. return error;
  876. }
  877. int gfs2_quota_read(struct gfs2_sbd *sdp, int user, uint32_t id,
  878. struct gfs2_quota *q)
  879. {
  880. struct gfs2_quota_data *qd;
  881. struct gfs2_holder q_gh;
  882. int error;
  883. if (((user) ? (id != current->fsuid) : (!in_group_p(id))) &&
  884. !capable(CAP_SYS_ADMIN))
  885. return -EACCES;
  886. error = qd_get(sdp, user, id, CREATE, &qd);
  887. if (error)
  888. return error;
  889. error = do_glock(qd, NO_FORCE, &q_gh);
  890. if (error)
  891. goto out;
  892. memset(q, 0, sizeof(struct gfs2_quota));
  893. q->qu_limit = qd->qd_qb.qb_limit;
  894. q->qu_warn = qd->qd_qb.qb_warn;
  895. q->qu_value = qd->qd_qb.qb_value;
  896. spin_lock(&sdp->sd_quota_spin);
  897. q->qu_value += qd->qd_change;
  898. spin_unlock(&sdp->sd_quota_spin);
  899. gfs2_glock_dq_uninit(&q_gh);
  900. out:
  901. qd_put(qd);
  902. return error;
  903. }
  904. int gfs2_quota_init(struct gfs2_sbd *sdp)
  905. {
  906. struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
  907. unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
  908. unsigned int x, slot = 0;
  909. unsigned int found = 0;
  910. uint64_t dblock;
  911. uint32_t extlen = 0;
  912. int error;
  913. if (!ip->i_di.di_size ||
  914. ip->i_di.di_size > (64 << 20) ||
  915. ip->i_di.di_size & (sdp->sd_sb.sb_bsize - 1)) {
  916. gfs2_consist_inode(ip);
  917. return -EIO;
  918. }
  919. sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block;
  920. sdp->sd_quota_chunks = DIV_RU(sdp->sd_quota_slots, 8 * PAGE_SIZE);
  921. error = -ENOMEM;
  922. sdp->sd_quota_bitmap = kcalloc(sdp->sd_quota_chunks,
  923. sizeof(unsigned char *), GFP_KERNEL);
  924. if (!sdp->sd_quota_bitmap)
  925. return error;
  926. for (x = 0; x < sdp->sd_quota_chunks; x++) {
  927. sdp->sd_quota_bitmap[x] = kzalloc(PAGE_SIZE, GFP_KERNEL);
  928. if (!sdp->sd_quota_bitmap[x])
  929. goto fail;
  930. }
  931. for (x = 0; x < blocks; x++) {
  932. struct buffer_head *bh;
  933. unsigned int y;
  934. if (!extlen) {
  935. int new = 0;
  936. error = gfs2_block_map(ip, x, &new, &dblock, &extlen);
  937. if (error)
  938. goto fail;
  939. }
  940. gfs2_meta_ra(ip->i_gl, dblock, extlen);
  941. error = gfs2_meta_read(ip->i_gl, dblock, DIO_START | DIO_WAIT,
  942. &bh);
  943. if (error)
  944. goto fail;
  945. error = -EIO;
  946. if (gfs2_metatype_check(sdp, bh, GFS2_METATYPE_QC)) {
  947. brelse(bh);
  948. goto fail;
  949. }
  950. for (y = 0;
  951. y < sdp->sd_qc_per_block && slot < sdp->sd_quota_slots;
  952. y++, slot++) {
  953. struct gfs2_quota_change qc;
  954. struct gfs2_quota_data *qd;
  955. gfs2_quota_change_in(&qc, bh->b_data +
  956. sizeof(struct gfs2_meta_header) +
  957. y * sizeof(struct gfs2_quota_change));
  958. if (!qc.qc_change)
  959. continue;
  960. error = qd_alloc(sdp, (qc.qc_flags & GFS2_QCF_USER),
  961. qc.qc_id, &qd);
  962. if (error) {
  963. brelse(bh);
  964. goto fail;
  965. }
  966. set_bit(QDF_CHANGE, &qd->qd_flags);
  967. qd->qd_change = qc.qc_change;
  968. qd->qd_slot = slot;
  969. qd->qd_slot_count = 1;
  970. qd->qd_last_touched = jiffies;
  971. spin_lock(&sdp->sd_quota_spin);
  972. gfs2_icbit_munge(sdp, sdp->sd_quota_bitmap, slot, 1);
  973. list_add(&qd->qd_list, &sdp->sd_quota_list);
  974. atomic_inc(&sdp->sd_quota_count);
  975. spin_unlock(&sdp->sd_quota_spin);
  976. found++;
  977. }
  978. brelse(bh);
  979. dblock++;
  980. extlen--;
  981. }
  982. if (found)
  983. fs_info(sdp, "found %u quota changes\n", found);
  984. return 0;
  985. fail:
  986. gfs2_quota_cleanup(sdp);
  987. return error;
  988. }
  989. void gfs2_quota_scan(struct gfs2_sbd *sdp)
  990. {
  991. struct gfs2_quota_data *qd, *safe;
  992. LIST_HEAD(dead);
  993. spin_lock(&sdp->sd_quota_spin);
  994. list_for_each_entry_safe(qd, safe, &sdp->sd_quota_list, qd_list) {
  995. if (!qd->qd_count &&
  996. time_after_eq(jiffies, qd->qd_last_touched +
  997. gfs2_tune_get(sdp, gt_quota_cache_secs) * HZ)) {
  998. list_move(&qd->qd_list, &dead);
  999. gfs2_assert_warn(sdp,
  1000. atomic_read(&sdp->sd_quota_count) > 0);
  1001. atomic_dec(&sdp->sd_quota_count);
  1002. }
  1003. }
  1004. spin_unlock(&sdp->sd_quota_spin);
  1005. while (!list_empty(&dead)) {
  1006. qd = list_entry(dead.next, struct gfs2_quota_data, qd_list);
  1007. list_del(&qd->qd_list);
  1008. gfs2_assert_warn(sdp, !qd->qd_change);
  1009. gfs2_assert_warn(sdp, !qd->qd_slot_count);
  1010. gfs2_assert_warn(sdp, !qd->qd_bh_count);
  1011. gfs2_lvb_unhold(qd->qd_gl);
  1012. kfree(qd);
  1013. }
  1014. }
  1015. void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
  1016. {
  1017. struct list_head *head = &sdp->sd_quota_list;
  1018. struct gfs2_quota_data *qd;
  1019. unsigned int x;
  1020. spin_lock(&sdp->sd_quota_spin);
  1021. while (!list_empty(head)) {
  1022. qd = list_entry(head->prev, struct gfs2_quota_data, qd_list);
  1023. if (qd->qd_count > 1 ||
  1024. (qd->qd_count && !test_bit(QDF_CHANGE, &qd->qd_flags))) {
  1025. list_move(&qd->qd_list, head);
  1026. spin_unlock(&sdp->sd_quota_spin);
  1027. schedule();
  1028. spin_lock(&sdp->sd_quota_spin);
  1029. continue;
  1030. }
  1031. list_del(&qd->qd_list);
  1032. atomic_dec(&sdp->sd_quota_count);
  1033. spin_unlock(&sdp->sd_quota_spin);
  1034. if (!qd->qd_count) {
  1035. gfs2_assert_warn(sdp, !qd->qd_change);
  1036. gfs2_assert_warn(sdp, !qd->qd_slot_count);
  1037. } else
  1038. gfs2_assert_warn(sdp, qd->qd_slot_count == 1);
  1039. gfs2_assert_warn(sdp, !qd->qd_bh_count);
  1040. gfs2_lvb_unhold(qd->qd_gl);
  1041. kfree(qd);
  1042. spin_lock(&sdp->sd_quota_spin);
  1043. }
  1044. spin_unlock(&sdp->sd_quota_spin);
  1045. gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count));
  1046. if (sdp->sd_quota_bitmap) {
  1047. for (x = 0; x < sdp->sd_quota_chunks; x++)
  1048. kfree(sdp->sd_quota_bitmap[x]);
  1049. kfree(sdp->sd_quota_bitmap);
  1050. }
  1051. }