struct llog_rec_tail end;
loff_t saved_off = file->f_pos;
int buflen = rec->lrh_len;
+
ENTRY;
file->f_pos = off;
obd = handle->lgh_ctxt->loc_exp->exp_obd;
- if (handle->lgh_file->f_dentry->d_inode->i_size == 0) {
+ if (i_size_read(handle->lgh_file->f_dentry->d_inode) == 0) {
CDEBUG(D_HA, "not reading header from 0-byte log\n");
RETURN(LLOG_EEMPTY);
}
}
handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index;
- handle->lgh_file->f_pos = handle->lgh_file->f_dentry->d_inode->i_size;
+ handle->lgh_file->f_pos = i_size_read(handle->lgh_file->f_dentry->d_inode);
RETURN(rc);
}
if (buf)
/* write_blob adds header and tail to lrh_len. */
reclen = sizeof(*rec) + rec->lrh_len +
- sizeof(struct llog_rec_tail);
+ sizeof(struct llog_rec_tail);
if (idx != -1) {
loff_t saved_offset;
/* no header: only allowed to insert record 1 */
- if (idx != 1 && !file->f_dentry->d_inode->i_size) {
+ if (idx != 1 && !i_size_read(file->f_dentry->d_inode)) {
CERROR("idx != -1 in empty log\n");
LBUG();
}
-
+
if (idx && llh->llh_size && llh->llh_size != rec->lrh_len)
RETURN(-EINVAL);
"modify record "LPX64": idx:%d/%u/%d, len:%u "
"offset %llu\n",
loghandle->lgh_id.lgl_oid, idx, rec->lrh_index,
- loghandle->lgh_cur_idx,
- rec->lrh_len, saved_offset - sizeof(*llh));
+ loghandle->lgh_cur_idx, rec->lrh_len,
+ (long long)(saved_offset - sizeof(*llh)));
if (rec->lrh_index != loghandle->lgh_cur_idx) {
CERROR("modify idx mismatch %u/%d\n",
idx, loghandle->lgh_cur_idx);
CDEBUG(D_OTHER, "looking for log index %u (cur idx %u off "LPU64")\n",
next_idx, *cur_idx, *cur_offset);
- while (*cur_offset < loghandle->lgh_file->f_dentry->d_inode->i_size) {
+ while (*cur_offset < i_size_read(loghandle->lgh_file->f_dentry->d_inode)) {
struct llog_rec_hdr *rec;
struct llog_rec_tail *tail;
loff_t ppos;
/* put number of bytes read into rc to make code simpler */
rc = ppos - *cur_offset;
*cur_offset = ppos;
-
+
if (rc < len) {
/* signal the end of the valid buffer to llog_process */
memset(buf + rc, 0, len - rc);
cur_offset = LLOG_CHUNK_SIZE;
llog_skip_over(&cur_offset, 0, prev_idx);
- while (cur_offset < loghandle->lgh_file->f_dentry->d_inode->i_size) {
+ while (cur_offset < i_size_read(loghandle->lgh_file->f_dentry->d_inode)) {
struct llog_rec_hdr *rec;
struct llog_rec_tail *tail;
loff_t ppos;
handle->lgh_id.lgl_ogen =
handle->lgh_file->f_dentry->d_inode->i_generation;
} else {
- oa = obdo_alloc();
+ OBDO_ALLOC(oa);
if (oa == NULL)
GOTO(cleanup, rc = -ENOMEM);
handle->lgh_ctxt = ctxt;
finish:
if (oa)
- obdo_free(oa);
+ OBDO_FREE(oa);
RETURN(rc);
cleanup:
switch (cleanup_phase) {
RETURN(rc);
}
- oa = obdo_alloc();
+ OBDO_ALLOC(oa);
if (oa == NULL)
RETURN(-ENOMEM);
rc = obd_destroy(handle->lgh_ctxt->loc_exp, oa, NULL, NULL, NULL);
out:
- obdo_free(oa);
+ OBDO_FREE(oa);
RETURN(rc);
}
GOTO(out, rc = -ENOENT);
}
- CDEBUG(D_CONFIG, "cat list: disk size=%d, read=%d\n",
- (int)file->f_dentry->d_inode->i_size, size);
+ CDEBUG(D_CONFIG, "cat list: disk size=%d, read=%d\n",
+ (int)i_size_read(file->f_dentry->d_inode), size);
rc = fsfilt_read_record(disk_obd, file, idarray, size, &off);
if (rc) {