diff options
author | Theodore Ts'o <tytso@mit.edu> | 2019-09-01 01:17:42 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-09-02 20:35:14 -0400 |
commit | 638940d422eade53c9d22ad3db8f412d74a76d90 (patch) | |
tree | 4e2fd4329535e8134752fd3be6c1f8f6c910d52a | |
parent | 2e8cb3bebfd72c35922ddd5229fe0117b61ff19d (diff) | |
download | e2fsprogs-638940d422eade53c9d22ad3db8f412d74a76d90.tar.gz |
libsupport: remove unnecessary code to set the quota inode size
This is done correctly by the fileio routines; and it forces the quota
inode's file size to be unnecessarily rounded up to the block size.
Also remove the unnecessary double colon in the quota's error messages.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | lib/support/common.h | 4 | ||||
-rw-r--r-- | lib/support/quotaio.c | 36 |
2 files changed, 3 insertions, 37 deletions
diff --git a/lib/support/common.h b/lib/support/common.h index 19a75f4c1..00a937589 100644 --- a/lib/support/common.h +++ b/lib/support/common.h @@ -22,12 +22,12 @@ #endif #define log_err(format, arg ...) \ - fprintf(stderr, "[ERROR] %s:%d:%s:: " format "\n", \ + fprintf(stderr, "[ERROR] %s:%d:%s: " format "\n", \ __FILE__, __LINE__, __func__, ## arg) #ifdef DEBUG_QUOTA # define log_debug(format, arg ...) \ - fprintf(stderr, "[DEBUG] %s:%d:%s:: " format "\n", \ + fprintf(stderr, "[DEBUG] %s:%d:%s: " format "\n", \ __FILE__, __LINE__, __func__, ## arg) #else # define log_debug(...) diff --git a/lib/support/quotaio.c b/lib/support/quotaio.c index 2daf17858..b41bb7498 100644 --- a/lib/support/quotaio.c +++ b/lib/support/quotaio.c @@ -105,19 +105,6 @@ void update_grace_times(struct dquot *q) } } -static int compute_num_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)), - blk64_t *blocknr EXT2FS_ATTR((unused)), - e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), - blk64_t ref_block EXT2FS_ATTR((unused)), - int ref_offset EXT2FS_ATTR((unused)), - void *private) -{ - blk64_t *num_blocks = private; - - *num_blocks += 1; - return 0; -} - errcode_t quota_inode_truncate(ext2_filsys fs, ext2_ino_t ino) { struct ext2_inode inode; @@ -147,18 +134,6 @@ errcode_t quota_inode_truncate(ext2_filsys fs, ext2_ino_t ino) return err; } -static ext2_off64_t compute_inode_size(ext2_filsys fs, ext2_ino_t ino) -{ - blk64_t num_blocks = 0; - - ext2fs_block_iterate3(fs, ino, - BLOCK_FLAG_READ_ONLY, - NULL, - compute_num_blocks_proc, - &num_blocks); - return num_blocks * fs->blocksize; -} - /* Functions to read/write quota file. */ static unsigned int quota_write_nomount(struct quota_file *qf, ext2_loff_t offset, @@ -413,17 +388,8 @@ errcode_t quota_file_close(quota_ctx_t qctx, struct quota_handle *h) if (h->qh_ops->end_io && h->qh_ops->end_io(h) < 0) return EIO; - if (h->qh_qf.e2_file) { - __u64 new_size, size; - - new_size = compute_inode_size(h->qh_qf.fs, h->qh_qf.ino); - ext2fs_file_flush(h->qh_qf.e2_file); - if (ext2fs_file_get_lsize(h->qh_qf.e2_file, &size)) - new_size = 0; - if (size != new_size) - ext2fs_file_set_size2(h->qh_qf.e2_file, new_size); + if (h->qh_qf.e2_file) ext2fs_file_close(h->qh_qf.e2_file); - } if (qctx->quota_file[h->qh_type] == h) ext2fs_free_mem(&qctx->quota_file[h->qh_type]); return 0; |