X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fll_recover_lost_found_objs.c;h=cb085aa88bf7bb33a8c7b900aa886755803bb5f3;hb=624c5d51a26097bbda9483750422d090761a51d8;hp=cfe9bd4f59f72e561c946470c05f6a7ad5ed3cc7;hpb=08aa217ce49aba1ded52e0f7adb8a607035123fd;p=fs%2Flustre-release.git diff --git a/lustre/utils/ll_recover_lost_found_objs.c b/lustre/utils/ll_recover_lost_found_objs.c index cfe9bd4..cb085aa 100644 --- a/lustre/utils/ll_recover_lost_found_objs.c +++ b/lustre/utils/ll_recover_lost_found_objs.c @@ -27,7 +27,7 @@ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2013, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -248,9 +248,9 @@ static unsigned filetype_dir_table[] = { static int traverse_lost_found(char *src_dir, const char *mount_path) { - DIR *dir_ptr; - struct filter_fid parent_fid; - struct dirent64 *dirent; + DIR *dir_ptr; + struct lustre_mdt_attrs lma; + struct dirent64 *dirent; __u64 ff_seq, ff_objid; char *file_path; char dest_path[PATH_MAX]; @@ -313,27 +313,36 @@ static int traverse_lost_found(char *src_dir, const char *mount_path) case DT_REG: file_path = src_dir; - xattr_len = getxattr(file_path, "trusted.fid", - (void *)&parent_fid, - sizeof(parent_fid)); - - if (xattr_len == -1 || xattr_len < sizeof(parent_fid)) - /* - * Its very much possible that we dont find fid - * on precreated files, LAST_ID - */ - continue; + xattr_len = getxattr(file_path, "trusted.lma", + (void *)&lma, sizeof(lma)); + if (xattr_len == -1 || xattr_len < sizeof(lma)) { + struct filter_fid_old ff; + + /* try old filter_fid EA */ + xattr_len = getxattr(file_path, "trusted.fid", + (void *)&ff, sizeof(ff)); + if (xattr_len == -1 || xattr_len < sizeof(ff)) { + /* + * Its very much possible that we dont find fid + * on precreated files, LAST_ID + */ + continue; + } + ff_seq = le64_to_cpu(ff.ff_seq); + ff_objid = le64_to_cpu(ff.ff_objid); + } else { + ff_seq = le64_to_cpu(lma.lma_self_fid.f_seq); + ff_objid = le32_to_cpu(lma.lma_self_fid.f_oid); + } - ff_seq = le64_to_cpu(parent_fid.ff_seq); sprintf(seq_name, (fid_seq_is_rsvd(ff_seq) || - fid_seq_is_mdt0(ff_seq)) ? LPU64 : LPX64i, + fid_seq_is_mdt0(ff_seq)) ? LPU64 : LPX64i, fid_seq_is_idif(ff_seq) ? 0 : ff_seq); - ff_objid = le64_to_cpu(parent_fid.ff_objid); - sprintf(obj_name, (fid_seq_is_rsvd(parent_fid.ff_seq) || - fid_seq_is_mdt0(parent_fid.ff_seq) || - fid_seq_is_idif(parent_fid.ff_seq)) ? + sprintf(obj_name, (fid_seq_is_rsvd(ff_seq) || + fid_seq_is_mdt0(ff_seq) || + fid_seq_is_idif(ff_seq)) ? LPU64 : LPX64i, ff_objid); grp_info = find_or_create_grp(&grp_info_list, ff_seq,