From c20047193c2bc268e5c0782f4fed8d10525c1008 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Wed, 3 Apr 2013 08:04:21 -0400 Subject: [PATCH] LU-3050 quota: amend sync write checking from 1.8 client The 1.8 client sync write doesn't carry OBD_BRW_SYNC flag, to interoperate with 1.8 client, the checking for sync write on OST should be amended accordingly. Signed-off-by: Niu Yawei Change-Id: I4179c4878d295dae625f5631b6b02f3b4dd32cb6 Reviewed-on: http://review.whamcloud.com/5928 Reviewed-by: Johann Lombardi Reviewed-by: Fan Yong Tested-by: Hudson Tested-by: Maloo --- lustre/osd-ldiskfs/osd_io.c | 7 ++++++- lustre/osd-zfs/osd_io.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 80c7d76..f350188 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -709,10 +709,15 @@ static int osd_declare_write_commit(const struct lu_env *env, /* ignore quota for the whole request if any page is from * client cache or written by root. * + * XXX once we drop the 1.8 client support, the checking + * for whether page is from cache can be simplified as: + * !(lnb[i].flags & OBD_BRW_SYNC) + * * XXX we could handle this on per-lnb basis as done by * grant. */ if ((lnb[i].flags & OBD_BRW_NOQUOTA) || - !(lnb[i].flags & OBD_BRW_SYNC)) + (lnb[i].flags & (OBD_BRW_FROM_GRANT | OBD_BRW_SYNC)) == + OBD_BRW_FROM_GRANT) ignore_quota = true; } diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index 1597701..b081857 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -558,10 +558,15 @@ static int osd_declare_write_commit(const struct lu_env *env, /* ignore quota for the whole request if any page is from * client cache or written by root. * + * XXX once we drop the 1.8 client support, the checking + * for whether page is from cache can be simplified as: + * !(lnb[i].flags & OBD_BRW_SYNC) + * * XXX we could handle this on per-lnb basis as done by * grant. */ if ((lnb[i].flags & OBD_BRW_NOQUOTA) || - !(lnb[i].flags & OBD_BRW_SYNC)) + (lnb[i].flags & (OBD_BRW_FROM_GRANT | OBD_BRW_SYNC)) == + OBD_BRW_FROM_GRANT) ignore_quota = true; if (size == 0) { /* first valid lnb */ -- 1.8.3.1