Lines Matching refs:req
353 * @req: budgeting request
359 const struct ubifs_budget_req *req)
363 znodes = req->new_ino + (req->new_page << UBIFS_BLOCKS_PER_PAGE_SHIFT) +
364 req->new_dent;
372 * @req: budgeting request
375 const struct ubifs_budget_req *req)
379 data_growth = req->new_ino ? c->bi.inode_budget : 0;
380 if (req->new_page)
382 if (req->new_dent)
384 data_growth += req->new_ino_d;
392 * @req: budgeting request
395 const struct ubifs_budget_req *req)
399 dd_growth = req->dirtied_page ? c->bi.page_budget : 0;
401 if (req->dirtied_ino)
402 dd_growth += c->bi.inode_budget * req->dirtied_ino;
403 if (req->mod_dent)
405 dd_growth += req->dirtied_ino_d;
412 * @req: budget request
422 int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req)
426 ubifs_assert(c, req->new_page <= 1);
427 ubifs_assert(c, req->dirtied_page <= 1);
428 ubifs_assert(c, req->new_dent <= 1);
429 ubifs_assert(c, req->mod_dent <= 1);
430 ubifs_assert(c, req->new_ino <= 1);
431 ubifs_assert(c, req->new_ino_d <= UBIFS_MAX_INO_DATA);
432 ubifs_assert(c, req->dirtied_ino <= 4);
433 ubifs_assert(c, req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4);
434 ubifs_assert(c, !(req->new_ino_d & 7));
435 ubifs_assert(c, !(req->dirtied_ino_d & 7));
437 data_growth = calc_data_growth(c, req);
438 dd_growth = calc_dd_growth(c, req);
441 idx_growth = calc_idx_growth(c, req);
461 req->idx_growth = idx_growth;
462 req->data_growth = data_growth;
463 req->dd_growth = dd_growth;
474 if (req->fast) {
503 * @req: budget request
506 * since the index changes (which were budgeted for in @req->idx_growth) will
511 void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req)
513 ubifs_assert(c, req->new_page <= 1);
514 ubifs_assert(c, req->dirtied_page <= 1);
515 ubifs_assert(c, req->new_dent <= 1);
516 ubifs_assert(c, req->mod_dent <= 1);
517 ubifs_assert(c, req->new_ino <= 1);
518 ubifs_assert(c, req->new_ino_d <= UBIFS_MAX_INO_DATA);
519 ubifs_assert(c, req->dirtied_ino <= 4);
520 ubifs_assert(c, req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4);
521 ubifs_assert(c, !(req->new_ino_d & 7));
522 ubifs_assert(c, !(req->dirtied_ino_d & 7));
523 if (!req->recalculate) {
524 ubifs_assert(c, req->idx_growth >= 0);
525 ubifs_assert(c, req->data_growth >= 0);
526 ubifs_assert(c, req->dd_growth >= 0);
529 if (req->recalculate) {
530 req->data_growth = calc_data_growth(c, req);
531 req->dd_growth = calc_dd_growth(c, req);
532 req->idx_growth = calc_idx_growth(c, req);
535 if (!req->data_growth && !req->dd_growth)
542 c->bi.idx_growth -= req->idx_growth;
543 c->bi.uncommitted_idx += req->idx_growth;
544 c->bi.data_growth -= req->data_growth;
545 c->bi.dd_growth -= req->dd_growth;
593 struct ubifs_budget_req req;
595 memset(&req, 0, sizeof(struct ubifs_budget_req));
597 req.dd_growth = c->bi.inode_budget + ALIGN(ui->data_len, 8);
598 ubifs_release_budget(c, &req);