Whamcloud - gitweb
b=16461
authorpravins <pravins>
Tue, 11 Nov 2008 06:51:43 +0000 (06:51 +0000)
committerpravins <pravins>
Tue, 11 Nov 2008 06:51:43 +0000 (06:51 +0000)
i=umka
i=h.huang

patch to add lr_padding to lu_range struct. this field will be used by
compact fld work.

lustre/fid/fid_handler.c
lustre/fid/fid_lib.c
lustre/fid/fid_request.c
lustre/include/lustre/lustre_idl.h

index d52b770..774aacc 100644 (file)
@@ -485,7 +485,7 @@ int seq_server_init(struct lu_server_seq *seq,
 
         seq->lss_cli = NULL;
         seq->lss_type = type;
 
         seq->lss_cli = NULL;
         seq->lss_type = type;
-        range_zero(&seq->lss_space);
+        range_init(&seq->lss_space);
         sema_init(&seq->lss_sem, 1);
 
         seq->lss_width = is_srv ?
         sema_init(&seq->lss_sem, 1);
 
         seq->lss_width = is_srv ?
index f472011..254a4e1 100644 (file)
@@ -92,9 +92,10 @@ EXPORT_SYMBOL(LUSTRE_BFL_FID);
 void range_cpu_to_le(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
 void range_cpu_to_le(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
-        CLASSERT(sizeof *src ==
-                 sizeof src->lr_start +
-                 sizeof src->lr_end);
+        CLASSERT(sizeof(*src) ==
+                 sizeof(src->lr_start) +
+                 sizeof(src->lr_end) +
+                 sizeof(src->lr_padding));
         dst->lr_start = cpu_to_le64(src->lr_start);
         dst->lr_end = cpu_to_le64(src->lr_end);
 }
         dst->lr_start = cpu_to_le64(src->lr_start);
         dst->lr_end = cpu_to_le64(src->lr_end);
 }
@@ -103,9 +104,10 @@ EXPORT_SYMBOL(range_cpu_to_le);
 void range_le_to_cpu(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
 void range_le_to_cpu(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
-        CLASSERT(sizeof *src ==
-                 sizeof src->lr_start +
-                 sizeof src->lr_end);
+        CLASSERT(sizeof(*src) ==
+                 sizeof(src->lr_start) +
+                 sizeof(src->lr_end) +
+                 sizeof(src->lr_padding));
         dst->lr_start = le64_to_cpu(src->lr_start);
         dst->lr_end = le64_to_cpu(src->lr_end);
 }
         dst->lr_start = le64_to_cpu(src->lr_start);
         dst->lr_end = le64_to_cpu(src->lr_end);
 }
@@ -115,9 +117,10 @@ EXPORT_SYMBOL(range_le_to_cpu);
 void range_cpu_to_be(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
 void range_cpu_to_be(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
-        CLASSERT(sizeof *src ==
-                 sizeof src->lr_start +
-                 sizeof src->lr_end);
+        CLASSERT(sizeof(*src) ==
+                 sizeof(src->lr_start) +
+                 sizeof(src->lr_end) +
+                 sizeof(src->lr_padding));
         dst->lr_start = cpu_to_be64(src->lr_start);
         dst->lr_end = cpu_to_be64(src->lr_end);
 }
         dst->lr_start = cpu_to_be64(src->lr_start);
         dst->lr_end = cpu_to_be64(src->lr_end);
 }
@@ -126,9 +129,10 @@ EXPORT_SYMBOL(range_cpu_to_be);
 void range_be_to_cpu(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
 void range_be_to_cpu(struct lu_range *dst, const struct lu_range *src)
 {
         /* check that all fields are converted */
-        CLASSERT(sizeof *src ==
-                 sizeof src->lr_start +
-                 sizeof src->lr_end);
+        CLASSERT(sizeof(*src) ==
+                 sizeof(src->lr_start) +
+                 sizeof(src->lr_end) +
+                 sizeof(src->lr_padding));
         dst->lr_start = be64_to_cpu(src->lr_start);
         dst->lr_end = be64_to_cpu(src->lr_end);
 }
         dst->lr_start = be64_to_cpu(src->lr_start);
         dst->lr_end = be64_to_cpu(src->lr_end);
 }
index 4266358..c6c3881 100644 (file)
@@ -88,7 +88,7 @@ static int seq_client_rpc(struct lu_client_seq *seq, struct lu_range *input,
         if (input != NULL)
                 *in = *input;
         else
         if (input != NULL)
                 *in = *input;
         else
-                range_zero(in);
+                range_init(in);
 
         ptlrpc_request_set_replen(req);
 
 
         ptlrpc_request_set_replen(req);
 
@@ -280,7 +280,7 @@ void seq_client_flush(struct lu_client_seq *seq)
         LASSERT(seq != NULL);
         down(&seq->lcs_sem);
         fid_zero(&seq->lcs_fid);
         LASSERT(seq != NULL);
         down(&seq->lcs_sem);
         fid_zero(&seq->lcs_fid);
-        range_zero(&seq->lcs_space);
+        range_init(&seq->lcs_space);
         up(&seq->lcs_sem);
 }
 EXPORT_SYMBOL(seq_client_flush);
         up(&seq->lcs_sem);
 }
 EXPORT_SYMBOL(seq_client_flush);
index 63dab1b..4169b19 100644 (file)
@@ -174,46 +174,61 @@ typedef __u64 seqno_t;
 struct lu_range {
         __u64 lr_start;
         __u64 lr_end;
 struct lu_range {
         __u64 lr_start;
         __u64 lr_end;
+        /** stub for compact fld work. */
+        __u64 lr_padding;
 };
 
 };
 
-static inline __u64 range_space(struct lu_range *r)
+/**
+ * returns  width of given range \a r
+ */
+
+static inline __u64 range_space(const struct lu_range *range)
 {
 {
-        return r->lr_end - r->lr_start;
+        return range->lr_end - range->lr_start;
 }
 
 }
 
-static inline void range_zero(struct lu_range *r)
+/**
+ * initialize range to zero
+ */
+static inline void range_init(struct lu_range *range)
 {
 {
-        r->lr_start = r->lr_end = 0;
+        range->lr_start = range->lr_end = 0;
 }
 
 }
 
-static inline int range_within(struct lu_range *r,
+/**
+ * check if given seq id \a s is within given range \a r
+ */
+static inline int range_within(struct lu_range *range,
                                __u64 s)
 {
                                __u64 s)
 {
-        return s >= r->lr_start && s < r->lr_end;
+        return s >= range->lr_start && s < range->lr_end;
 }
 
 }
 
-static inline void range_alloc(struct lu_range *r,
-                               struct lu_range *s,
-                               __u64 w)
+/**
+ * allocate \a w units of sequence from range \a from.
+ */
+static inline void range_alloc(struct lu_range *to,
+                               struct lu_range *from,
+                               __u64 width)
 {
 {
-        r->lr_start = s->lr_start;
-        r->lr_end = s->lr_start + w;
-        s->lr_start += w;
+        to->lr_start = from->lr_start;
+        to->lr_end = from->lr_start + width;
+        from->lr_start += width;
 }
 
 }
 
-static inline int range_is_sane(struct lu_range *r)
+static inline int range_is_sane(const struct lu_range *range)
 {
 {
-        return (r->lr_end >= r->lr_start);
+        return (range->lr_end >= range->lr_start);
 }
 
 }
 
-static inline int range_is_zero(struct lu_range *r)
+static inline int range_is_zero(const struct lu_range *range)
 {
 {
-        return (r->lr_start == 0 && r->lr_end == 0);
+        return (range->lr_start == 0 && range->lr_end == 0);
 }
 
 }
 
-static inline int range_is_exhausted(struct lu_range *r)
+static inline int range_is_exhausted(const struct lu_range *range)
 {
 {
-        return range_space(r) == 0;
+        return range_space(range) == 0;
 }
 
 #define DRANGE "[%#16.16"LPF64"x-%#16.16"LPF64"x]"
 }
 
 #define DRANGE "[%#16.16"LPF64"x-%#16.16"LPF64"x]"