Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-5774

lu_object_find_at() should NOT test conditional that doesn't change inside a loop

Details

    • Improvement
    • Resolution: Fixed
    • Trivial
    • Lustre 2.7.0
    • Lustre 2.7.0
    • None
    • 16208

    Description

      In lu_object_find_at():

             while (1) {
                     if (conf != NULL && conf->loc_flags & LOC_F_NOWAIT) {
                             obj = lu_object_find_try(env, dev, f, conf, NULL);
      
                             return obj;
              ......
              }
      

      If I haven't missed something, it doesn't make sense to have the 'if' conditional inside the while loop - conf is a const struct lu_object_conf *, i.e. it doesn't change, so the conditional would always evaluate the same.

      When I first read the code, I was misled to believe that the conditional may change so it had to be tested at each iteration.

      Attachments

        Issue Links

          Activity

            [LU-5774] lu_object_find_at() should NOT test conditional that doesn't change inside a loop

            This enhancement was included in the patch http://review.whamcloud.com/#/c/12741 for LU-5885.

            simmonsja James A Simmons added a comment - This enhancement was included in the patch http://review.whamcloud.com/#/c/12741 for LU-5885 .
            isaac Isaac Huang (Inactive) added a comment - http://review.whamcloud.com/#/c/12354/

            People

              isaac Isaac Huang (Inactive)
              isaac Isaac Huang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: