Lines Matching refs:ip
301 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
317 bh_map.b_size = 1 << ip->i_inode.i_blkbits;
318 error = gfs2_block_map(&ip->i_inode, block, &bh_map, 0);
321 error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh);
492 int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid)
494 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
495 struct gfs2_alloc *al = ip->i_alloc;
500 gfs2_assert_warn(sdp, !test_bit(GIF_QD_LOCKED, &ip->i_flags)))
506 error = qdsb_get(sdp, QUOTA_USER, ip->i_inode.i_uid, qd);
512 error = qdsb_get(sdp, QUOTA_GROUP, ip->i_inode.i_gid, qd);
518 if (uid != NO_QUOTA_CHANGE && uid != ip->i_inode.i_uid) {
526 if (gid != NO_QUOTA_CHANGE && gid != ip->i_inode.i_gid) {
536 gfs2_quota_unhold(ip);
540 void gfs2_quota_unhold(struct gfs2_inode *ip)
542 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
543 struct gfs2_alloc *al = ip->i_alloc;
546 gfs2_assert_warn(sdp, !test_bit(GIF_QD_LOCKED, &ip->i_flags));
578 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
583 gfs2_trans_add_bh(ip->i_gl, qd->qd_bh, 1);
617 * @ip: The quota inode
629 static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
633 struct inode *inode = &ip->i_inode;
645 if (gfs2_is_stuffed(ip))
646 gfs2_unstuff_dinode(ip, NULL);
649 err = gfs2_internal_read(ip, NULL, (char *)&q, &loc, sizeof(q));
711 gfs2_trans_add_bh(ip->i_gl, bh, 0);
733 err = gfs2_meta_inode_buffer(ip, &dibh);
739 ip->i_disksize = size;
743 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
744 gfs2_dinode_out(ip, dibh->b_data);
759 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
769 gfs2_write_calc_reserv(ip, sizeof(struct gfs2_quota),
777 mutex_lock_nested(&ip->i_inode.i_mutex, I_MUTEX_QUOTA);
785 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
791 if (gfs2_write_alloc_required(ip, offset,
796 al = gfs2_alloc_get(ip);
815 error = gfs2_inplace_reserve(ip);
829 error = gfs2_adjust_quota(ip, offset, qd->qd_change_sync, qd, NULL);
841 gfs2_inplace_release(ip);
843 gfs2_alloc_put(ip);
849 mutex_unlock(&ip->i_inode.i_mutex);
851 gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
857 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
865 error = gfs2_internal_read(ip, NULL, (char *)&q, &pos, sizeof(q));
884 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
902 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
925 int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid)
927 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
928 struct gfs2_alloc *al = ip->i_alloc;
932 gfs2_quota_hold(ip, uid, gid);
948 set_bit(GIF_QD_LOCKED, &ip->i_flags);
952 gfs2_quota_unhold(ip);
994 void gfs2_quota_unlock(struct gfs2_inode *ip)
996 struct gfs2_alloc *al = ip->i_alloc;
1001 if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags))
1024 gfs2_quota_unhold(ip);
1041 int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid)
1043 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1044 struct gfs2_alloc *al = ip->i_alloc;
1050 if (!test_bit(GIF_QD_LOCKED, &ip->i_flags))
1092 void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
1095 struct gfs2_alloc *al = ip->i_alloc;
1099 if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), change))
1101 if (ip->i_diskflags & GFS2_DIF_SYSTEM)
1192 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
1193 unsigned int blocks = ip->i_disksize >> sdp->sd_sb.sb_bsize_shift;
1200 if (!ip->i_disksize || ip->i_disksize > (64 << 20) ||
1201 ip->i_disksize & (sdp->sd_sb.sb_bsize - 1)) {
1202 gfs2_consist_inode(ip);
1227 error = gfs2_extent_map(&ip->i_inode, x, &new, &dblock, &extlen);
1232 bh = gfs2_meta_ra(ip->i_gl, dblock, extlen);
1363 struct gfs2_inode *ip;
1366 ip = NULL;
1369 ip = list_entry(sdp->sd_trunc_list.next,
1371 list_del_init(&ip->i_trunc_list);
1374 if (ip == NULL)
1376 gfs2_glock_finish_truncate(ip);
1520 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
1557 mutex_lock(&ip->i_inode.i_mutex);
1561 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
1581 alloc_required = gfs2_write_alloc_required(ip, offset, sizeof(struct gfs2_quota));
1583 al = gfs2_alloc_get(ip);
1586 gfs2_write_calc_reserv(ip, sizeof(struct gfs2_quota),
1589 error = gfs2_inplace_reserve(ip);
1599 error = gfs2_adjust_quota(ip, offset, 0, qd, fdq);
1604 gfs2_inplace_release(ip);
1606 gfs2_alloc_put(ip);
1613 mutex_unlock(&ip->i_inode.i_mutex);