···230230 * field (see the QCMD macro in quota.h). These macros help keep the231231 * code portable - they are not visible from the syscall interface.232232 */233233-#define Q_XSETGQLIM XQM_CMD(0x8) /* set groups disk limits */234234-#define Q_XGETGQUOTA XQM_CMD(0x9) /* get groups disk limits */233233+#define Q_XSETGQLIM XQM_CMD(8) /* set groups disk limits */234234+#define Q_XGETGQUOTA XQM_CMD(9) /* get groups disk limits */235235+#define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */236236+#define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */235237236238/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */237239/* we may well need to fine-tune this if it ever becomes an issue. */
+8-26
fs/xfs/linux-2.6/xfs_lrw.c
···209209 return (-status);210210}211211212212-/*213213- * xfs_inval_cached_pages214214- * 215215- * This routine is responsible for keeping direct I/O and buffered I/O216216- * somewhat coherent. From here we make sure that we're at least217217- * temporarily holding the inode I/O lock exclusively and then call218218- * the page cache to flush and invalidate any cached pages. If there219219- * are no cached pages this routine will be very quick.220220- */221221-void222222-xfs_inval_cached_pages(223223- vnode_t *vp,224224- xfs_iocore_t *io,225225- xfs_off_t offset,226226- int write,227227- int relock)228228-{229229- if (VN_CACHED(vp)) {230230- xfs_inval_cached_trace(io, offset, -1, ctooff(offtoct(offset)), -1);231231- VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);232232- }233233-234234-}235235-236212ssize_t /* bytes read, or (-) error */237213xfs_read(238214 bhv_desc_t *bdp,···280304 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&281305 !(ioflags & IO_INVIS)) {282306 vrwlock_t locktype = VRWLOCK_READ;307307+ int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);283308284309 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ,285310 BHV_TO_VNODE(bdp), *offset, size,286286- FILP_DELAY_FLAG(file), &locktype);311311+ dmflags, &locktype);287312 if (ret) {288313 xfs_iunlock(ip, XFS_IOLOCK_SHARED);289314 goto unlock_isem;···844867 !(ioflags & IO_INVIS)) {845868846869 xfs_rwunlock(bdp, locktype);870870+ if (need_isem)871871+ up(&inode->i_sem);847872 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,848873 DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL,849874 0, 0, 0); /* Delay flag intentionally unused */850875 if (error)851851- goto out_unlock_isem;876876+ goto out_nounlocks;877877+ if (need_isem)878878+ down(&inode->i_sem);852879 xfs_rwlock(bdp, locktype);853880 pos = xip->i_d.di_size;854881 ret = 0;···967986 out_unlock_isem:968987 if (need_isem)969988 up(&inode->i_sem);989989+ out_nounlocks:970990 return -error;971991}972992
···426426 u_long va_extsize; /* file extent size */427427 u_long va_nextents; /* number of extents in file */428428 u_long va_anextents; /* number of attr extents in file */429429- int va_projid; /* project id */429429+ prid_t va_projid; /* project id */430430} vattr_t;431431432432/*
+26-79
fs/xfs/quota/xfs_dquot.c
···101101 * is the d_id field. The idea is to fill in the entire q_core102102 * when we read in the on disk dquot.103103 */104104-xfs_dquot_t *104104+STATIC xfs_dquot_t *105105xfs_qm_dqinit(106106 xfs_mount_t *mp,107107 xfs_dqid_t id,···286286 * We also return 0 as the values of the timers in Q_GETQUOTA calls, when287287 * enforcement's off.288288 * In contrast, warnings are a little different in that they don't289289- * 'automatically' get started when limits get exceeded.289289+ * 'automatically' get started when limits get exceeded. They do290290+ * get reset to zero, however, when we find the count to be under291291+ * the soft limit (they are only ever set non-zero via userspace).290292 */291293void292294xfs_qm_adjust_dqtimers(···317315 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) {318316 INT_SET(d->d_btimer, ARCH_CONVERT,319317 get_seconds() + XFS_QI_BTIMELIMIT(mp));318318+ } else {319319+ d->d_bwarns = 0;320320 }321321 } else {322322 if ((!d->d_blk_softlimit ||···340336 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) {341337 INT_SET(d->d_itimer, ARCH_CONVERT,342338 get_seconds() + XFS_QI_ITIMELIMIT(mp));339339+ } else {340340+ d->d_iwarns = 0;343341 }344342 } else {345343 if ((!d->d_ino_softlimit ||···363357 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) {364358 INT_SET(d->d_rtbtimer, ARCH_CONVERT,365359 get_seconds() + XFS_QI_RTBTIMELIMIT(mp));360360+ } else {361361+ d->d_rtbwarns = 0;366362 }367363 } else {368364 if ((!d->d_rtb_softlimit ||···377369 }378370 }379371}380380-381381-/*382382- * Increment or reset warnings of a given dquot.383383- */384384-int385385-xfs_qm_dqwarn(386386- xfs_disk_dquot_t *d,387387- uint flags)388388-{389389- int warned;390390-391391- /*392392- * root's limits are not real limits.393393- */394394- if (!d->d_id)395395- return (0);396396-397397- warned = 0;398398- if (INT_GET(d->d_blk_softlimit, ARCH_CONVERT) &&399399- (INT_GET(d->d_bcount, ARCH_CONVERT) >=400400- INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) {401401- if (flags & XFS_QMOPT_DOWARN) {402402- INT_MOD(d->d_bwarns, ARCH_CONVERT, +1);403403- warned++;404404- }405405- } else {406406- if (!d->d_blk_softlimit ||407407- (INT_GET(d->d_bcount, ARCH_CONVERT) <408408- INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) {409409- d->d_bwarns = 0;410410- }411411- }412412-413413- if (INT_GET(d->d_ino_softlimit, ARCH_CONVERT) > 0 &&414414- (INT_GET(d->d_icount, ARCH_CONVERT) >=415415- INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) {416416- if (flags & XFS_QMOPT_DOWARN) {417417- INT_MOD(d->d_iwarns, ARCH_CONVERT, +1);418418- warned++;419419- }420420- } else {421421- if (!d->d_ino_softlimit ||422422- (INT_GET(d->d_icount, ARCH_CONVERT) <423423- INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) {424424- d->d_iwarns = 0;425425- }426426- }427427-#ifdef QUOTADEBUG428428- if (INT_GET(d->d_iwarns, ARCH_CONVERT))429429- cmn_err(CE_DEBUG,430430- "--------@@Inode warnings running : %Lu >= %Lu",431431- INT_GET(d->d_icount, ARCH_CONVERT),432432- INT_GET(d->d_ino_softlimit, ARCH_CONVERT));433433- if (INT_GET(d->d_bwarns, ARCH_CONVERT))434434- cmn_err(CE_DEBUG,435435- "--------@@Blks warnings running : %Lu >= %Lu",436436- INT_GET(d->d_bcount, ARCH_CONVERT),437437- INT_GET(d->d_blk_softlimit, ARCH_CONVERT));438438-#endif439439- return (warned);440440-}441441-442372443373/*444374 * initialize a buffer full of dquots and log the whole thing···407461 for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++, curid++)408462 xfs_qm_dqinit_core(curid, type, d);409463 xfs_trans_dquot_buf(tp, bp,410410- type & XFS_DQ_USER ?411411- XFS_BLI_UDQUOT_BUF :412412- XFS_BLI_GDQUOT_BUF);464464+ (type & XFS_DQ_USER ? XFS_BLI_UDQUOT_BUF :465465+ ((type & XFS_DQ_PROJ) ? XFS_BLI_PDQUOT_BUF :466466+ XFS_BLI_GDQUOT_BUF)));413467 xfs_trans_log_buf(tp, bp, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1);414468}415469···490544 * the entire thing.491545 */492546 xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT),493493- dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP),494494- bp);547547+ dqp->dq_flags & XFS_DQ_ALLTYPES, bp);495548496549 if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) {497550 goto error1;···620675 /*621676 * A simple sanity check in case we got a corrupted dquot...622677 */623623- if (xfs_qm_dqcheck(ddq, id,624624- dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP),678678+ if (xfs_qm_dqcheck(ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES,625679 flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN),626680 "dqtobp")) {627681 if (!(flags & XFS_QMOPT_DQREPAIR)) {···897953xfs_qm_dqget(898954 xfs_mount_t *mp,899955 xfs_inode_t *ip, /* locked inode (optional) */900900- xfs_dqid_t id, /* gid or uid, depending on type */901901- uint type, /* UDQUOT or GDQUOT */956956+ xfs_dqid_t id, /* uid/projid/gid depending on type */957957+ uint type, /* XFS_DQ_USER/XFS_DQ_PROJ/XFS_DQ_GROUP */902958 uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */903959 xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */904960{···909965910966 ASSERT(XFS_IS_QUOTA_RUNNING(mp));911967 if ((! XFS_IS_UQUOTA_ON(mp) && type == XFS_DQ_USER) ||968968+ (! XFS_IS_PQUOTA_ON(mp) && type == XFS_DQ_PROJ) ||912969 (! XFS_IS_GQUOTA_ON(mp) && type == XFS_DQ_GROUP)) {913970 return (ESRCH);914971 }···928983 again:929984930985#ifdef DEBUG931931- ASSERT(type == XFS_DQ_USER || type == XFS_DQ_GROUP);986986+ ASSERT(type == XFS_DQ_USER ||987987+ type == XFS_DQ_PROJ ||988988+ type == XFS_DQ_GROUP);932989 if (ip) {933990 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));934991 if (type == XFS_DQ_USER)···12531306 return (error);12541307 }1255130812561256- if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), 0, XFS_QMOPT_DOWARN,12571257- "dqflush (incore copy)")) {13091309+ if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT),13101310+ 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) {12581311 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE);12591312 return XFS_ERROR(EIO);12601313 }···14061459{14071460 if (d1 && d2) {14081461 ASSERT(d1 != d2);14091409- if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > INT_GET(d2->q_core.d_id, ARCH_CONVERT)) {14621462+ if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) >14631463+ INT_GET(d2->q_core.d_id, ARCH_CONVERT)) {14101464 xfs_dqlock(d2);14111465 xfs_dqlock(d1);14121466 } else {···15301582 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------");15311583 cmn_err(CE_DEBUG, "---- dquotID = %d",15321584 (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT));15331533- cmn_err(CE_DEBUG, "---- type = %s",15341534- XFS_QM_ISUDQ(dqp) ? "USR" : "GRP");15851585+ cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp));15351586 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount);15361587 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno);15371588 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset);
···5959#define XFSA_FIXUP_BNO_OK 16060#define XFSA_FIXUP_CNT_OK 261616262-int6262+STATIC int6363xfs_alloc_search_busy(xfs_trans_t *tp,6464 xfs_agnumber_t agno,6565 xfs_agblock_t bno,···25622562/*25632563 * returns non-zero if any of (agno,bno):len is in a busy list25642564 */25652565-int25652565+STATIC int25662566xfs_alloc_search_busy(xfs_trans_t *tp,25672567 xfs_agnumber_t agno,25682568 xfs_agblock_t bno,
+12-5
fs/xfs/xfs_attr.c
···7171 * Provide the external interfaces to manage attribute lists.7272 */73737474+#define ATTR_SYSCOUNT 27575+STATIC struct attrnames posix_acl_access;7676+STATIC struct attrnames posix_acl_default;7777+STATIC struct attrnames *attr_system_names[ATTR_SYSCOUNT];7878+7479/*========================================================================7580 * Function prototypes for the kernel.7681 *========================================================================*/···8883/*8984 * Internal routines when attribute list is one block.9085 */8686+STATIC int xfs_attr_leaf_get(xfs_da_args_t *args);9187STATIC int xfs_attr_leaf_addname(xfs_da_args_t *args);9288STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args);9389STATIC int xfs_attr_leaf_list(xfs_attr_list_context_t *context);···9690/*9791 * Internal routines when attribute list is more than one block.9892 */9393+STATIC int xfs_attr_node_get(xfs_da_args_t *args);9994STATIC int xfs_attr_node_addname(xfs_da_args_t *args);10095STATIC int xfs_attr_node_removename(xfs_da_args_t *args);10196STATIC int xfs_attr_node_list(xfs_attr_list_context_t *context);···11091102 * This leaf block cannot have a "remote" value, we only call this routine11101103 * if bmap_one_block() says there is only one block (ie: no remote blks).11111104 */11121112-int11051105+STATIC int11131106xfs_attr_leaf_get(xfs_da_args_t *args)11141107{11151108 xfs_dabuf_t *bp;···17141707 * block, ie: both true Btree attr lists and for single-leaf-blocks with17151708 * "remote" values taking up more blocks.17161709 */17171717-int17101710+STATIC int17181711xfs_attr_node_get(xfs_da_args_t *args)17191712{17201713 xfs_da_state_t *state;···24052398 return xfs_acl_vhasacl_default(vp);24062399}2407240024082408-struct attrnames posix_acl_access = {24012401+STATIC struct attrnames posix_acl_access = {24092402 .attr_name = "posix_acl_access",24102403 .attr_namelen = sizeof("posix_acl_access") - 1,24112404 .attr_get = posix_acl_access_get,···24142407 .attr_exists = posix_acl_access_exists,24152408};2416240924172417-struct attrnames posix_acl_default = {24102410+STATIC struct attrnames posix_acl_default = {24182411 .attr_name = "posix_acl_default",24192412 .attr_namelen = sizeof("posix_acl_default") - 1,24202413 .attr_get = posix_acl_default_get,···24232416 .attr_exists = posix_acl_default_exists,24242417};2425241824262426-struct attrnames *attr_system_names[] =24192419+STATIC struct attrnames *attr_system_names[] =24272420 { &posix_acl_access, &posix_acl_default };2428242124292422
···7979/*8080 * Routines used for growing the Btree.8181 */8282+STATIC int xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t which_block,8383+ xfs_dabuf_t **bpp);8284STATIC int xfs_attr_leaf_add_work(xfs_dabuf_t *leaf_buffer, xfs_da_args_t *args,8385 int freemap_index);8486STATIC void xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *leaf_buffer);···9492 int *number_usedbytes_in_blk1);95939694/*9595+ * Routines used for shrinking the Btree.9696+ */9797+STATIC int xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp,9898+ xfs_dabuf_t *bp, int level);9999+STATIC int xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp,100100+ xfs_dabuf_t *bp);101101+STATIC int xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,102102+ xfs_dablk_t blkno, int blkcnt);103103+104104+/*97105 * Utility routines.98106 */99107STATIC void xfs_attr_leaf_moveents(xfs_attr_leafblock_t *src_leaf,···11199 xfs_attr_leafblock_t *dst_leaf,112100 int dst_start, int move_count,113101 xfs_mount_t *mp);102102+STATIC int xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index);103103+STATIC int xfs_attr_put_listent(xfs_attr_list_context_t *context,104104+ attrnames_t *, char *name, int namelen,105105+ int valuelen);114106115107116108/*========================================================================···790774 * Create the initial contents of a leaf attribute list791775 * or a leaf in a node attribute list.792776 */793793-int777777+STATIC int794778xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp)795779{796780 xfs_attr_leafblock_t *leaf;···22252209 * Calculate the number of bytes used to store the indicated attribute22262210 * (whether local or remote only calculate bytes in this block).22272211 */22282228-int22122212+STATIC int22292213xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index)22302214{22312215 xfs_attr_leaf_name_local_t *name_loc;···23962380 * we may be reading them directly out of a user buffer.23972381 */23982382/*ARGSUSED*/23992399-int23832383+STATIC int24002384xfs_attr_put_listent(xfs_attr_list_context_t *context,24012385 attrnames_t *namesp, char *name, int namelen, int valuelen)24022386{···27562740 * Recurse (gasp!) through the attribute nodes until we find leaves.27572741 * We're doing a depth-first traversal in order to invalidate everything.27582742 */27592759-int27432743+STATIC int27602744xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp,27612745 int level)27622746{···28652849 * Note that we must release the lock on the buffer so that we are not28662850 * caught holding something that the logging code wants to flush to disk.28672851 */28682868-int28522852+STATIC int28692853xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)28702854{28712855 xfs_attr_leafblock_t *leaf;···29502934 * Look at all the extents for this logical region,29512935 * invalidate any buffers that are incore/in transactions.29522936 */29532953-int29372937+STATIC int29542938xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,29552939 xfs_dablk_t blkno, int blkcnt)29562940{
···4545/*4646 * Index of high bit number in byte, -1 for none set, 0..7 otherwise.4747 */4848-const char xfs_highbit[256] = {4848+STATIC const char xfs_highbit[256] = {4949 -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */5050 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */5151 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */
+78-49
fs/xfs/xfs_bmap.c
···301301 xfs_bmbt_irec_t *gotp, /* out: extent entry found */302302 xfs_bmbt_irec_t *prevp); /* out: previous extent entry found */303303304304+/*305305+ * Check the last inode extent to determine whether this allocation will result306306+ * in blocks being allocated at the end of the file. When we allocate new data307307+ * blocks at the end of the file which do not start at the previous data block,308308+ * we will try to align the new blocks at stripe unit boundaries.309309+ */310310+STATIC int /* error */311311+xfs_bmap_isaeof(312312+ xfs_inode_t *ip, /* incore inode pointer */313313+ xfs_fileoff_t off, /* file offset in fsblocks */314314+ int whichfork, /* data or attribute fork */315315+ char *aeof); /* return value */316316+304317#ifdef XFS_BMAP_TRACE305318/*306319 * Add a bmap trace buffer entry. Base routine for the others.···45454532 xfs_extlen_t alen; /* allocated extent length */45464533 xfs_fileoff_t aoff; /* allocated file offset */45474534 xfs_bmalloca_t bma; /* args for xfs_bmap_alloc */45484548- char contig; /* allocation must be one extent */45494535 xfs_btree_cur_t *cur; /* bmap btree cursor */45504550- char delay; /* this request is for delayed alloc */45514536 xfs_fileoff_t end; /* end of mapped file region */45524537 int eof; /* we've hit the end of extent list */45384538+ char contig; /* allocation must be one extent */45394539+ char delay; /* this request is for delayed alloc */45404540+ char exact; /* don't do all of wasdelayed extent */45534541 xfs_bmbt_rec_t *ep; /* extent list entry pointer */45544542 int error; /* error return */45554555- char exact; /* don't do all of wasdelayed extent */45564543 xfs_bmbt_irec_t got; /* current extent list record */45574544 xfs_ifork_t *ifp; /* inode fork pointer */45584545 xfs_extlen_t indlen; /* indirect blocks length */45594559- char inhole; /* current location is hole in file */45604546 xfs_extnum_t lastx; /* last useful extent number */45614547 int logflags; /* flags for transaction logging */45624548 xfs_extlen_t minleft; /* min blocks left after allocation */···45664554 xfs_extnum_t nextents; /* number of extents in file */45674555 xfs_fileoff_t obno; /* old block number (offset) */45684556 xfs_bmbt_irec_t prev; /* previous extent list record */45694569- char stateless; /* ignore state flag set */45704557 int tmp_logflags; /* temp flags holder */45584558+ int whichfork; /* data or attr fork */45594559+ char inhole; /* current location is hole in file */45604560+ char stateless; /* ignore state flag set */45714561 char trim; /* output trimmed to match range */45724562 char userdata; /* allocating non-metadata */45734563 char wasdelay; /* old extent was delayed */45744574- int whichfork; /* data or attr fork */45754564 char wr; /* this is a write request */45654565+ char rt; /* this is a realtime file */45764566 char rsvd; /* OK to allocate reserved blocks */45774567#ifdef DEBUG45784568 xfs_fileoff_t orig_bno; /* original block number value */···46044590 }46054591 if (XFS_FORCED_SHUTDOWN(mp))46064592 return XFS_ERROR(EIO);45934593+ rt = XFS_IS_REALTIME_INODE(ip);46074594 ifp = XFS_IFORK_PTR(ip, whichfork);46084595 ASSERT(ifp->if_ext_max ==46094596 XFS_IFORK_SIZE(ip, whichfork) / (uint)sizeof(xfs_bmbt_rec_t));···47094694 }47104695 minlen = contig ? alen : 1;47114696 if (delay) {47124712- indlen = (xfs_extlen_t)47134713- xfs_bmap_worst_indlen(ip, alen);47144714- ASSERT(indlen > 0);46974697+ xfs_extlen_t extsz = 0;46984698+46994699+ /* Figure out the extent size, adjust alen */47004700+ if (rt) {47014701+ if (!(extsz = ip->i_d.di_extsize))47024702+ extsz = mp->m_sb.sb_rextsize;47034703+ alen = roundup(alen, extsz);47044704+ extsz = alen / mp->m_sb.sb_rextsize;47054705+ }47064706+47154707 /*47164708 * Make a transaction-less quota reservation for47174709 * delayed allocation blocks. This number gets···47264704 * We return EDQUOT if we haven't allocated47274705 * blks already inside this loop;47284706 */47294729- if (XFS_TRANS_RESERVE_BLKQUOTA(47304730- mp, NULL, ip, (long)alen)) {47074707+ if (XFS_TRANS_RESERVE_QUOTA_NBLKS(47084708+ mp, NULL, ip, (long)alen, 0,47094709+ rt ? XFS_QMOPT_RES_RTBLKS :47104710+ XFS_QMOPT_RES_REGBLKS)) {47314711 if (n == 0) {47324712 *nmap = 0;47334713 ASSERT(cur == NULL);···47424718 * Split changing sb for alen and indlen since47434719 * they could be coming from different places.47444720 */47454745- if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) {47464746- xfs_extlen_t extsz;47474747- xfs_extlen_t ralen;47484748- if (!(extsz = ip->i_d.di_extsize))47494749- extsz = mp->m_sb.sb_rextsize;47504750- ralen = roundup(alen, extsz);47514751- ralen = ralen / mp->m_sb.sb_rextsize;47524752- if (xfs_mod_incore_sb(mp,47534753- XFS_SBS_FREXTENTS,47544754- -(ralen), rsvd)) {47554755- if (XFS_IS_QUOTA_ON(ip->i_mount))47564756- XFS_TRANS_UNRESERVE_BLKQUOTA(47574757- mp, NULL, ip,47584758- (long)alen);47594759- break;47604760- }47614761- } else {47624762- if (xfs_mod_incore_sb(mp,47634763- XFS_SBS_FDBLOCKS,47644764- -(alen), rsvd)) {47654765- if (XFS_IS_QUOTA_ON(ip->i_mount))47664766- XFS_TRANS_UNRESERVE_BLKQUOTA(47674767- mp, NULL, ip,47684768- (long)alen);47694769- break;47704770- }47714771- }47214721+ indlen = (xfs_extlen_t)47224722+ xfs_bmap_worst_indlen(ip, alen);47234723+ ASSERT(indlen > 0);4772472447734773- if (xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS,47744774- -(indlen), rsvd)) {47754775- XFS_TRANS_UNRESERVE_BLKQUOTA(47764776- mp, NULL, ip, (long)alen);47254725+ if (rt)47264726+ error = xfs_mod_incore_sb(mp,47274727+ XFS_SBS_FREXTENTS,47284728+ -(extsz), rsvd);47294729+ else47304730+ error = xfs_mod_incore_sb(mp,47314731+ XFS_SBS_FDBLOCKS,47324732+ -(alen), rsvd);47334733+ if (!error)47344734+ error = xfs_mod_incore_sb(mp,47354735+ XFS_SBS_FDBLOCKS,47364736+ -(indlen), rsvd);47374737+47384738+ if (error) {47394739+ if (XFS_IS_QUOTA_ON(ip->i_mount))47404740+ /* unreserve the blocks now */47414741+ XFS_TRANS_UNRESERVE_QUOTA_NBLKS(47424742+ mp, NULL, ip,47434743+ (long)alen, 0, rt ?47444744+ XFS_QMOPT_RES_RTBLKS :47454745+ XFS_QMOPT_RES_REGBLKS);47774746 break;47784747 }47484748+47794749 ip->i_delayed_blks += alen;47804750 abno = NULLSTARTBLOCK(indlen);47814751 } else {···53945376 }53955377 if (wasdel) {53965378 ASSERT(STARTBLOCKVAL(del.br_startblock) > 0);53975397- xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS,53985398- (int)del.br_blockcount, rsvd);53995399- /* Unreserve our quota space */54005400- XFS_TRANS_RESERVE_QUOTA_NBLKS(54015401- mp, NULL, ip, -((long)del.br_blockcount), 0,54025402- isrt ? XFS_QMOPT_RES_RTBLKS :53795379+ /* Update realtim/data freespace, unreserve quota */53805380+ if (isrt) {53815381+ xfs_filblks_t rtexts;53825382+53835383+ rtexts = XFS_FSB_TO_B(mp, del.br_blockcount);53845384+ do_div(rtexts, mp->m_sb.sb_rextsize);53855385+ xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS,53865386+ (int)rtexts, rsvd);53875387+ XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, NULL, ip,53885388+ -((long)del.br_blockcount), 0,53895389+ XFS_QMOPT_RES_RTBLKS);53905390+ } else {53915391+ xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS,53925392+ (int)del.br_blockcount, rsvd);53935393+ XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, NULL, ip,53945394+ -((long)del.br_blockcount), 0,54035395 XFS_QMOPT_RES_REGBLKS);53965396+ }54045397 ip->i_delayed_blks -= del.br_blockcount;54055398 if (cur)54065399 cur->bc_private.b.flags |=···57435714 * blocks at the end of the file which do not start at the previous data block,57445715 * we will try to align the new blocks at stripe unit boundaries.57455716 */57465746-int /* error */57175717+STATIC int /* error */57475718xfs_bmap_isaeof(57485719 xfs_inode_t *ip, /* incore inode pointer */57495720 xfs_fileoff_t off, /* file offset in fsblocks */
-13
fs/xfs/xfs_bmap.h
···332332 int iflags); /* interface flags */333333334334/*335335- * Check the last inode extent to determine whether this allocation will result336336- * in blocks being allocated at the end of the file. When we allocate new data337337- * blocks at the end of the file which do not start at the previous data block,338338- * we will try to align the new blocks at stripe unit boundaries.339339- */340340-int341341-xfs_bmap_isaeof(342342- struct xfs_inode *ip,343343- xfs_fileoff_t off,344344- int whichfork,345345- char *aeof);346346-347347-/*348335 * Check if the endoff is outside the last extent. If so the caller will grow349336 * the allocation to a stripe unit boundary350337 */
-14
fs/xfs/xfs_bmap_btree.c
···23312331 return xfs_bmbt_lookup(cur, XFS_LOOKUP_GE, stat);23322332}2333233323342334-int /* error */23352335-xfs_bmbt_lookup_le(23362336- xfs_btree_cur_t *cur,23372337- xfs_fileoff_t off,23382338- xfs_fsblock_t bno,23392339- xfs_filblks_t len,23402340- int *stat) /* success/failure */23412341-{23422342- cur->bc_rec.b.br_startoff = off;23432343- cur->bc_rec.b.br_startblock = bno;23442344- cur->bc_rec.b.br_blockcount = len;23452345- return xfs_bmbt_lookup(cur, XFS_LOOKUP_LE, stat);23462346-}23472347-23482334/*23492335 * Give the bmap btree a new root block. Copy the old broot contents23502336 * down into a real block and make the broot point to it.
-8
fs/xfs/xfs_bmap_btree.h
···580580 xfs_filblks_t,581581 int *);582582583583-int584584-xfs_bmbt_lookup_le(585585- struct xfs_btree_cur *,586586- xfs_fileoff_t,587587- xfs_fsblock_t,588588- xfs_filblks_t,589589- int *);590590-591583/*592584 * Give the bmap btree a new root block. Copy the old broot contents593585 * down into a real block and make the broot point to it.
+11-1
fs/xfs/xfs_btree.c
···9090 */91919292/*9393+ * Retrieve the block pointer from the cursor at the given level.9494+ * This may be a bmap btree root or from a buffer.9595+ */9696+STATIC xfs_btree_block_t * /* generic btree block pointer */9797+xfs_btree_get_block(9898+ xfs_btree_cur_t *cur, /* btree cursor */9999+ int level, /* level in btree */100100+ struct xfs_buf **bpp); /* buffer containing the block */101101+102102+/*93103 * Checking routine: return maxrecs for the block.94104 */95105STATIC int /* number of records fitting in block */···507497 * Retrieve the block pointer from the cursor at the given level.508498 * This may be a bmap btree root or from a buffer.509499 */510510-xfs_btree_block_t * /* generic btree block pointer */500500+STATIC xfs_btree_block_t * /* generic btree block pointer */511501xfs_btree_get_block(512502 xfs_btree_cur_t *cur, /* btree cursor */513503 int level, /* level in btree */
-10
fs/xfs/xfs_btree.h
···325325 int level); /* level to change */326326327327/*328328- * Retrieve the block pointer from the cursor at the given level.329329- * This may be a bmap btree root or from a buffer.330330- */331331-xfs_btree_block_t * /* generic btree block pointer */332332-xfs_btree_get_block(333333- xfs_btree_cur_t *cur, /* btree cursor */334334- int level, /* level in btree */335335- struct xfs_buf **bpp); /* buffer containing the block */336336-337337-/*338328 * Get a buffer for the block, return it with no data read.339329 * Long-form addressing.340330 */
+12-12
fs/xfs/xfs_buf_item.c
···172172 *173173 * If the XFS_BLI_STALE flag has been set, then log nothing.174174 */175175-uint175175+STATIC uint176176xfs_buf_item_size(177177 xfs_buf_log_item_t *bip)178178{···240240 * format structure, and the rest point to contiguous chunks241241 * within the buffer.242242 */243243-void243243+STATIC void244244xfs_buf_item_format(245245 xfs_buf_log_item_t *bip,246246 xfs_log_iovec_t *log_vector)···365365 * item in memory so it cannot be written out. Simply call bpin()366366 * on the buffer to do this.367367 */368368-void368368+STATIC void369369xfs_buf_item_pin(370370 xfs_buf_log_item_t *bip)371371{···391391 * If the XFS_BLI_STALE flag is set and we are the last reference,392392 * then free up the buf log item and unlock the buffer.393393 */394394-void394394+STATIC void395395xfs_buf_item_unpin(396396 xfs_buf_log_item_t *bip,397397 int stale)···446446 * so we need to free the item's descriptor (that points to the item)447447 * in the transaction.448448 */449449-void449449+STATIC void450450xfs_buf_item_unpin_remove(451451 xfs_buf_log_item_t *bip,452452 xfs_trans_t *tp)···493493 * the lock right away, return 0. If we can get the lock, pull the494494 * buffer from the free list, mark it busy, and return 1.495495 */496496-uint496496+STATIC uint497497xfs_buf_item_trylock(498498 xfs_buf_log_item_t *bip)499499{···537537 * This is for support of xfs_trans_bhold(). Make sure the538538 * XFS_BLI_HOLD field is cleared if we don't free the item.539539 */540540-void540540+STATIC void541541xfs_buf_item_unlock(542542 xfs_buf_log_item_t *bip)543543{···635635 * by returning the original lsn of that transaction here rather than636636 * the current one.637637 */638638-xfs_lsn_t638638+STATIC xfs_lsn_t639639xfs_buf_item_committed(640640 xfs_buf_log_item_t *bip,641641 xfs_lsn_t lsn)···654654 * and have aborted this transaction, we'll trap this buffer when it tries to655655 * get written out.656656 */657657-void657657+STATIC void658658xfs_buf_item_abort(659659 xfs_buf_log_item_t *bip)660660{···674674 * B_DELWRI set, then get it going out to disk with a call to bawrite().675675 * If not, then just release the buffer.676676 */677677-void677677+STATIC void678678xfs_buf_item_push(679679 xfs_buf_log_item_t *bip)680680{···693693}694694695695/* ARGSUSED */696696-void696696+STATIC void697697xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn)698698{699699}···701701/*702702 * This is the ops vector shared by all buf log items.703703 */704704-struct xfs_item_ops xfs_buf_item_ops = {704704+STATIC struct xfs_item_ops xfs_buf_item_ops = {705705 .iop_size = (uint(*)(xfs_log_item_t*))xfs_buf_item_size,706706 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))707707 xfs_buf_item_format,
+1-1
fs/xfs/xfs_buf_item.h
···8080 * user or group dquots and may require special recovery handling.8181 */8282#define XFS_BLI_UDQUOT_BUF 0x48383-/* #define XFS_BLI_PDQUOT_BUF 0x8 */8383+#define XFS_BLI_PDQUOT_BUF 0x88484#define XFS_BLI_GDQUOT_BUF 0x1085858686#define XFS_BLI_CHUNK 128
+6-3
fs/xfs/xfs_da_btree.c
···113113STATIC uint xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count);114114STATIC int xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp);115115STATIC xfs_dabuf_t *xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra);116116-116116+STATIC int xfs_da_blk_unlink(xfs_da_state_t *state,117117+ xfs_da_state_blk_t *drop_blk,118118+ xfs_da_state_blk_t *save_blk);119119+STATIC void xfs_da_state_kill_altpath(xfs_da_state_t *state);117120118121/*========================================================================119122 * Routines used for growing the Btree.···14271424/*14281425 * Unlink a block from a doubly linked list of blocks.14291426 */14301430-int /* error */14271427+STATIC int /* error */14311428xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,14321429 xfs_da_state_blk_t *save_blk)14331430{···23842381/*23852382 * Kill the altpath contents of a da-state structure.23862383 */23872387-void23842384+STATIC void23882385xfs_da_state_kill_altpath(xfs_da_state_t *state)23892386{23902387 int i;
···180180 goto error0;181181 }182182183183- if (VN_CACHED(tvp) != 0)184184- xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore),185185- (xfs_off_t)0, 0, 0);183183+ if (VN_CACHED(tvp) != 0) {184184+ xfs_inval_cached_trace(&tip->i_iocore, 0, -1, 0, -1);185185+ VOP_FLUSHINVAL_PAGES(tvp, 0, -1, FI_REMAPF_LOCKED);186186+ }186187187188 /* Verify O_DIRECT for ftmp */188189 if (VN_CACHED(tvp) != 0) {
+1-1
fs/xfs/xfs_dir2_data.c
···304304/*305305 * Remove a bestfree entry from the table.306306 */307307-void307307+STATIC void308308xfs_dir2_data_freeremove(309309 xfs_dir2_data_t *d, /* data block pointer */310310 xfs_dir2_data_free_t *dfp, /* bestfree entry pointer */
-4
fs/xfs/xfs_dir2_data.h
···193193 xfs_dir2_data_unused_t *dup, int *loghead);194194195195extern void196196- xfs_dir2_data_freeremove(xfs_dir2_data_t *d,197197- xfs_dir2_data_free_t *dfp, int *loghead);198198-199199-extern void200196 xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d,201197 int *loghead, char *aendp);202198
+6-2
fs/xfs/xfs_dir2_leaf.c
···7777#endif7878static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **lbpp,7979 int *indexp, xfs_dabuf_t **dbpp);8080+static void xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,8181+ int first, int last);8282+static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp);8383+80848185/*8286 * Convert a block form directory to a leaf form directory.···12181214/*12191215 * Log the bests entries indicated from a leaf1 block.12201216 */12211221-void12171217+static void12221218xfs_dir2_leaf_log_bests(12231219 xfs_trans_t *tp, /* transaction pointer */12241220 xfs_dabuf_t *bp, /* leaf buffer */···12821278/*12831279 * Log the tail of the leaf1 block.12841280 */12851285-void12811281+STATIC void12861282xfs_dir2_leaf_log_tail(12871283 xfs_trans_t *tp, /* transaction pointer */12881284 xfs_dabuf_t *bp) /* leaf buffer */
-7
fs/xfs/xfs_dir2_leaf.h
···330330 int first, int last);331331332332extern void333333- xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,334334- int first, int last);335335-336336-extern void337333 xfs_dir2_leaf_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp);338338-339339-extern void340340- xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp);341334342335extern int343336 xfs_dir2_leaf_lookup(struct xfs_da_args *args);
+5-1
fs/xfs/xfs_dir_leaf.c
···9191 int *number_entries_in_blk1,9292 int *number_namebytes_in_blk1);93939494+STATIC int xfs_dir_leaf_create(struct xfs_da_args *args,9595+ xfs_dablk_t which_block,9696+ struct xfs_dabuf **bpp);9797+9498/*9599 * Utility routines.96100 */···785781 * Create the initial contents of a leaf directory786782 * or a leaf in a node directory.787783 */788788-int784784+STATIC int789785xfs_dir_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp)790786{791787 xfs_dir_leafblock_t *leaf;
-2
fs/xfs/xfs_dir_leaf.h
···202202/*203203 * Routines used for growing the Btree.204204 */205205-int xfs_dir_leaf_create(struct xfs_da_args *args, xfs_dablk_t which_block,206206- struct xfs_dabuf **bpp);207205int xfs_dir_leaf_split(struct xfs_da_state *state,208206 struct xfs_da_state_blk *oldblk,209207 struct xfs_da_state_blk *newblk);
···146146#endif147147148148/*149149- * called from bwrite on xfs inode buffers150150- */151151-void152152-xfs_inobp_bwcheck(xfs_buf_t *bp)153153-{154154- xfs_mount_t *mp;155155- int i;156156- int j;157157- xfs_dinode_t *dip;158158-159159- ASSERT(XFS_BUF_FSPRIVATE3(bp, void *) != NULL);160160-161161- mp = XFS_BUF_FSPRIVATE3(bp, xfs_mount_t *);162162-163163-164164- j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog;165165-166166- for (i = 0; i < j; i++) {167167- dip = (xfs_dinode_t *) xfs_buf_offset(bp,168168- i * mp->m_sb.sb_inodesize);169169- if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC) {170170- cmn_err(CE_WARN,171171-"Bad magic # 0x%x in XFS inode buffer 0x%Lx, starting blockno %Ld, offset 0x%x",172172- INT_GET(dip->di_core.di_magic, ARCH_CONVERT),173173- (__uint64_t)(__psunsigned_t) bp,174174- (__int64_t) XFS_BUF_ADDR(bp),175175- xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize));176176- xfs_fs_cmn_err(CE_WARN, mp,177177- "corrupt, unmount and run xfs_repair");178178- }179179- if (!dip->di_next_unlinked) {180180- cmn_err(CE_WARN,181181-"Bad next_unlinked field (0) in XFS inode buffer 0x%p, starting blockno %Ld, offset 0x%x",182182- (__uint64_t)(__psunsigned_t) bp,183183- (__int64_t) XFS_BUF_ADDR(bp),184184- xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize));185185- xfs_fs_cmn_err(CE_WARN, mp,186186- "corrupt, unmount and run xfs_repair");187187- }188188- }189189-190190- return;191191-}192192-193193-/*194149 * This routine is called to map an inode number within a file195150 * system to the buffer containing the on-disk version of the196151 * inode. It returns a pointer to the buffer containing the···158203 * Use xfs_imap() to determine the size and location of the159204 * buffer to read from disk.160205 */161161-int206206+STATIC int162207xfs_inotobp(163208 xfs_mount_t *mp,164209 xfs_trans_t *tp,···12021247 case S_IFREG:12031248 case S_IFDIR:12041249 if (unlikely(pip->i_d.di_flags & XFS_DIFLAG_ANY)) {12051205- if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) {12061206- if ((mode & S_IFMT) == S_IFDIR) {12071207- ip->i_d.di_flags |= XFS_DIFLAG_RTINHERIT;12081208- } else {12091209- ip->i_d.di_flags |= XFS_DIFLAG_REALTIME;12501250+ uint di_flags = 0;12511251+12521252+ if ((mode & S_IFMT) == S_IFDIR) {12531253+ if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)12541254+ di_flags |= XFS_DIFLAG_RTINHERIT;12551255+ } else {12561256+ if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) {12571257+ di_flags |= XFS_DIFLAG_REALTIME;12101258 ip->i_iocore.io_flags |= XFS_IOCORE_RT;12111259 }12121260 }12131261 if ((pip->i_d.di_flags & XFS_DIFLAG_NOATIME) &&12141262 xfs_inherit_noatime)12151215- ip->i_d.di_flags |= XFS_DIFLAG_NOATIME;12631263+ di_flags |= XFS_DIFLAG_NOATIME;12161264 if ((pip->i_d.di_flags & XFS_DIFLAG_NODUMP) &&12171265 xfs_inherit_nodump)12181218- ip->i_d.di_flags |= XFS_DIFLAG_NODUMP;12661266+ di_flags |= XFS_DIFLAG_NODUMP;12191267 if ((pip->i_d.di_flags & XFS_DIFLAG_SYNC) &&12201268 xfs_inherit_sync)12211221- ip->i_d.di_flags |= XFS_DIFLAG_SYNC;12691269+ di_flags |= XFS_DIFLAG_SYNC;12221270 if ((pip->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) &&12231271 xfs_inherit_nosymlinks)12241224- ip->i_d.di_flags |= XFS_DIFLAG_NOSYMLINKS;12721272+ di_flags |= XFS_DIFLAG_NOSYMLINKS;12731273+ if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)12741274+ di_flags |= XFS_DIFLAG_PROJINHERIT;12751275+ ip->i_d.di_flags |= di_flags;12251276 }12261277 /* FALLTHROUGH */12271278 case S_IFLNK:···21172156 (ip->i_update_core == 0));21182157}2119215821202120-void21592159+STATIC void21212160xfs_ifree_cluster(21222161 xfs_inode_t *free_ip,21232162 xfs_trans_t *tp,···28362875 * be subsequently pinned once someone is waiting for it to be28372876 * unpinned.28382877 */28392839-void28782878+STATIC void28402879xfs_iunpin_wait(28412880 xfs_inode_t *ip)28422881{···356236013563360235643603/*35653565- * Flush all inactive inodes in mp. Return true if no user references35663566- * were found, false otherwise.36043604+ * Flush all inactive inodes in mp.35673605 */35683568-int36063606+void35693607xfs_iflush_all(35703570- xfs_mount_t *mp,35713571- int flag)36083608+ xfs_mount_t *mp)35723609{35733573- int busy;35743574- int done;35753575- int purged;35763610 xfs_inode_t *ip;35773577- vmap_t vmap;35783611 vnode_t *vp;3579361235803580- busy = done = 0;35813581- while (!done) {35823582- purged = 0;35833583- XFS_MOUNT_ILOCK(mp);35843584- ip = mp->m_inodes;35853585- if (ip == NULL) {35863586- break;36133613+ again:36143614+ XFS_MOUNT_ILOCK(mp);36153615+ ip = mp->m_inodes;36163616+ if (ip == NULL)36173617+ goto out;36183618+36193619+ do {36203620+ /* Make sure we skip markers inserted by sync */36213621+ if (ip->i_mount == NULL) {36223622+ ip = ip->i_mnext;36233623+ continue;35873624 }35883588- do {35893589- /* Make sure we skip markers inserted by sync */35903590- if (ip->i_mount == NULL) {35913591- ip = ip->i_mnext;35923592- continue;35933593- }3594362535953595- /*35963596- * It's up to our caller to purge the root35973597- * and quota vnodes later.35983598- */35993599- vp = XFS_ITOV_NULL(ip);36003600-36013601- if (!vp) {36023602- XFS_MOUNT_IUNLOCK(mp);36033603- xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC);36043604- purged = 1;36053605- break;36063606- }36073607-36083608- if (vn_count(vp) != 0) {36093609- if (vn_count(vp) == 1 &&36103610- (ip == mp->m_rootip ||36113611- (mp->m_quotainfo &&36123612- (ip->i_ino == mp->m_sb.sb_uquotino ||36133613- ip->i_ino == mp->m_sb.sb_gquotino)))) {36143614-36153615- ip = ip->i_mnext;36163616- continue;36173617- }36183618- if (!(flag & XFS_FLUSH_ALL)) {36193619- busy = 1;36203620- done = 1;36213621- break;36223622- }36233623- /*36243624- * Ignore busy inodes but continue flushing36253625- * others.36263626- */36273627- ip = ip->i_mnext;36283628- continue;36293629- }36303630- /*36313631- * Sample vp mapping while holding mp locked on MP36323632- * systems, so we don't purge a reclaimed or36333633- * nonexistent vnode. We break from the loop36343634- * since we know that we modify36353635- * it by pulling ourselves from it in xfs_reclaim()36363636- * called via vn_purge() below. Set ip to the next36373637- * entry in the list anyway so we'll know below36383638- * whether we reached the end or not.36393639- */36403640- VMAP(vp, vmap);36263626+ vp = XFS_ITOV_NULL(ip);36273627+ if (!vp) {36413628 XFS_MOUNT_IUNLOCK(mp);36423642-36433643- vn_purge(vp, &vmap);36443644-36453645- purged = 1;36463646- break;36473647- } while (ip != mp->m_inodes);36483648- /*36493649- * We need to distinguish between when we exit the loop36503650- * after a purge and when we simply hit the end of the36513651- * list. We can't use the (ip == mp->m_inodes) test,36523652- * because when we purge an inode at the start of the list36533653- * the next inode on the list becomes mp->m_inodes. That36543654- * would cause such a test to bail out early. The purged36553655- * variable tells us how we got out of the loop.36563656- */36573657- if (!purged) {36583658- done = 1;36293629+ xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC);36303630+ goto again;36593631 }36603660- }36613661- XFS_MOUNT_IUNLOCK(mp);36623662- return !busy;36633663-}3664363236333633+ ASSERT(vn_count(vp) == 0);36343634+36353635+ ip = ip->i_mnext;36363636+ } while (ip != mp->m_inodes);36373637+ out:36383638+ XFS_MOUNT_IUNLOCK(mp);36393639+}3665364036663641/*36673642 * xfs_iaccess: check accessibility of inode for mode.
···148148 * The buffer is kept locked across the write and is returned locked.149149 * This can only be used for synchronous log writes.150150 */151151-int151151+STATIC int152152xlog_bwrite(153153 xlog_t *log,154154 xfs_daddr_t blk_no,···179179 return error;180180}181181182182-xfs_caddr_t182182+STATIC xfs_caddr_t183183xlog_align(184184 xlog_t *log,185185 xfs_daddr_t blk_no,···528528 *529529 * Return: zero if normal, non-zero if error.530530 */531531-int531531+STATIC int532532xlog_find_head(533533 xlog_t *log,534534 xfs_daddr_t *return_head_blk)···19641964 * probably a good thing to do for other buf types also.19651965 */19661966 error = 0;19671967- if (buf_f->blf_flags & (XFS_BLI_UDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {19671967+ if (buf_f->blf_flags &19681968+ (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {19681969 error = xfs_qm_dqcheck((xfs_disk_dquot_t *)19691970 item->ri_buf[i].i_addr,19701971 -1, 0, XFS_QMOPT_DOWARN,···20312030 }2032203120332032 if (INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_USER &&20332033+ INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_PROJ &&20342034 INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_GROUP) {20352035 if (flags & XFS_QMOPT_DOWARN)20362036 cmn_err(CE_ALERT,···21372135 type = 0;21382136 if (buf_f->blf_flags & XFS_BLI_UDQUOT_BUF)21392137 type |= XFS_DQ_USER;21382138+ if (buf_f->blf_flags & XFS_BLI_PDQUOT_BUF)21392139+ type |= XFS_DQ_PROJ;21402140 if (buf_f->blf_flags & XFS_BLI_GDQUOT_BUF)21412141 type |= XFS_DQ_GROUP;21422142 /*···22512247 error = 0;22522248 if (flags & XFS_BLI_INODE_BUF) {22532249 error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f);22542254- } else if (flags & (XFS_BLI_UDQUOT_BUF | XFS_BLI_GDQUOT_BUF)) {22502250+ } else if (flags &22512251+ (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {22552252 xlog_recover_do_dquot_buffer(mp, log, item, bp, buf_f);22562253 } else {22572254 xlog_recover_do_reg_buffer(mp, item, bp, buf_f);···26242619 * This type of quotas was turned off, so ignore this record.26252620 */26262621 type = INT_GET(recddq->d_flags, ARCH_CONVERT) &26272627- (XFS_DQ_USER | XFS_DQ_GROUP);26222622+ (XFS_DQ_USER | XFS_DQ_PROJ | XFS_DQ_GROUP);26282623 ASSERT(type);26292624 if (log->l_quotaoffs_flag & type)26302625 return (0);···27472742 xfs_efi_log_item_t *efip = NULL;27482743 xfs_log_item_t *lip;27492744 int gen;27502750- int nexts;27512745 __uint64_t efi_id;27522746 SPLDECL(s);27532747···27812777 }27822778 lip = xfs_trans_next_ail(mp, lip, &gen, NULL);27832779 }27842784- if (lip == NULL) {27852785- AIL_UNLOCK(mp, s);27862786- }2787278027882781 /*27892782 * If we found it, then free it up. If it wasn't there, it27902783 * must have been overwritten in the log. Oh well.27912784 */27922785 if (lip != NULL) {27932793- nexts = efip->efi_format.efi_nextents;27942794- if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {27952795- kmem_free(lip, sizeof(xfs_efi_log_item_t) +27962796- ((nexts - 1) * sizeof(xfs_extent_t)));27972797- } else {27982798- kmem_zone_free(xfs_efi_zone, efip);27992799- }27862786+ xfs_efi_item_free(efip);27872787+ } else {27882788+ AIL_UNLOCK(mp, s);28002789 }28012790}28022791
···6464STATIC void xfs_mount_log_sbunit(xfs_mount_t *, __int64_t);6565STATIC int xfs_uuid_mount(xfs_mount_t *);6666STATIC void xfs_uuid_unmount(xfs_mount_t *mp);6767+STATIC void xfs_unmountfs_wait(xfs_mount_t *);67686869static struct {6970 short offset;···556555 * fields from the superblock associated with the given557556 * mount structure558557 */559559-void558558+STATIC void560559xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp)561560{562561 int i;···10821081 int64_t fsid;10831082#endif1084108310851085- xfs_iflush_all(mp, XFS_FLUSH_ALL);10841084+ xfs_iflush_all(mp);1086108510871086 XFS_QM_DQPURGEALL(mp,10881087 XFS_QMOPT_UQUOTA | XFS_QMOPT_GQUOTA | XFS_QMOPT_UMOUNTING);···11121111 */11131112 ASSERT(mp->m_inodes == NULL);1114111311151115- /*11161116- * We may have bufs that are in the process of getting written still.11171117- * We must wait for the I/O completion of those. The sync flag here11181118- * does a two pass iteration thru the bufcache.11191119- */11201120- if (XFS_FORCED_SHUTDOWN(mp)) {11211121- xfs_incore_relse(mp->m_ddev_targp, 0, 1); /* synchronous */11221122- }11231123-11241114 xfs_unmountfs_close(mp, cr);11251115 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0)11261116 xfs_uuid_unmount(mp);···11381146 xfs_free_buftarg(mp->m_ddev_targp, 0);11391147}1140114811411141-void11491149+STATIC void11421150xfs_unmountfs_wait(xfs_mount_t *mp)11431151{11441152 if (mp->m_logdev_targp != mp->m_ddev_targp)
···332332333333334334/*335335- * This is called to set the a callback to be called when the given336336- * transaction is committed to disk. The transaction pointer and the337337- * argument pointer will be passed to the callback routine.338338- *339339- * Only one callback can be associated with any single transaction.340340- */341341-void342342-xfs_trans_callback(343343- xfs_trans_t *tp,344344- xfs_trans_callback_t callback,345345- void *arg)346346-{347347- ASSERT(tp->t_callback == NULL);348348- tp->t_callback = callback;349349- tp->t_callarg = arg;350350-}351351-352352-353353-/*354335 * Record the indicated change to the given field for application355336 * to the file system's superblock when the transaction commits.356337 * For now, just store the change in the transaction structure.···532551 *533552 * This is done efficiently with a single call to xfs_mod_incore_sb_batch().534553 */535535-void554554+STATIC void536555xfs_trans_unreserve_and_mod_sb(537556 xfs_trans_t *tp)538557{
···253253 ip->i_itemp->ili_flags |= XFS_ILI_HOLD;254254}255255256256-/*257257- * Cancel the previous inode hold request made on this inode258258- * for this transaction.259259- */260260-/*ARGSUSED*/261261-void262262-xfs_trans_ihold_release(263263- xfs_trans_t *tp,264264- xfs_inode_t *ip)265265-{266266- ASSERT(ip->i_transp == tp);267267- ASSERT(ip->i_itemp != NULL);268268- ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));269269- ASSERT(ip->i_itemp->ili_flags & XFS_ILI_HOLD);270270-271271- ip->i_itemp->ili_flags &= ~XFS_ILI_HOLD;272272-}273273-274256275257/*276258 * This is called to mark the fields indicated in fieldmask as needing
+1-1
fs/xfs/xfs_types.h
···5555typedef unsigned long long int __uint64_t;56565757typedef enum { B_FALSE,B_TRUE } boolean_t;5858-typedef __int64_t prid_t; /* project ID */5858+typedef __uint32_t prid_t; /* project ID */5959typedef __uint32_t inst_t; /* an instruction */60606161typedef __s64 xfs_off_t; /* <file offset> type */
+1-1
fs/xfs/xfs_utils.c
···428428 if (ip->i_ino != mp->m_sb.sb_uquotino)429429 ASSERT(ip->i_udquot);430430 }431431- if (XFS_IS_GQUOTA_ON(mp)) {431431+ if (XFS_IS_OQUOTA_ON(mp)) {432432 if (ip->i_ino != mp->m_sb.sb_gquotino)433433 ASSERT(ip->i_gdquot);434434 }
+37-37
fs/xfs/xfs_vfsops.c
···368368 }369369370370 /*371371- * disallow mount attempts with (IRIX) project quota enabled372372- */373373- if (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) &&374374- (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT)) {375375- cmn_err(CE_WARN,376376- "XFS: cannot mount a filesystem with IRIX project quota enabled");377377- return XFS_ERROR(ENOSYS);378378- }379379-380380- /*381371 * check for shared mount.382372 */383373 if (ap->flags & XFSMNT_SHARED) {···612622 return XFS_ERROR(error);613623}614624615615-#define REMOUNT_READONLY_FLAGS (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT)625625+STATIC int626626+xfs_quiesce_fs(627627+ xfs_mount_t *mp)628628+{629629+ int count = 0, pincount;630630+631631+ xfs_refcache_purge_mp(mp);632632+ xfs_flush_buftarg(mp->m_ddev_targp, 0);633633+ xfs_finish_reclaim_all(mp, 0);634634+635635+ /* This loop must run at least twice.636636+ * The first instance of the loop will flush637637+ * most meta data but that will generate more638638+ * meta data (typically directory updates).639639+ * Which then must be flushed and logged before640640+ * we can write the unmount record.641641+ */ 642642+ do {643643+ xfs_syncsub(mp, SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT, 0, NULL);644644+ pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);645645+ if (!pincount) {646646+ delay(50);647647+ count++;648648+ }649649+ } while (count < 2);650650+651651+ return 0;652652+}616653617654STATIC int618655xfs_mntupdate(···649632{650633 struct vfs *vfsp = bhvtovfs(bdp);651634 xfs_mount_t *mp = XFS_BHVTOM(bdp);652652- int pincount, error;653653- int count = 0;635635+ int error;654636655637 if (args->flags & XFSMNT_NOATIME)656638 mp->m_flags |= XFS_MOUNT_NOATIME;···661645 }662646663647 if (*flags & MS_RDONLY) {664664- xfs_refcache_purge_mp(mp);665665- xfs_flush_buftarg(mp->m_ddev_targp, 0);666666- xfs_finish_reclaim_all(mp, 0);667667-668668- /* This loop must run at least twice.669669- * The first instance of the loop will flush670670- * most meta data but that will generate more671671- * meta data (typically directory updates).672672- * Which then must be flushed and logged before673673- * we can write the unmount record.674674- */ 675675- do {676676- VFS_SYNC(vfsp, REMOUNT_READONLY_FLAGS, NULL, error);677677- pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);678678- if (!pincount) {679679- delay(50);680680- count++;681681- }682682- } while (count < 2);648648+ xfs_quiesce_fs(mp);683649684650 /* Ok now write out an unmount record */685651 xfs_log_unmount_write(mp);···877879 int flags,878880 cred_t *credp)879881{880880- xfs_mount_t *mp;882882+ xfs_mount_t *mp = XFS_BHVTOM(bdp);881883882882- mp = XFS_BHVTOM(bdp);883883- return (xfs_syncsub(mp, flags, 0, NULL));884884+ if (unlikely(flags == SYNC_QUIESCE))885885+ return xfs_quiesce_fs(mp);886886+ else887887+ return xfs_syncsub(mp, flags, 0, NULL);884888}885889886890/*···16811681 return simple_strtoul(cp, endp, base) << shift_left_factor;16821682}1683168316841684-int16841684+STATIC int16851685xfs_parseargs(16861686 struct bhv_desc *bhv,16871687 char *options,···18671867 return 0;18681868}1869186918701870-int18701870+STATIC int18711871xfs_showargs(18721872 struct bhv_desc *bhv,18731873 struct seq_file *m)
+64-31
fs/xfs/xfs_vnodeops.c
···11/*22- * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.22+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.33 *44 * This program is free software; you can redistribute it and/or modify it55 * under the terms of version 2 of the GNU General Public License as···351351 * If the IDs do change before we take the ilock, we're covered352352 * because the i_*dquot fields will get updated anyway.353353 */354354- if (XFS_IS_QUOTA_ON(mp) && (mask & (XFS_AT_UID|XFS_AT_GID))) {354354+ if (XFS_IS_QUOTA_ON(mp) &&355355+ (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID))) {355356 uint qflags = 0;356357357357- if (mask & XFS_AT_UID) {358358+ if ((mask & XFS_AT_UID) && XFS_IS_UQUOTA_ON(mp)) {358359 uid = vap->va_uid;359360 qflags |= XFS_QMOPT_UQUOTA;360361 } else {361362 uid = ip->i_d.di_uid;362363 }363363- if (mask & XFS_AT_GID) {364364+ if ((mask & XFS_AT_GID) && XFS_IS_GQUOTA_ON(mp)) {364365 gid = vap->va_gid;365366 qflags |= XFS_QMOPT_GQUOTA;366367 } else {367368 gid = ip->i_d.di_gid;369369+ }370370+ if ((mask & XFS_AT_PROJID) && XFS_IS_PQUOTA_ON(mp)) {371371+ projid = vap->va_projid;372372+ qflags |= XFS_QMOPT_PQUOTA;373373+ } else {374374+ projid = ip->i_d.di_projid;368375 }369376 /*370377 * We take a reference when we initialize udqp and gdqp,···380373 */381374 ASSERT(udqp == NULL);382375 ASSERT(gdqp == NULL);383383- code = XFS_QM_DQVOPALLOC(mp, ip, uid,gid, qflags, &udqp, &gdqp);376376+ code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, projid, qflags,377377+ &udqp, &gdqp);384378 if (code)385379 return (code);386380 }···507499 * that the group ID supplied to the chown() function508500 * shall be equal to either the group ID or one of the509501 * supplementary group IDs of the calling process.510510- *511511- * XXX: How does restricted_chown affect projid?512502 */513503 if (restricted_chown &&514504 (iuid != uid || (igid != gid &&···516510 goto error_return;517511 }518512 /*519519- * Do a quota reservation only if uid or gid is actually513513+ * Do a quota reservation only if uid/projid/gid is actually520514 * going to change.521515 */522516 if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||517517+ (XFS_IS_PQUOTA_ON(mp) && iprojid != projid) ||523518 (XFS_IS_GQUOTA_ON(mp) && igid != gid)) {524519 ASSERT(tp);525520 code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp,···781774 }782775 if (igid != gid) {783776 if (XFS_IS_GQUOTA_ON(mp)) {777777+ ASSERT(!XFS_IS_PQUOTA_ON(mp));784778 ASSERT(mask & XFS_AT_GID);785779 ASSERT(gdqp);786780 olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip,···790782 ip->i_d.di_gid = gid;791783 }792784 if (iprojid != projid) {785785+ if (XFS_IS_PQUOTA_ON(mp)) {786786+ ASSERT(!XFS_IS_GQUOTA_ON(mp));787787+ ASSERT(mask & XFS_AT_PROJID);788788+ ASSERT(gdqp);789789+ olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip,790790+ &ip->i_gdquot, gdqp);791791+ }793792 ip->i_d.di_projid = projid;794793 /*795794 * We may have to rev the inode as well as···858843 di_flags |= XFS_DIFLAG_NOATIME;859844 if (vap->va_xflags & XFS_XFLAG_NODUMP)860845 di_flags |= XFS_DIFLAG_NODUMP;846846+ if (vap->va_xflags & XFS_XFLAG_PROJINHERIT)847847+ di_flags |= XFS_DIFLAG_PROJINHERIT;861848 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {862849 if (vap->va_xflags & XFS_XFLAG_RTINHERIT)863850 di_flags |= XFS_DIFLAG_RTINHERIT;···19151898 /* Return through std_return after this point. */1916189919171900 udqp = gdqp = NULL;19181918- if (vap->va_mask & XFS_AT_PROJID)19011901+ if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)19021902+ prid = dp->i_d.di_projid;19031903+ else if (vap->va_mask & XFS_AT_PROJID)19191904 prid = (xfs_prid_t)vap->va_projid;19201905 else19211906 prid = (xfs_prid_t)dfltprid;···19261907 * Make sure that we have allocated dquot(s) on disk.19271908 */19281909 error = XFS_QM_DQVOPALLOC(mp, dp,19291929- current_fsuid(credp), current_fsgid(credp),19101910+ current_fsuid(credp), current_fsgid(credp), prid,19301911 XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp);19311912 if (error)19321913 goto std_return;···26232604 if (src_vp->v_type == VDIR)26242605 return XFS_ERROR(EPERM);2625260626262626- /*26272627- * For now, manually find the XFS behavior descriptor for26282628- * the source vnode. If it doesn't exist then something26292629- * is wrong and we should just return an error.26302630- * Eventually we need to figure out how link is going to26312631- * work in the face of stacked vnodes.26322632- */26332607 src_bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(src_vp), &xfs_vnodeops);26342634- if (src_bdp == NULL) {26352635- return XFS_ERROR(EXDEV);26362636- }26372608 sip = XFS_BHVTOI(src_bdp);26382609 tdp = XFS_BHVTOI(target_dir_bdp);26392610 mp = tdp->i_mount;···26872678 */26882679 if (sip->i_d.di_nlink >= XFS_MAXLINK) {26892680 error = XFS_ERROR(EMLINK);26812681+ goto error_return;26822682+ }26832683+26842684+ /*26852685+ * If we are using project inheritance, we only allow hard link26862686+ * creation in our tree when the project IDs are the same; else26872687+ * the tree quota mechanism could be circumvented.26882688+ */26892689+ if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&26902690+ (tdp->i_d.di_projid != sip->i_d.di_projid))) {26912691+ error = XFS_ERROR(EPERM);26902692 goto error_return;26912693 }26922694···2823280328242804 mp = dp->i_mount;28252805 udqp = gdqp = NULL;28262826- if (vap->va_mask & XFS_AT_PROJID)28062806+ if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)28072807+ prid = dp->i_d.di_projid;28082808+ else if (vap->va_mask & XFS_AT_PROJID)28272809 prid = (xfs_prid_t)vap->va_projid;28282810 else28292811 prid = (xfs_prid_t)dfltprid;···28342812 * Make sure that we have allocated dquot(s) on disk.28352813 */28362814 error = XFS_QM_DQVOPALLOC(mp, dp,28372837- current_fsuid(credp), current_fsgid(credp),28152815+ current_fsuid(credp), current_fsgid(credp), prid,28382816 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);28392817 if (error)28402818 goto std_return;···33793357 /* Return through std_return after this point. */3380335833813359 udqp = gdqp = NULL;33823382- if (vap->va_mask & XFS_AT_PROJID)33603360+ if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)33613361+ prid = dp->i_d.di_projid;33623362+ else if (vap->va_mask & XFS_AT_PROJID)33833363 prid = (xfs_prid_t)vap->va_projid;33843364 else33853365 prid = (xfs_prid_t)dfltprid;···33903366 * Make sure that we have allocated dquot(s) on disk.33913367 */33923368 error = XFS_QM_DQVOPALLOC(mp, dp,33933393- current_fsuid(credp), current_fsgid(credp),33693369+ current_fsuid(credp), current_fsgid(credp), prid,33943370 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);33953371 if (error)33963372 goto std_return;···40524028 * errno on error40534029 *40544030 */40554055-int40314031+STATIC int40564032xfs_alloc_file_space(40574033 xfs_inode_t *ip,40584034 xfs_off_t offset,···41754151 break;41764152 }41774153 xfs_ilock(ip, XFS_ILOCK_EXCL);41784178- error = XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp,41794179- ip->i_udquot, ip->i_gdquot, resblks, 0, rt ?41804180- XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS);41544154+ error = XFS_TRANS_RESERVE_QUOTA(mp, tp,41554155+ ip->i_udquot, ip->i_gdquot, resblks, 0, 0);41814156 if (error)41824157 goto error1;41834158···43284305 xfs_off_t len,43294306 int attr_flags)43304307{43084308+ vnode_t *vp;43314309 int committed;43324310 int done;43334311 xfs_off_t end_dmi_offset;···43494325 xfs_trans_t *tp;43504326 int need_iolock = 1;4351432743524352- vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);43284328+ vp = XFS_ITOV(ip);43534329 mp = ip->i_mount;43304330+43314331+ vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);4354433243554333 if ((error = XFS_QM_DQATTACH(mp, ip, 0)))43564334 return error;···43704344 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) {43714345 if (end_dmi_offset > ip->i_d.di_size)43724346 end_dmi_offset = ip->i_d.di_size;43734373- error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, XFS_ITOV(ip),43474347+ error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp,43744348 offset, end_dmi_offset - offset,43754349 AT_DELAY_FLAG(attr_flags), NULL);43764350 if (error)···43894363 ioffset = offset & ~(rounding - 1);43904364 if (ilen & (rounding - 1))43914365 ilen = (ilen + rounding) & ~(rounding - 1);43924392- xfs_inval_cached_pages(XFS_ITOV(ip), &(ip->i_iocore), ioffset, 0, 0);43664366+43674367+ if (VN_CACHED(vp) != 0) {43684368+ xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1,43694369+ ctooff(offtoct(ioffset)), -1);43704370+ VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(ioffset)),43714371+ -1, FI_REMAPF_LOCKED);43724372+ }43734373+43934374 /*43944375 * Need to zero the stuff we're not freeing, on disk.43954376 * If its a realtime file & can't use unwritten extents then we