diff options
author | Geliang Tang <geliangtang@163.com> | 2015-11-18 08:40:33 -0500 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-11-18 09:21:49 -0500 |
commit | 8ace5dfb983e89dbcfcb42ff25df6e4240c555bb (patch) | |
tree | ace737a4a6603a5acf69027b997e2fd86ce84de1 /fs/locks.c | |
parent | 95ace75414f312f9a7b93d873f386987b92a5301 (diff) |
locks: use list_first_entry_or_null()
Simplify the code with list_first_entry_or_null().
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/locks.c b/fs/locks.c index 86c94674ab22..d2ee8e365ba7 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1505,12 +1505,10 @@ void lease_get_mtime(struct inode *inode, struct timespec *time) | |||
1505 | ctx = smp_load_acquire(&inode->i_flctx); | 1505 | ctx = smp_load_acquire(&inode->i_flctx); |
1506 | if (ctx && !list_empty_careful(&ctx->flc_lease)) { | 1506 | if (ctx && !list_empty_careful(&ctx->flc_lease)) { |
1507 | spin_lock(&ctx->flc_lock); | 1507 | spin_lock(&ctx->flc_lock); |
1508 | if (!list_empty(&ctx->flc_lease)) { | 1508 | fl = list_first_entry_or_null(&ctx->flc_lease, |
1509 | fl = list_first_entry(&ctx->flc_lease, | 1509 | struct file_lock, fl_list); |
1510 | struct file_lock, fl_list); | 1510 | if (fl && (fl->fl_type == F_WRLCK)) |
1511 | if (fl->fl_type == F_WRLCK) | 1511 | has_lease = true; |
1512 | has_lease = true; | ||
1513 | } | ||
1514 | spin_unlock(&ctx->flc_lock); | 1512 | spin_unlock(&ctx->flc_lock); |
1515 | } | 1513 | } |
1516 | 1514 | ||