X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ffid%2Flproc_fid.c;h=de7a5cb3c77f89214a1c8a9fb9ecfee62d08fe04;hb=ef0f617b354d8e41c07efa74c9fe051012ed773f;hp=63b4c1629f909beb449a9b5e203887666fefca39;hpb=919b358468e13a0ba8719bd4a4c135e11017dd8b;p=fs%2Flustre-release.git diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 63b4c16..de7a5cb 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -53,16 +53,19 @@ #include #ifdef LPROCFS -/* - * Note: this function is only used for testing, it is no safe for production - * use. +/** + * Reduce the SEQ range allocated to a node to a strict subset of the range + * currently-allocated SEQ range. If the specified range is "clear", then + * drop all allocated sequences and request a new one from the master. + * + * Note: this function should only be used for testing, it is not necessarily + * safe for production use. */ -static int -seq_proc_write_common(struct file *file, const char *buffer, - unsigned long count, void *data, - struct lu_seq_range *range) +static int seq_proc_write_common(struct file *file, const char *buffer, + unsigned long count, void *data, + struct lu_seq_range *range) { - struct lu_seq_range tmp; + struct lu_seq_range tmp = { 0, }; int rc; ENTRY; @@ -73,24 +76,25 @@ seq_proc_write_common(struct file *file, const char *buffer, RETURN(0); } - rc = sscanf(buffer, "[%llx - %llx]\n", - (long long unsigned *)&tmp.lsr_start, - (long long unsigned *)&tmp.lsr_end); - if (rc != 2 || !range_is_sane(&tmp) || range_is_zero(&tmp)) + /* of the form "[0x0000000240000400 - 0x000000028000400]" */ + rc = sscanf(buffer, "[%llx - %llx]\n", + (long long unsigned *)&tmp.lsr_start, + (long long unsigned *)&tmp.lsr_end); + if (!range_is_sane(&tmp) || range_is_zero(&tmp) || + tmp.lsr_start < range->lsr_start || tmp.lsr_end > range->lsr_end) RETURN(-EINVAL); *range = tmp; - RETURN(0); + RETURN(0); } -static int -seq_proc_read_common(char *page, char **start, off_t off, - int count, int *eof, void *data, - struct lu_seq_range *range) +static int seq_proc_read_common(char *page, char **start, off_t off, + int count, int *eof, void *data, + struct lu_seq_range *range) { int rc; ENTRY; - *eof = 1; + *eof = 1; rc = snprintf(page, count, "["LPX64" - "LPX64"]:%x:%s\n", PRANGE(range)); RETURN(rc); @@ -354,7 +358,7 @@ static int fldb_seq_open(struct inode *inode, struct file *file) fld = ss->lss_site->ss_server_fld; LASSERT(fld != NULL); - LPROCFS_ENTRY_AND_CHECK(dp); + LPROCFS_ENTRY_CHECK(dp); rc = seq_open(file, &fldb_sops); if (rc) GOTO(out, rc); @@ -392,7 +396,6 @@ out: lu_env_fini(¶m->fsp_env); if (param != NULL) OBD_FREE_PTR(param); - LPROCFS_EXIT(); } return rc; }