0001
0002
0003
0004
0005
0006
0007 #include "xfs.h"
0008 #include "xfs_fs.h"
0009 #include "xfs_shared.h"
0010 #include "xfs_format.h"
0011 #include "xfs_log_format.h"
0012 #include "xfs_trans_resv.h"
0013 #include "xfs_mount.h"
0014 #include "xfs_da_format.h"
0015 #include "xfs_da_btree.h"
0016 #include "xfs_inode.h"
0017 #include "xfs_bmap_btree.h"
0018 #include "xfs_quota.h"
0019 #include "xfs_trans.h"
0020 #include "xfs_qm.h"
0021 #include "xfs_trans_space.h"
0022
0023 #define _ALLOC true
0024 #define _FREE false
0025
0026
0027
0028
0029
0030
0031
0032
0033 STATIC uint
0034 xfs_buf_log_overhead(void)
0035 {
0036 return round_up(sizeof(struct xlog_op_header) +
0037 sizeof(struct xfs_buf_log_format), 128);
0038 }
0039
0040
0041
0042
0043
0044
0045
0046
0047 STATIC uint
0048 xfs_calc_buf_res(
0049 uint nbufs,
0050 uint size)
0051 {
0052 return nbufs * (size + xfs_buf_log_overhead());
0053 }
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 uint
0066 xfs_allocfree_block_count(
0067 struct xfs_mount *mp,
0068 uint num_ops)
0069 {
0070 uint blocks;
0071
0072 blocks = num_ops * 2 * (2 * mp->m_alloc_maxlevels - 1);
0073 if (xfs_has_rmapbt(mp))
0074 blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1);
0075
0076 return blocks;
0077 }
0078
0079
0080
0081
0082
0083
0084 static unsigned int
0085 xfs_refcountbt_block_count(
0086 struct xfs_mount *mp,
0087 unsigned int num_ops)
0088 {
0089 return num_ops * (2 * mp->m_refc_maxlevels - 1);
0090 }
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121 STATIC uint
0122 xfs_calc_inode_res(
0123 struct xfs_mount *mp,
0124 uint ninodes)
0125 {
0126 return ninodes *
0127 (4 * sizeof(struct xlog_op_header) +
0128 sizeof(struct xfs_inode_log_format) +
0129 mp->m_sb.sb_inodesize +
0130 2 * XFS_BMBT_BLOCK_LEN(mp));
0131 }
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143 STATIC uint
0144 xfs_calc_inobt_res(
0145 struct xfs_mount *mp)
0146 {
0147 return xfs_calc_buf_res(M_IGEO(mp)->inobt_maxlevels,
0148 XFS_FSB_TO_B(mp, 1)) +
0149 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1),
0150 XFS_FSB_TO_B(mp, 1));
0151 }
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164 STATIC uint
0165 xfs_calc_finobt_res(
0166 struct xfs_mount *mp)
0167 {
0168 if (!xfs_has_finobt(mp))
0169 return 0;
0170
0171 return xfs_calc_inobt_res(mp);
0172 }
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189 STATIC uint
0190 xfs_calc_inode_chunk_res(
0191 struct xfs_mount *mp,
0192 bool alloc)
0193 {
0194 uint res, size = 0;
0195
0196 res = xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1),
0197 XFS_FSB_TO_B(mp, 1));
0198 if (alloc) {
0199
0200 if (xfs_has_v3inodes(mp))
0201 return res;
0202 size = XFS_FSB_TO_B(mp, 1);
0203 }
0204
0205 res += xfs_calc_buf_res(M_IGEO(mp)->ialloc_blks, size);
0206 return res;
0207 }
0208
0209
0210
0211
0212
0213
0214
0215 static unsigned int
0216 xfs_rtalloc_block_count(
0217 struct xfs_mount *mp,
0218 unsigned int num_ops)
0219 {
0220 unsigned int blksz = XFS_FSB_TO_B(mp, 1);
0221 unsigned int rtbmp_bytes;
0222
0223 rtbmp_bytes = (XFS_MAX_BMBT_EXTLEN / mp->m_sb.sb_rextsize) / NBBY;
0224 return (howmany(rtbmp_bytes, blksz) + 1) * num_ops;
0225 }
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255 static unsigned int
0256 xfs_calc_refcountbt_reservation(
0257 struct xfs_mount *mp,
0258 unsigned int nr_ops)
0259 {
0260 unsigned int blksz = XFS_FSB_TO_B(mp, 1);
0261
0262 if (!xfs_has_reflink(mp))
0263 return 0;
0264
0265 return xfs_calc_buf_res(nr_ops, mp->m_sb.sb_sectsize) +
0266 xfs_calc_buf_res(xfs_refcountbt_block_count(mp, nr_ops), blksz);
0267 }
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292 STATIC uint
0293 xfs_calc_write_reservation(
0294 struct xfs_mount *mp,
0295 bool for_minlogsize)
0296 {
0297 unsigned int t1, t2, t3, t4;
0298 unsigned int blksz = XFS_FSB_TO_B(mp, 1);
0299
0300 t1 = xfs_calc_inode_res(mp, 1) +
0301 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), blksz) +
0302 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
0303 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2), blksz);
0304
0305 if (xfs_has_realtime(mp)) {
0306 t2 = xfs_calc_inode_res(mp, 1) +
0307 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
0308 blksz) +
0309 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
0310 xfs_calc_buf_res(xfs_rtalloc_block_count(mp, 1), blksz) +
0311 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1), blksz);
0312 } else {
0313 t2 = 0;
0314 }
0315
0316 t3 = xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
0317 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2), blksz);
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328 if (for_minlogsize) {
0329 unsigned int adj = 0;
0330
0331 if (xfs_has_reflink(mp))
0332 adj = xfs_calc_buf_res(
0333 xfs_refcountbt_block_count(mp, 2),
0334 blksz);
0335 t1 += adj;
0336 t3 += adj;
0337 return XFS_DQUOT_LOGRES(mp) + max3(t1, t2, t3);
0338 }
0339
0340 t4 = xfs_calc_refcountbt_reservation(mp, 1);
0341 return XFS_DQUOT_LOGRES(mp) + max(t4, max3(t1, t2, t3));
0342 }
0343
0344 unsigned int
0345 xfs_calc_write_reservation_minlogsize(
0346 struct xfs_mount *mp)
0347 {
0348 return xfs_calc_write_reservation(mp, true);
0349 }
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372 STATIC uint
0373 xfs_calc_itruncate_reservation(
0374 struct xfs_mount *mp,
0375 bool for_minlogsize)
0376 {
0377 unsigned int t1, t2, t3, t4;
0378 unsigned int blksz = XFS_FSB_TO_B(mp, 1);
0379
0380 t1 = xfs_calc_inode_res(mp, 1) +
0381 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1, blksz);
0382
0383 t2 = xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
0384 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 4), blksz);
0385
0386 if (xfs_has_realtime(mp)) {
0387 t3 = xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
0388 xfs_calc_buf_res(xfs_rtalloc_block_count(mp, 2), blksz) +
0389 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2), blksz);
0390 } else {
0391 t3 = 0;
0392 }
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403 if (for_minlogsize) {
0404 if (xfs_has_reflink(mp))
0405 t2 += xfs_calc_buf_res(
0406 xfs_refcountbt_block_count(mp, 4),
0407 blksz);
0408
0409 return XFS_DQUOT_LOGRES(mp) + max3(t1, t2, t3);
0410 }
0411
0412 t4 = xfs_calc_refcountbt_reservation(mp, 2);
0413 return XFS_DQUOT_LOGRES(mp) + max(t4, max3(t1, t2, t3));
0414 }
0415
0416 unsigned int
0417 xfs_calc_itruncate_reservation_minlogsize(
0418 struct xfs_mount *mp)
0419 {
0420 return xfs_calc_itruncate_reservation(mp, true);
0421 }
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435 STATIC uint
0436 xfs_calc_rename_reservation(
0437 struct xfs_mount *mp)
0438 {
0439 return XFS_DQUOT_LOGRES(mp) +
0440 max((xfs_calc_inode_res(mp, 4) +
0441 xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp),
0442 XFS_FSB_TO_B(mp, 1))),
0443 (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
0444 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 3),
0445 XFS_FSB_TO_B(mp, 1))));
0446 }
0447
0448
0449
0450
0451
0452
0453
0454 STATIC uint
0455 xfs_calc_iunlink_remove_reservation(
0456 struct xfs_mount *mp)
0457 {
0458 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
0459 2 * M_IGEO(mp)->inode_cluster_size;
0460 }
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474 STATIC uint
0475 xfs_calc_link_reservation(
0476 struct xfs_mount *mp)
0477 {
0478 return XFS_DQUOT_LOGRES(mp) +
0479 xfs_calc_iunlink_remove_reservation(mp) +
0480 max((xfs_calc_inode_res(mp, 2) +
0481 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
0482 XFS_FSB_TO_B(mp, 1))),
0483 (xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
0484 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1),
0485 XFS_FSB_TO_B(mp, 1))));
0486 }
0487
0488
0489
0490
0491
0492
0493 STATIC uint
0494 xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
0495 {
0496 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
0497 M_IGEO(mp)->inode_cluster_size;
0498 }
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512 STATIC uint
0513 xfs_calc_remove_reservation(
0514 struct xfs_mount *mp)
0515 {
0516 return XFS_DQUOT_LOGRES(mp) +
0517 xfs_calc_iunlink_add_reservation(mp) +
0518 max((xfs_calc_inode_res(mp, 2) +
0519 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
0520 XFS_FSB_TO_B(mp, 1))),
0521 (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) +
0522 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2),
0523 XFS_FSB_TO_B(mp, 1))));
0524 }
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542 STATIC uint
0543 xfs_calc_create_resv_modify(
0544 struct xfs_mount *mp)
0545 {
0546 return xfs_calc_inode_res(mp, 2) +
0547 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
0548 (uint)XFS_FSB_TO_B(mp, 1) +
0549 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), XFS_FSB_TO_B(mp, 1)) +
0550 xfs_calc_finobt_res(mp);
0551 }
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561 STATIC uint
0562 xfs_calc_icreate_resv_alloc(
0563 struct xfs_mount *mp)
0564 {
0565 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
0566 mp->m_sb.sb_sectsize +
0567 xfs_calc_inode_chunk_res(mp, _ALLOC) +
0568 xfs_calc_inobt_res(mp) +
0569 xfs_calc_finobt_res(mp);
0570 }
0571
0572 STATIC uint
0573 xfs_calc_icreate_reservation(xfs_mount_t *mp)
0574 {
0575 return XFS_DQUOT_LOGRES(mp) +
0576 max(xfs_calc_icreate_resv_alloc(mp),
0577 xfs_calc_create_resv_modify(mp));
0578 }
0579
0580 STATIC uint
0581 xfs_calc_create_tmpfile_reservation(
0582 struct xfs_mount *mp)
0583 {
0584 uint res = XFS_DQUOT_LOGRES(mp);
0585
0586 res += xfs_calc_icreate_resv_alloc(mp);
0587 return res + xfs_calc_iunlink_add_reservation(mp);
0588 }
0589
0590
0591
0592
0593 STATIC uint
0594 xfs_calc_mkdir_reservation(
0595 struct xfs_mount *mp)
0596 {
0597 return xfs_calc_icreate_reservation(mp);
0598 }
0599
0600
0601
0602
0603
0604
0605
0606 STATIC uint
0607 xfs_calc_symlink_reservation(
0608 struct xfs_mount *mp)
0609 {
0610 return xfs_calc_icreate_reservation(mp) +
0611 xfs_calc_buf_res(1, XFS_SYMLINK_MAXLEN);
0612 }
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629 STATIC uint
0630 xfs_calc_ifree_reservation(
0631 struct xfs_mount *mp)
0632 {
0633 return XFS_DQUOT_LOGRES(mp) +
0634 xfs_calc_inode_res(mp, 1) +
0635 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
0636 xfs_calc_iunlink_remove_reservation(mp) +
0637 xfs_calc_inode_chunk_res(mp, _FREE) +
0638 xfs_calc_inobt_res(mp) +
0639 xfs_calc_finobt_res(mp);
0640 }
0641
0642
0643
0644
0645
0646 STATIC uint
0647 xfs_calc_ichange_reservation(
0648 struct xfs_mount *mp)
0649 {
0650 return XFS_DQUOT_LOGRES(mp) +
0651 xfs_calc_inode_res(mp, 1) +
0652 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
0653
0654 }
0655
0656
0657
0658
0659
0660
0661
0662 STATIC uint
0663 xfs_calc_growdata_reservation(
0664 struct xfs_mount *mp)
0665 {
0666 return xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
0667 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1),
0668 XFS_FSB_TO_B(mp, 1));
0669 }
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681 STATIC uint
0682 xfs_calc_growrtalloc_reservation(
0683 struct xfs_mount *mp)
0684 {
0685 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
0686 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
0687 XFS_FSB_TO_B(mp, 1)) +
0688 xfs_calc_inode_res(mp, 1) +
0689 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1),
0690 XFS_FSB_TO_B(mp, 1));
0691 }
0692
0693
0694
0695
0696
0697
0698 STATIC uint
0699 xfs_calc_growrtzero_reservation(
0700 struct xfs_mount *mp)
0701 {
0702 return xfs_calc_buf_res(1, mp->m_sb.sb_blocksize);
0703 }
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715 STATIC uint
0716 xfs_calc_growrtfree_reservation(
0717 struct xfs_mount *mp)
0718 {
0719 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
0720 xfs_calc_inode_res(mp, 2) +
0721 xfs_calc_buf_res(1, mp->m_sb.sb_blocksize) +
0722 xfs_calc_buf_res(1, mp->m_rsumsize);
0723 }
0724
0725
0726
0727
0728
0729 STATIC uint
0730 xfs_calc_swrite_reservation(
0731 struct xfs_mount *mp)
0732 {
0733 return xfs_calc_inode_res(mp, 1);
0734 }
0735
0736
0737
0738
0739
0740 STATIC uint
0741 xfs_calc_writeid_reservation(
0742 struct xfs_mount *mp)
0743 {
0744 return xfs_calc_inode_res(mp, 1);
0745 }
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755 STATIC uint
0756 xfs_calc_addafork_reservation(
0757 struct xfs_mount *mp)
0758 {
0759 return XFS_DQUOT_LOGRES(mp) +
0760 xfs_calc_inode_res(mp, 1) +
0761 xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
0762 xfs_calc_buf_res(1, mp->m_dir_geo->blksize) +
0763 xfs_calc_buf_res(XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1,
0764 XFS_FSB_TO_B(mp, 1)) +
0765 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1),
0766 XFS_FSB_TO_B(mp, 1));
0767 }
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780 STATIC uint
0781 xfs_calc_attrinval_reservation(
0782 struct xfs_mount *mp)
0783 {
0784 return max((xfs_calc_inode_res(mp, 1) +
0785 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
0786 XFS_FSB_TO_B(mp, 1))),
0787 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
0788 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 4),
0789 XFS_FSB_TO_B(mp, 1))));
0790 }
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803 STATIC uint
0804 xfs_calc_attrsetm_reservation(
0805 struct xfs_mount *mp)
0806 {
0807 return XFS_DQUOT_LOGRES(mp) +
0808 xfs_calc_inode_res(mp, 1) +
0809 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
0810 xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, XFS_FSB_TO_B(mp, 1));
0811 }
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823 STATIC uint
0824 xfs_calc_attrsetrt_reservation(
0825 struct xfs_mount *mp)
0826 {
0827 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
0828 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
0829 XFS_FSB_TO_B(mp, 1));
0830 }
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843 STATIC uint
0844 xfs_calc_attrrm_reservation(
0845 struct xfs_mount *mp)
0846 {
0847 return XFS_DQUOT_LOGRES(mp) +
0848 max((xfs_calc_inode_res(mp, 1) +
0849 xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH,
0850 XFS_FSB_TO_B(mp, 1)) +
0851 (uint)XFS_FSB_TO_B(mp,
0852 XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) +
0853 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), 0)),
0854 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
0855 xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2),
0856 XFS_FSB_TO_B(mp, 1))));
0857 }
0858
0859
0860
0861
0862 STATIC uint
0863 xfs_calc_clear_agi_bucket_reservation(
0864 struct xfs_mount *mp)
0865 {
0866 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
0867 }
0868
0869
0870
0871
0872
0873 STATIC uint
0874 xfs_calc_qm_setqlim_reservation(void)
0875 {
0876 return xfs_calc_buf_res(1, sizeof(struct xfs_disk_dquot));
0877 }
0878
0879
0880
0881
0882
0883
0884 STATIC uint
0885 xfs_calc_qm_dqalloc_reservation(
0886 struct xfs_mount *mp,
0887 bool for_minlogsize)
0888 {
0889 return xfs_calc_write_reservation(mp, for_minlogsize) +
0890 xfs_calc_buf_res(1,
0891 XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1);
0892 }
0893
0894 unsigned int
0895 xfs_calc_qm_dqalloc_reservation_minlogsize(
0896 struct xfs_mount *mp)
0897 {
0898 return xfs_calc_qm_dqalloc_reservation(mp, true);
0899 }
0900
0901
0902
0903
0904
0905 STATIC uint
0906 xfs_calc_sb_reservation(
0907 struct xfs_mount *mp)
0908 {
0909 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
0910 }
0911
0912 void
0913 xfs_trans_resv_calc(
0914 struct xfs_mount *mp,
0915 struct xfs_trans_resv *resp)
0916 {
0917 int logcount_adj = 0;
0918
0919
0920
0921
0922
0923 resp->tr_write.tr_logres = xfs_calc_write_reservation(mp, false);
0924 resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT;
0925 resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0926
0927 resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp, false);
0928 resp->tr_itruncate.tr_logcount = XFS_ITRUNCATE_LOG_COUNT;
0929 resp->tr_itruncate.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0930
0931 resp->tr_rename.tr_logres = xfs_calc_rename_reservation(mp);
0932 resp->tr_rename.tr_logcount = XFS_RENAME_LOG_COUNT;
0933 resp->tr_rename.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0934
0935 resp->tr_link.tr_logres = xfs_calc_link_reservation(mp);
0936 resp->tr_link.tr_logcount = XFS_LINK_LOG_COUNT;
0937 resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0938
0939 resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp);
0940 resp->tr_remove.tr_logcount = XFS_REMOVE_LOG_COUNT;
0941 resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0942
0943 resp->tr_symlink.tr_logres = xfs_calc_symlink_reservation(mp);
0944 resp->tr_symlink.tr_logcount = XFS_SYMLINK_LOG_COUNT;
0945 resp->tr_symlink.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0946
0947 resp->tr_create.tr_logres = xfs_calc_icreate_reservation(mp);
0948 resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT;
0949 resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0950
0951 resp->tr_create_tmpfile.tr_logres =
0952 xfs_calc_create_tmpfile_reservation(mp);
0953 resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT;
0954 resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0955
0956 resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp);
0957 resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT;
0958 resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0959
0960 resp->tr_ifree.tr_logres = xfs_calc_ifree_reservation(mp);
0961 resp->tr_ifree.tr_logcount = XFS_INACTIVE_LOG_COUNT;
0962 resp->tr_ifree.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0963
0964 resp->tr_addafork.tr_logres = xfs_calc_addafork_reservation(mp);
0965 resp->tr_addafork.tr_logcount = XFS_ADDAFORK_LOG_COUNT;
0966 resp->tr_addafork.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0967
0968 resp->tr_attrinval.tr_logres = xfs_calc_attrinval_reservation(mp);
0969 resp->tr_attrinval.tr_logcount = XFS_ATTRINVAL_LOG_COUNT;
0970 resp->tr_attrinval.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0971
0972 resp->tr_attrsetm.tr_logres = xfs_calc_attrsetm_reservation(mp);
0973 resp->tr_attrsetm.tr_logcount = XFS_ATTRSET_LOG_COUNT;
0974 resp->tr_attrsetm.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0975
0976 resp->tr_attrrm.tr_logres = xfs_calc_attrrm_reservation(mp);
0977 resp->tr_attrrm.tr_logcount = XFS_ATTRRM_LOG_COUNT;
0978 resp->tr_attrrm.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0979
0980 resp->tr_growrtalloc.tr_logres = xfs_calc_growrtalloc_reservation(mp);
0981 resp->tr_growrtalloc.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT;
0982 resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0983
0984 resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp,
0985 false);
0986 resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT;
0987 resp->tr_qm_dqalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
0988
0989
0990
0991
0992
0993 resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation();
0994 resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT;
0995
0996 resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp);
0997 resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT;
0998
0999
1000 resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp);
1001 resp->tr_growdata.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT;
1002 resp->tr_growdata.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
1003
1004
1005 resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp);
1006 resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp);
1007 resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp);
1008 resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp);
1009 resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp);
1010 resp->tr_growrtzero.tr_logres = xfs_calc_growrtzero_reservation(mp);
1011 resp->tr_growrtfree.tr_logres = xfs_calc_growrtfree_reservation(mp);
1012
1013
1014
1015
1016
1017
1018 if (xfs_has_reflink(mp) || xfs_has_rmapbt(mp))
1019 logcount_adj++;
1020 if (xfs_has_reflink(mp))
1021 logcount_adj++;
1022 if (xfs_has_rmapbt(mp))
1023 logcount_adj++;
1024
1025 resp->tr_itruncate.tr_logcount += logcount_adj;
1026 resp->tr_write.tr_logcount += logcount_adj;
1027 resp->tr_qm_dqalloc.tr_logcount += logcount_adj;
1028 }