Skip to content

Commit e2f9c4e

Browse files
committed
staging/lustre/llite: cache jobid in lu_env
Now we need an extra memory copy to get jobid, let's cache it in lu_env. It then is copied from lu_env to ll_inode_info upon every read/write. Signed-off-by: Peng Tao <bergwolf@gmail.com>
1 parent e506e96 commit e2f9c4e

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

drivers/staging/lustre/lustre/llite/file.c

+2
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,8 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
846846
struct cl_io *io;
847847
ssize_t result;
848848

849+
ll_io_set_jobid(env, lli);
850+
849851
restart:
850852
io = ccc_env_thread_io(env);
851853
ll_io_init(io, file, iot == CIT_WRITE);

drivers/staging/lustre/lustre/llite/llite_internal.h

+16
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,7 @@ struct vvp_thread_info {
968968
struct ra_io_arg vti_ria;
969969
struct kiocb vti_kiocb;
970970
struct ll_cl_context vti_io_ctx;
971+
char vti_jobid[JOBSTATS_JOBID_SIZE];
971972
};
972973

973974
static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env)
@@ -980,6 +981,21 @@ static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env)
980981
return info;
981982
}
982983

984+
static inline char *vvp_env_jobid(const struct lu_env *env)
985+
{
986+
return vvp_env_info(env)->vti_jobid;
987+
}
988+
989+
static inline void ll_io_set_jobid(const struct lu_env *env, struct ll_inode_info *lli)
990+
{
991+
char *jobid = vvp_env_jobid(env);
992+
993+
if (jobid[0] == '\0')
994+
lustre_get_jobid(jobid);
995+
996+
memcpy(lli->lli_jobid, jobid, JOBSTATS_JOBID_SIZE);
997+
}
998+
983999
static inline struct vvp_io_args *vvp_env_args(const struct lu_env *env,
9841000
enum vvp_io_subtype type)
9851001
{

drivers/staging/lustre/lustre/llite/llite_mmap.c

+1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
205205
* while truncate is on-going. */
206206
inode = ccc_object_inode(io->ci_obj);
207207
lli = ll_i2info(inode);
208+
ll_io_set_jobid(env, lli);
208209
down_read(&lli->lli_trunc_sem);
209210

210211
result = cl_io_loop(env, io);

drivers/staging/lustre/lustre/llite/vvp_io.c

-8
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,6 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
11171117
result = 0;
11181118
if (io->ci_type == CIT_READ || io->ci_type == CIT_WRITE) {
11191119
size_t count;
1120-
struct ll_inode_info *lli = ll_i2info(inode);
11211120

11221121
count = io->u.ci_rw.crw_count;
11231122
/* "If nbyte is 0, read() will return 0 and have no other
@@ -1128,13 +1127,6 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
11281127
cio->cui_tot_count = count;
11291128
cio->cui_tot_nrsegs = 0;
11301129
}
1131-
/* for read/write, we store the jobid in the inode, and
1132-
* it'll be fetched by osc when building RPC.
1133-
*
1134-
* it's not accurate if the file is shared by different
1135-
* jobs.
1136-
*/
1137-
lustre_get_jobid(lli->lli_jobid);
11381130
} else if (io->ci_type == CIT_SETATTR) {
11391131
if (!cl_io_is_trunc(io))
11401132
io->ci_lockreq = CILR_MANDATORY;

0 commit comments

Comments
 (0)