X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosd-ldiskfs%2Fosd_quota_fmt.c;h=1fb6529d9bff50106549f7323cb8ea49daf38519;hb=3b3d8a35b7eb6de8c637e154f9509bb78695fece;hp=25db1ce6f21ecfc7cac89ccbfdc8adb19db05dfa;hpb=2eeb94d018a1ace05443e5349a29eb00f7090107;p=fs%2Flustre-release.git diff --git a/lustre/osd-ldiskfs/osd_quota_fmt.c b/lustre/osd-ldiskfs/osd_quota_fmt.c index 25db1ce..1fb6529 100644 --- a/lustre/osd-ldiskfs/osd_quota_fmt.c +++ b/lustre/osd-ldiskfs/osd_quota_fmt.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2011, 2012, Whamcloud, Inc. + * Copyright (c) 2012, 2015, Intel Corporation. * Use is subject to license terms. * * Lustre administrative quota format. @@ -40,7 +40,7 @@ static const union static inline dqbuf_t getdqbuf(void) { - dqbuf_t buf = cfs_alloc(LUSTRE_DQBLKSIZE, CFS_ALLOC_IO); + dqbuf_t buf = kmalloc(LUSTRE_DQBLKSIZE, GFP_NOFS); if (!buf) CWARN("Not enough memory for quota buffers.\n"); return buf; @@ -48,7 +48,7 @@ static inline dqbuf_t getdqbuf(void) static inline void freedqbuf(dqbuf_t buf) { - cfs_free(buf); + kfree(buf); } /** @@ -64,6 +64,9 @@ static ssize_t quota_read_blk(const struct lu_env *env, ENTRY; memset(buf, 0, LUSTRE_DQBLKSIZE); + LASSERTF((type == USRQUOTA || type == GRPQUOTA || type == PRJQUOTA), + "type=%d\n", type); + ret = sb->s_op->quota_read(sb, type, buf, LUSTRE_DQBLKSIZE, blk << LUSTRE_DQBLKSIZE_BITS); @@ -157,7 +160,7 @@ loff_t find_tree_dqentry(const struct lu_env *env, if (!buf) RETURN(-ENOMEM); - ret = quota_read_blk(env, obj, 0, blk, buf); + ret = quota_read_blk(env, obj, type, blk, buf); if (ret < 0) { CERROR("Can't read quota tree block %u.\n", blk); GOTO(out_buf, ret); @@ -195,7 +198,7 @@ int walk_block_dqentry(const struct lu_env *env, struct osd_object *obj, int type, uint blk, uint index, struct osd_it_quota *it) { - dqbuf_t buf = getdqbuf(); + dqbuf_t buf; loff_t ret = 0; struct lustre_disk_dqdbheader *dqhead; int i, dqblk_sz; @@ -204,11 +207,12 @@ int walk_block_dqentry(const struct lu_env *env, struct osd_object *obj, ENTRY; /* check if the leaf block has been processed before */ - cfs_list_for_each_entry(leaf, &it->oiq_list, oql_link) { + list_for_each_entry(leaf, &it->oiq_list, oql_link) { if (leaf->oql_blk == blk) RETURN(1); } + buf = getdqbuf(); dqhead = (struct lustre_disk_dqdbheader *)buf; dqblk_sz = sizeof(struct lustre_disk_dqblk_v2); if (!buf) @@ -220,7 +224,7 @@ int walk_block_dqentry(const struct lu_env *env, struct osd_object *obj, } ret = 1; - if (!le32_to_cpu(dqhead->dqdh_entries)) + if (!le16_to_cpu(dqhead->dqdh_entries)) GOTO(out_buf, ret); ddquot = (struct lustre_disk_dqblk_v2 *)GETENTRIES(buf); @@ -283,12 +287,10 @@ int walk_tree_dqentry(const struct lu_env *env, struct osd_object *obj, depth + 1, 0, it); else ret = walk_block_dqentry(env, obj, type, blk, 0, it); - } - if (ret == 0) { /* Entry found */ - it->oiq_blk[depth + 1] = blk; - it->oiq_index[depth] = index; } + it->oiq_blk[depth + 1] = blk; + it->oiq_index[depth] = index; out_buf: freedqbuf(buf);