Skip to content

Commit 9585538

Browse files
Ryan Moellerbehlendorf
authored andcommitted
Const some unchanging variables in zfs_write
Show that these values will not be changing later. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matt Macy <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #11176
1 parent 86e74dc commit 9585538

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

module/zfs/zfs_vnops.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
234234
if (n == 0)
235235
return (0);
236236

237-
rlim64_t limit = MAXOFFSET_T;
237+
const rlim64_t limit = MAXOFFSET_T;
238238

239239
zfsvfs_t *zfsvfs = ZTOZSB(zp);
240240
ZFS_ENTER(zfsvfs);
@@ -278,7 +278,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
278278
return (SET_ERROR(EINVAL));
279279
}
280280

281-
int max_blksz = zfsvfs->z_max_blksz;
281+
const uint64_t max_blksz = zfsvfs->z_max_blksz;
282282

283283
/*
284284
* Pre-fault the pages to ensure slow (eg NFS) pages
@@ -582,7 +582,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
582582
zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
583583
zil_commit(zilog, zp->z_id);
584584

585-
int64_t nwritten = start_resid - uio->uio_resid;
585+
const int64_t nwritten = start_resid - uio->uio_resid;
586586
dataset_kstats_update_write_kstats(&zfsvfs->z_kstat, nwritten);
587587
task_io_account_write(nwritten);
588588

0 commit comments

Comments
 (0)