/* * Mark an inode as being modified, meaning that the caller will modify * ip->meta. * * If a vnode is present we set the vnode dirty and the nominal filesystem * sync will also handle synchronizing the inode meta-data. If no vnode * is present we must ensure that the inode is on pmp->sideq. * * NOTE: We must always queue the inode to the sideq. This allows H2 to * shortcut vsyncscan() and flush inodes and their related vnodes * in a two stages. H2 still calls vfsync() for each vnode. * * NOTE: No mtid (modify_tid) is passed into this routine. The caller is * only modifying the in-memory inode. A modify_tid is synchronized * later when the inode gets flushed. * * NOTE: As an exception to the general rule, the inode MAY be locked * shared for this particular call. */ void hammer2_inode_modify(hammer2_inode_t *ip) { atomic_set_int(&ip->flags, HAMMER2_INODE_MODIFIED); if (ip->vp) vsetisdirty(ip->vp); if (ip->pmp && (ip->flags & HAMMER2_INODE_NOSIDEQ) == 0) hammer2_inode_delayed_sideq(ip); }
/* * Set an inode's cluster modified, marking the related chains RW and * duplicating them if necessary. * * The passed-in chain is a localized copy of the chain previously acquired * when the inode was locked (and possilby replaced in the mean time), and * must also be updated. In fact, we update it first and then synchronize * the inode's cluster cache. */ hammer2_inode_data_t * hammer2_cluster_modify_ip(hammer2_trans_t *trans, hammer2_inode_t *ip, hammer2_cluster_t *cluster, int flags) { atomic_set_int(&ip->flags, HAMMER2_INODE_MODIFIED); hammer2_cluster_modify(trans, cluster, flags); hammer2_inode_repoint(ip, NULL, cluster); if (ip->vp) vsetisdirty(ip->vp); return (&hammer2_cluster_wdata(cluster)->ipdata); }