diff options
author | Jan Kara <jack@suse.cz> | 2010-04-28 13:04:29 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-05-21 13:30:46 -0400 |
commit | ae4f6ef13417deaa49471c0e903914a3ef3be258 (patch) | |
tree | b8ba5499a8ad69678a232ece4d64d18447063054 /fs/ocfs2/quota_global.c | |
parent | f64dd44eb748438783b10b3f7a4968d2656a3c95 (diff) |
ocfs2: Avoid unnecessary block mapping when refreshing quota info
The position of global quota file info does not change. So we do not have
to do logical -> physical block translation every time we reread it from
disk. Thus we can also avoid taking ip_alloc_sem.
Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ocfs2/quota_global.c')
-rw-r--r-- | fs/ocfs2/quota_global.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index f461f9678f9f..f391b11ea98c 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -325,6 +325,7 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
325 | struct ocfs2_global_disk_dqinfo dinfo; | 325 | struct ocfs2_global_disk_dqinfo dinfo; |
326 | struct mem_dqinfo *info = sb_dqinfo(sb, type); | 326 | struct mem_dqinfo *info = sb_dqinfo(sb, type); |
327 | struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv; | 327 | struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv; |
328 | u64 pcount; | ||
328 | int status; | 329 | int status; |
329 | 330 | ||
330 | mlog_entry_void(); | 331 | mlog_entry_void(); |
@@ -351,9 +352,19 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
351 | mlog_errno(status); | 352 | mlog_errno(status); |
352 | goto out_err; | 353 | goto out_err; |
353 | } | 354 | } |
355 | |||
356 | status = ocfs2_extent_map_get_blocks(gqinode, 0, &oinfo->dqi_giblk, | ||
357 | &pcount, NULL); | ||
358 | if (status < 0) | ||
359 | goto out_unlock; | ||
360 | |||
361 | status = ocfs2_qinfo_lock(oinfo, 0); | ||
362 | if (status < 0) | ||
363 | goto out_unlock; | ||
354 | status = sb->s_op->quota_read(sb, type, (char *)&dinfo, | 364 | status = sb->s_op->quota_read(sb, type, (char *)&dinfo, |
355 | sizeof(struct ocfs2_global_disk_dqinfo), | 365 | sizeof(struct ocfs2_global_disk_dqinfo), |
356 | OCFS2_GLOBAL_INFO_OFF); | 366 | OCFS2_GLOBAL_INFO_OFF); |
367 | ocfs2_qinfo_unlock(oinfo, 0); | ||
357 | ocfs2_unlock_global_qf(oinfo, 0); | 368 | ocfs2_unlock_global_qf(oinfo, 0); |
358 | if (status != sizeof(struct ocfs2_global_disk_dqinfo)) { | 369 | if (status != sizeof(struct ocfs2_global_disk_dqinfo)) { |
359 | mlog(ML_ERROR, "Cannot read global quota info (%d).\n", | 370 | mlog(ML_ERROR, "Cannot read global quota info (%d).\n", |
@@ -380,6 +391,10 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
380 | out_err: | 391 | out_err: |
381 | mlog_exit(status); | 392 | mlog_exit(status); |
382 | return status; | 393 | return status; |
394 | out_unlock: | ||
395 | ocfs2_unlock_global_qf(oinfo, 0); | ||
396 | mlog_errno(status); | ||
397 | goto out_err; | ||
383 | } | 398 | } |
384 | 399 | ||
385 | /* Write information to global quota file. Expects exlusive lock on quota | 400 | /* Write information to global quota file. Expects exlusive lock on quota |