X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_linkea.h;h=1e07f3ae398dc2a8a624f2b993d7f49bde2c6c6c;hb=refs%2Fchanges%2F78%2F7778%2F9;hp=5790be913bf6582a51c5501941db9c7b5cfa0218;hpb=7e915f5d7177b22bd3cc800137fb505781a2c037;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_linkea.h b/lustre/include/lustre_linkea.h index 5790be9..1e07f3a 100644 --- a/lustre/include/lustre_linkea.h +++ b/lustre/include/lustre_linkea.h @@ -27,6 +27,8 @@ * Author: di wang */ +#define DEFAULT_LINKEA_SIZE 4096 + struct linkea_data { /** * Buffer to keep link EA body. @@ -50,8 +52,27 @@ void linkea_del_buf(struct linkea_data *ldata, const struct lu_name *lname); int linkea_links_find(struct linkea_data *ldata, const struct lu_name *lname, const struct lu_fid *pfid); -#define LINKEA_NEXT_ENTRY(ldata) \ - (struct link_ea_entry *)((char *)ldata.ld_lee + ldata.ld_reclen) +static inline void linkea_first_entry(struct linkea_data *ldata) +{ + LASSERT(ldata != NULL); + LASSERT(ldata->ld_leh != NULL); + + if (ldata->ld_leh->leh_reccount == 0) + ldata->ld_lee = NULL; + else + ldata->ld_lee = (struct link_ea_entry *)(ldata->ld_leh + 1); +} + +static inline void linkea_next_entry(struct linkea_data *ldata) +{ + LASSERT(ldata != NULL); + LASSERT(ldata->ld_leh != NULL); -#define LINKEA_FIRST_ENTRY(ldata) \ - (struct link_ea_entry *)(ldata.ld_leh + 1) + if (ldata->ld_lee != NULL) { + ldata->ld_lee = (struct link_ea_entry *)((char *)ldata->ld_lee + + ldata->ld_reclen); + if ((char *)ldata->ld_lee >= ((char *)ldata->ld_leh + + ldata->ld_leh->leh_len)) + ldata->ld_lee = NULL; + } +}