예제 #1
0
파일: mdd_lproc.c 프로젝트: rread/lustre
/**** changelogs ****/
static int mdd_changelog_mask_seq_show(struct seq_file *m, void *data)
{
    struct mdd_device *mdd = m->private;
    int i = 0;

    while (i < CL_LAST) {
        if (mdd->mdd_cl.mc_mask & (1 << i))
            seq_printf(m, "%s ", changelog_type2str(i));
        i++;
    }
    return 0;
}
예제 #2
0
/**** changelogs ****/
static int lprocfs_rd_changelog_mask(char *page, char **start, off_t off,
                                     int count, int *eof, void *data)
{
        struct mdd_device *mdd = data;
        int i = 0, rc = 0;

        *eof = 1;
        while (i < CL_LAST) {
                if (mdd->mdd_cl.mc_mask & (1 << i))
                        rc += snprintf(page + rc, count - rc, "%s ",
                                       changelog_type2str(i));
                i++;
        }
        return rc;
}
예제 #3
0
static int lustre_changelog_upcall(struct lustre_filesystem *lustre_fs,
				   const struct fsal_up_vector *event_func,
				   struct changelog_rec *rec)
{
	struct changelog_ext_jobid *jid;
	struct changelog_ext_rename *rnm;
	/* changelog are displayed with the format of "lfs changelog" */
	char format_chgl[] =
	  "%llu %02d%-5s %02d:%02d:%02d.%06d %04d.%02d.%02d 0x%x %s t="DFID;
	char message[LEN_MESSAGE];
	char message2[LEN_MESSAGE];

	struct tm ts;
	time_t secs;
	int rc;

	secs = rec->cr_time >> 30;
	gmtime_r(&secs, &ts);

	if (rec->cr_flags & CLF_JOBID)
		jid = changelog_rec_jobid(rec);
	else
		return -1;

	if (rec->cr_flags & CLF_RENAME)
		rnm = changelog_rec_rename(rec);
		snprintf(message, LEN_MESSAGE, format_chgl,
			rec->cr_index,
			rec->cr_type,
			changelog_type2str(rec->cr_type),
			ts.tm_hour,
			ts.tm_min,
			ts.tm_sec,
			(int)(rec->cr_time & ((1 << 30) - 1)),
			ts.tm_year + 1900,
			ts.tm_mon + 1,
			ts.tm_mday,
			rec->cr_flags & CLF_FLAGMASK,
			jid->cr_jobid,
			PFID(&rec->cr_tfid));

	if (rec->cr_namelen)
		snprintf(message2, LEN_MESSAGE,
			 " p="DFID" %.*s",
			 PFID(&rec->cr_pfid),
			 rec->cr_namelen,
			 changelog_rec_name(rec));
	else
		message2[0] = '\0';

	strncat(message, message2, LEN_MESSAGE);
	LogFullDebug(COMPONENT_FSAL_UP, "%s", message);

	switch (rec->cr_type) {
	case CL_CREATE:
	case CL_MKDIR:
	case CL_HARDLINK:
	case CL_SOFTLINK:
	case CL_MKNOD:
	case CL_UNLINK:
	case CL_RMDIR:
		/* invalidate parent entry */
		rc = lustre_invalidate_entry(lustre_fs,
					     event_func,
					     &rec->cr_pfid);
		if (rc)
			LogDebug(COMPONENT_FSAL,
				 "Could not invalidate fid="DFID,
				 PFID(&rec->cr_pfid));
		break;
	case CL_RENAME:
		/* invalidate parent entry
		 * and target entry */
		rc = lustre_invalidate_entry(lustre_fs,
					     event_func,
					     &rnm->cr_spfid);
		if (rc)
			LogDebug(COMPONENT_FSAL,
				 "Could not invalidate fid="DFID,
				 PFID(&rnm->cr_spfid));

		rc = lustre_invalidate_entry(lustre_fs,
					     event_func,
					     &rec->cr_pfid);
		if (rc)
			LogDebug(COMPONENT_FSAL,
				 "Could not invalidate fid="DFID,
				 PFID(&rec->cr_pfid));

		rc = lustre_invalidate_entry(lustre_fs,
					     event_func,
					     &rec->cr_tfid);
		if (rc)
			LogDebug(COMPONENT_FSAL,
				 "Could not invalidate fid="DFID,
				 PFID(&rec->cr_tfid));

		break;
	case CL_ATIME:
	case CL_MTIME:
	case CL_CTIME:
	case CL_SETATTR:
		/* invalidate target entry */
		rc = lustre_invalidate_entry(lustre_fs,
					     event_func,
					     &rec->cr_tfid);
		if (rc)
			LogDebug(COMPONENT_FSAL,
				 "Could not invalidate fid="DFID,
				 PFID(&rec->cr_tfid));
		break;
	default:
		/* untracked record type */
		break;
	}
	return 0;
}