/*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
- * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
#include <linux/tty.h>
#include <linux/sort.h>
#include <linux/fs.h>
-#include <asm/semaphore.h>
+#include <linux/gfs2_ondisk.h>
#include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
#include "bmap.h"
#include "glock.h"
#include "glops.h"
#include "log.h"
+#include "lvb.h"
#include "meta_io.h"
#include "quota.h"
#include "rgrp.h"
#include "inode.h"
#include "ops_file.h"
#include "ops_address.h"
+#include "util.h"
#define QUOTA_USER 1
#define QUOTA_GROUP 0
static int bh_get(struct gfs2_quota_data *qd)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
- struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
+ struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip;
unsigned int block, offset;
uint64_t dblock;
int new = 0;
struct buffer_head *bh;
int error;
+ int boundary;
mutex_lock(&sdp->sd_quota_mutex);
block = qd->qd_slot / sdp->sd_qc_per_block;
offset = qd->qd_slot % sdp->sd_qc_per_block;;
- error = gfs2_block_map(ip, block, &new, &dblock, NULL);
+ error = gfs2_block_map(ip->i_vnode, block, &new, &dblock, &boundary);
if (error)
goto fail;
error = gfs2_meta_read(ip->i_gl, dblock, DIO_START | DIO_WAIT, &bh);
static void do_qc(struct gfs2_quota_data *qd, int64_t change)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
- struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
+ struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip;
struct gfs2_quota_change *qc = qd->qd_bh_qc;
int64_t x;
static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
{
struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd;
- struct gfs2_inode *ip = get_v2ip(sdp->sd_quota_inode);
+ struct gfs2_inode *ip = sdp->sd_quota_inode->u.generic_ip;
unsigned int data_blocks, ind_blocks;
struct file_ra_state ra_state;
struct gfs2_holder *ghs, i_gh;
while (qx--)
gfs2_glock_dq_uninit(&ghs[qx]);
kfree(ghs);
- gfs2_log_flush_glock(ip->i_gl);
+ gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
return error;
}
struct gfs2_holder *q_gh)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
+ struct gfs2_inode *ip = sdp->sd_quota_inode->u.generic_ip;
struct gfs2_holder i_gh;
struct gfs2_quota q;
char buf[sizeof(struct gfs2_quota)];
if (error)
return error;
- error = gfs2_glock_nq_init(get_v2ip(sdp->sd_quota_inode)->i_gl,
+ error = gfs2_glock_nq_init(ip->i_gl,
LM_ST_SHARED, 0,
&i_gh);
if (error)
memset(buf, 0, sizeof(struct gfs2_quota));
pos = qd2offset(qd);
- error = gfs2_internal_read(get_v2ip(sdp->sd_quota_inode),
+ error = gfs2_internal_read(ip,
&ra_state, buf,
&pos,
sizeof(struct gfs2_quota));
return error;
}
+#if 0
int gfs2_quota_read(struct gfs2_sbd *sdp, int user, uint32_t id,
struct gfs2_quota *q)
{
return error;
}
+#endif /* 0 */
int gfs2_quota_init(struct gfs2_sbd *sdp)
{
- struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
+ struct gfs2_inode *ip = sdp->sd_qc_inode->u.generic_ip;
unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
unsigned int x, slot = 0;
unsigned int found = 0;
return -EIO;
}
sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block;
- sdp->sd_quota_chunks = DIV_RU(sdp->sd_quota_slots, 8 * PAGE_SIZE);
+ sdp->sd_quota_chunks = DIV_ROUND_UP(sdp->sd_quota_slots, 8 * PAGE_SIZE);
error = -ENOMEM;
if (!extlen) {
int new = 0;
- error = gfs2_block_map(ip, x, &new, &dblock, &extlen);
+ error = gfs2_extent_map(ip->i_vnode, x, &new, &dblock, &extlen);
if (error)
goto fail;
}