#else
struct super_block *sb = inode->i_sb;
size = sb->s_op->quota_read(sb, type, (char *)&dqhead,
- sizeof(struct lustre_disk_dqheader), 0);
+ sizeof(struct lustre_disk_dqheader),
+ 0);
#endif
}
if (size != sizeof(struct lustre_disk_dqheader))
*/
int lustre_read_quota_info(struct lustre_quota_info *lqi, int type)
{
- return lustre_read_quota_file_info(lqi->qi_files[type], &lqi->qi_info[type]);
+ return lustre_read_quota_file_info(lqi->qi_files[type],
+ &lqi->qi_info[type]);
}
/**
if (le16_to_cpu(dh->dqdh_entries) + 1 >= dqstrinblk)
if ((*err = remove_free_dqentry(filp, info, buf, blk)) < 0) {
CDEBUG(D_ERROR,
- "VFS: find_free_dqentry(): Can't remove block (%u) from entry free list.\n",
- blk);
+ "VFS: find_free_dqentry(): Can't remove block "
+ "(%u) from entry free list.\n", blk);
goto out_buf;
}
dh->dqdh_entries = cpu_to_le16(le16_to_cpu(dh->dqdh_entries) + 1);
/* Find free structure in block */
for (i = 0; i < dqstrinblk &&
memcmp((char *)&emptydquot[version],
- (char*)ddquot + i * dqblk_sz,
- dqblk_sz); i++);
+ (char *)ddquot + i * dqblk_sz, dqblk_sz);
+ i++);
if (i == dqstrinblk) {
CDEBUG(D_ERROR,
- "VFS: find_free_dqentry(): Data block full but it shouldn't.\n");
+ "VFS: find_free_dqentry(): Data block full but it "
+ "shouldn't.\n");
*err = -EIO;
goto out_buf;
}
if ((*err = write_blk(filp, blk, buf)) < 0) {
CDEBUG(D_ERROR,
- "VFS: find_free_dqentry(): Can't write quota data block %u.\n",
- blk);
+ "VFS: find_free_dqentry(): Can't write quota data "
+ "block %u.\n", blk);
goto out_buf;
}
dquot->dq_off =
/**
* Insert reference to structure into the trie
*/
-static int do_insert_tree(struct lustre_dquot *dquot, uint * treeblk, int depth,
+static int do_insert_tree(struct lustre_dquot *dquot, uint * treeblk, int depth,
lustre_quota_version_t version)
{
struct lustre_quota_info *lqi = dquot->dq_info;
if (newblk) {
CDEBUG(D_ERROR,
- "VFS: Inserting already present quota entry (block %u).\n",
+ "VFS: Inserting already present quota entry "
+ "(block %u).\n",
ref[GETIDINDEX(dquot->dq_id, depth)]);
ret = -EIO;
goto out_buf;
if (!dquot->dq_off)
if ((ret = dq_insert_tree(dquot, version)) < 0) {
CDEBUG(D_ERROR,
- "VFS: Error %Zd occurred while creating quota.\n",
- ret);
+ "VFS: Error %Zd occurred while creating "
+ "quota.\n", ret);
return ret;
}
filp = dquot->dq_info->qi_files[type];
offset = dquot->dq_off;
- /* Argh... We may need to write structure full of zeroes but that would be
- * treated as an empty place by the rest of the code. Format change would
- * be definitely cleaner but the problems probably are not worth it */
+ /* Argh... We may need to write structure full of zeroes but that would
+ * be treated as an empty place by the rest of the code. Format change
+ * would be definitely cleaner but the problems probably are not worth
+ * it */
if (!memcmp((char *)&emptydquot[version], ddquot, dqblk_sz))
- ((struct lustre_disk_dqblk_v2 *)ddquot)->dqb_itime = cpu_to_le64(1);
+ ((struct lustre_disk_dqblk_v2 *)ddquot)->dqb_itime =
+ cpu_to_le64(1);
fs = get_fs();
set_fs(KERNEL_DS);
ret = filp->f_op->write(filp, ddquot,
return -ENOMEM;
if (dquot->dq_off >> LUSTRE_DQBLKSIZE_BITS != blk) {
CDEBUG(D_ERROR,
- "VFS: Quota structure has offset to other block (%u) than it should (%u).\n",
+ "VFS: Quota structure has offset to other block (%u) "
+ "than it should (%u).\n",
blk, (uint) (dquot->dq_off >> LUSTRE_DQBLKSIZE_BITS));
goto out_buf;
}
if ((ret = remove_free_dqentry(filp, info, buf, blk)) < 0 ||
(ret = put_free_dqblk(filp, info, buf, blk)) < 0) {
CDEBUG(D_ERROR,
- "VFS: Can't move quota data block (%u) to free list.\n",
- blk);
+ "VFS: Can't move quota data block (%u) to free "
+ "list.\n", blk);
goto out_buf;
}
} else {
if ((ret =
insert_free_dqentry(filp, info, buf, blk)) < 0) {
CDEBUG(D_ERROR,
- "VFS: Can't insert quota data block (%u) to free entry list.\n",
- blk);
+ "VFS: Can't insert quota data block "
+ "(%u) to free entry list.\n", blk);
goto out_buf;
}
} else if ((ret = write_blk(filp, blk, buf)) < 0) {
dqbuf_t buf = getdqbuf();
loff_t ret = 0;
int i;
- struct lustre_disk_dqblk_v2 *ddquot = (struct lustre_disk_dqblk_v2 *)GETENTRIES(buf, version);
+ struct lustre_disk_dqblk_v2 *ddquot =
+ (struct lustre_disk_dqblk_v2 *)GETENTRIES(buf, version);
int dqblk_sz = lustre_disk_dqblk_sz[version];
int dqstrinblk = lustre_dqstrinblk[version];
for (i = 0; i < dqstrinblk; i++)
if (!le32_to_cpu(ddquot[i].dqb_id)
&& memcmp((char *)&emptydquot[version],
- ddquot + i*dqblk_sz,
- dqblk_sz))
+ (char *)&ddquot[i], dqblk_sz))
break;
}
if (i == dqstrinblk) {
/**
* Find entry for given id in the tree
*/
-static loff_t find_tree_dqentry(struct lustre_dquot *dquot, uint blk, int depth,
+static loff_t find_tree_dqentry(struct lustre_dquot *dquot, uint blk, int depth,
lustre_quota_version_t version)
{
struct file *filp = dquot->dq_info->qi_files[dquot->dq_type];
if (ret >= 0)
ret = -EIO;
CDEBUG(D_ERROR,
- "VFS: Error while reading quota structure for id %u.\n",
- dquot->dq_id);
+ "VFS: Error while reading quota structure for id "
+ "%u.\n", dquot->dq_id);
memset(ddquot, 0, dqblk_sz);
} else {
ret = 0;
/* We need to escape back all-zero structure */
if (!memcmp((char *)&fakedquot[version],
ddquot, dqblk_sz))
- ((struct lustre_disk_dqblk_v2 *)ddquot)->dqb_itime = cpu_to_le64(0);
+ ((struct lustre_disk_dqblk_v2 *)ddquot)->dqb_itime =
+ cpu_to_le64(0);
}
set_fs(fs);
disk2memdqb(&dquot->dq_dqb, ddquot, version);
return rc;
}
-int lustre_init_quota_header(struct lustre_quota_info *lqi, int type, int fakemagics)
+int lustre_init_quota_header(struct lustre_quota_info *lqi, int type,
+ int fakemagics)
{
static const uint quota_magics[] = LUSTRE_INITQMAGICS;
static const uint fake_magics[] = LUSTRE_BADQMAGICS;
struct dquot_id *dqid;
/* skip empty entry */
if (!memcmp((char *)&emptydquot[version],
- ddquot + i*dqblk_sz, dqblk_sz))
+ (char *)&ddquot[i], dqblk_sz))
continue;
dqid = kmalloc(sizeof(*dqid), GFP_NOFS);
static void osc_consume_write_grant(struct client_obd *cli,
struct brw_page *pga)
{
+ LASSERT_SPIN_LOCKED(&cli->cl_loi_list_lock);
LASSERT(!(pga->flag & OBD_BRW_FROM_GRANT));
atomic_inc(&obd_dirty_pages);
cli->cl_dirty += CFS_PAGE_SIZE;
int blocksize = cli->cl_import->imp_obd->obd_osfs.os_bsize ? : 4096;
ENTRY;
+ LASSERT_SPIN_LOCKED(&cli->cl_loi_list_lock);
if (!(pga->flag & OBD_BRW_FROM_GRANT)) {
EXIT;
return;
EXIT;
}
-static void osc_update_grant(struct client_obd *cli, struct ost_body *body)
+static void __osc_update_grant(struct client_obd *cli, obd_size grant)
{
client_obd_list_lock(&cli->cl_loi_list_lock);
- CDEBUG(D_CACHE, "got "LPU64" extra grant\n", body->oa.o_grant);
- if (body->oa.o_valid & OBD_MD_FLGRANT)
- cli->cl_avail_grant += body->oa.o_grant;
- /* waiters are woken in brw_interpret */
+ cli->cl_avail_grant += grant;
client_obd_list_unlock(&cli->cl_loi_list_lock);
}
+
+static void osc_update_grant(struct client_obd *cli, struct ost_body *body)
+{
+ if (body->oa.o_valid & OBD_MD_FLGRANT) {
+ CDEBUG(D_CACHE, "got "LPU64" extra grant\n", body->oa.o_grant);
+ __osc_update_grant(cli, body->oa.o_grant);
+ }
+}
static int osc_set_info_async(struct obd_export *exp, obd_count keylen,
void *key, obd_count vallen, void *val,
struct ost_body *body;
if (rc != 0) {
- client_obd_list_lock(&cli->cl_loi_list_lock);
- cli->cl_avail_grant += oa->o_grant;
- client_obd_list_unlock(&cli->cl_loi_list_lock);
+ __osc_update_grant(cli, oa->o_grant);
GOTO(out, rc);
}
rc = osc_set_info_async(cli->cl_import->imp_obd->obd_self_export,
sizeof(KEY_GRANT_SHRINK), KEY_GRANT_SHRINK,
sizeof(*body), body, NULL);
- if (rc) {
- client_obd_list_lock(&cli->cl_loi_list_lock);
- cli->cl_avail_grant += body->oa.o_grant;
- client_obd_list_unlock(&cli->cl_loi_list_lock);
- }
+ if (rc != 0)
+ __osc_update_grant(cli, body->oa.o_grant);
if (body)
OBD_FREE_PTR(body);
RETURN(rc);